Application health monitoring - how?

  • Thread starter Thread starter Bob
  • Start date Start date
B

Bob

I have an app running 24 7 on a computer hiden away in a closet. I need to
be able to monitor if it has thrown any unhandled exceptions or if it is no
longer responding from another computer on the network. I also need a
supervisor or a tech support guy to be advised ASAP when a problem occurs.
One of the difficulties is that the app uses telephony card drivers from
Dialogic and these sometimes go out to lunch also and we need to know when
these drivers seem to stop doing their jobs.

Does anyone have any suggestions on where to start with this? The app is
written in VS 2003 VB.net and its a Winforms app. I've noticed that in
Vs2005 in ApplicationEvents.vb there is an event that can trap unhandled
exceptions in the application. I haven't seen anything like that in Vs 2003
Vb.NET is there something similar available? I'm stuck with using 2003 for
this app because the telephony stuff is not yet available for 2005.

Any help or suggestions would be greatly appreciated.

Bob
 
Hi Bob,

Its best to build instrumentation into an application from the get go rather
than trying to retro fit it later on. There are a few freely available
patterns on MSDN with respect to application diagnostics and
instrumentation. Scan the list here:

http://msdn.microsoft.com/practices/Topics/manage/default.aspx

Emailing and notification should simply be a plug in service to which you
handoff once the exception/conditions of interest have been met. I would
build notification as a separate subsystem interfaced/triggered by the hand
off in a non notification specfic way. Swapping out email notification for
pager notification should require nothing more than a change to
configuration file, not a recompile.

I haven't seen anything like that in Vs 2003
Vb.NET is there something similar available? I'm stuck with using 2003 for
this app because the telephony stuff is not yet available for 2005.

Out of the box for Winforms in 2003? Not that im aware of but bearing in
mind that .Net is just one big wrapper theres no reason why you cant build
your own. You're essentially just wrapping the application entry point to
ensure it doesn't exit prematurely. Check out the patterns, Im sure they
will have some template code you can use.

tm
 
Bob,

I was in the exact same situation with old Dialogic drivers and cards
not giving reliable notification and not being upgradable. The cure
was as Toff M. suggested: "Emailing and notification should simply be a
plug in service to which you handoff once the exception/conditions of
interest have been met. I would build notification as a separate
subsystem interfaced/triggered by the hand off in a non notification
specfic way" When the alarm condition occurs call a program that works
reliably. Now in my situation I just have the program shell out to an
alarm dialer.exe which sends out numeric pages over a simple modem.
You can develop a dialer .exe yourself in VB.net,
http://www.microsoft.com/downloads/...ca-e4f1-4846-912c-b4ed37a1578b&DisplayLang=en
or in VB 6.0, http://www.vb-helper.com/howto_dialer.html
or design or purchase any number of different notification methods.
John
 
Thank you both, I had been looking thru the WMI docs for some time. Got a
lot of generalities out of it and how easy it was but not much else.
I was wondering if there were some sample vb.net code that you might be
aware of that shows how to do something like "You're essentially just
wrapping the application entry point to ensure it doesn't exit prematurely."
I understand the principle, just not HOW to implement it.

Your help IS greatly appreciated.
Bob
 
Thanks for the dialer suggestion, however thats not going to fly with the
customer. (needs a telephone line which is an ongoing cost, they have a PBX
and there are people that come and play with its settings which is going to
create additional problems to manage) They already have internet access and
an internal LAN which I mainly manage for them, no outside interference
mostly. I was thinking on the lines of having a service running that starts
automatically on the telephony computer, just sits there and waits for the
app to send it a command (or simple message ) that would activate a message
delivery function. The function automatically would send emails to addresses
that it can get from the services app.config file (one to tech support, one
to a primary admin internally and one to a backup admin internally). I would
also like to send a network message to one or more computers directly that I
can configure their network names in the app.config file and possibly also
send something to pagers and /or PDA devices. The email sending is easy. The
sending to pagers or PDA's I haven't found any useful info on, the sending
to specific computers I had found some info on that which I'm trying to
retrace.

The unsolved problem I have is twofold
1-Detecting an unhandled exception in the Vs2003 app - how to do that and
keep the app running after detection so that it can execute a call to the
service or launch another app as you suggested.
2- How does one execute a call to a public sub or function on a running
service.

I'm trying to find info on these two things on msdn but its a long slow
slug. If someone can show me some sample code or where to get it I would
really appreciate it.

Bob
 
Hey Bob,

Check here for catching unhandled exceptions:
http://www.codeproject.com/dotnet/ExceptionHandling.asp

The key piece is:

AddHandler System.AppDomain.CurrentDomain.UnhandledException, _
AddressOf
UnhandledExceptionHandler

If you catch that, then I suggest (as John did) having a separate .exe
that you shell out in that function, along with some command line args
specifying where the error occured. You can then add any necessary
recovery code in the same function.
 
Back
Top