APP_MON module routines - WIN32

Company Information Software Products TDF Market Reports Download Area take me Home

app_mon.c - a simple application monitor program

This is a simple example program used to monitor multiple program's output or general health across your LAN. This program works by monitoring udp tranmissions from the watched target programs. The way is it currently configured I use it to monitor data flow on my lan generated by 2 real-time data collection packages during market hours. And I monitor my unix server 24 hours / day. When some-one goes quiet for more than 90 seconds I update the screen display to crashed and repeat a siren alarm every 60 seconds.

Function WinMain
Include file APP_MON.H
Prototype int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow )
Remarks This is the main entry point for app_mon.

Function process_cmd_line_4_arguments
Include file APP_MON.H
Prototype void process_cmd_line_4_arguments( LPSTR lpCmdLine )
Remarks Process the user's command line arguments into a argv array which then is processed by the normal getargs() procedure to store the data into the programs switch flags.

Function WndProc
Include file APP_MON.H
Prototype long CALLBACK WndProc( HWND hWnd , UINT mesg , UINT wParam , LONG lParam )
Remarks This is a simple win proc for supporting the app_mon program. The only important thing done here is hanging a timer tick routine to support the checking the status of the monitored UDP ports. This is not the displaying window - the display is a dialog box.

Function cnvt_2_seconds_past_midnight
Include file APP_MON.H
Prototype int cnvt_2_seconds_past_midnight( char *time_str )
Remarks Convert a HH:MM:SS time string into a integer value of total seconds since midnight.

Function timer_tick
Include file APP_MON.H
Prototype void timer_tick( void )
Remarks This the main worker routine for app_mon. This routine controls the start-up of the port monitoring, the actual checking of all the monitored ports and the display update with the current program states.

Function main_dialog_func
Include file APP_MON.H
Prototype long CALLBACK main_dialog_func( HWND hWnd , UINT mesg , UINT wParam , LONG lParam )
Remarks The is the main user interface object - a modal dialog box. The only functions that are supported are - resetting the display counts and status and exit the app.

Function load_dialog_data
Include file APP_MON.H
Prototype void load_dialog_data( HWND hWnd )
Remarks Load the user interface dialog box with the current monitored appilcation names, counts and status.

Function init_app_recs_channels
Include file APP_MON.H
Prototype void init_app_recs_channels( void )
Remarks This routine handles allocating and opening all the monitored udp ports.

Function reset_app_recs
Include file APP_MON.H
Prototype void reset_app_recs( void )
Remarks Turn off all alarms and clear all counters for all the monitored applications.

Function chk_the_ports
Include file APP_MON.H
Prototype void chk_the_ports( void )
Remarks This routine does the actual work of monitoring each application. It checks each port for current udp traffic or checks how long it has been since it heard something. If it has been too long it sets the crashed alarm and plays the crashed alarm wav file. If traffic is seen it just updates the counts and continues on.

Function chk_rpt_tun_port
Include file APP_MON.H
Prototype void chk_rpt_tun_port( void )
Remarks This is a special port that I monitor from my unix system 24 hours per day unlike the other ports that I monitor just during the trading session (since they are carrying market data). This port is actually monitoring the state of my ppp connection.

Function PlayResource
Include file APP_MON.H
Prototype BOOL PlayResource( HINSTANCE hInstance , char *pszSound )
Remarks This routine will load a wav file resource from an application's image file into memory and play it.

Table of Contents Function Index

generated on 22 September 1998 - 12:54:28
© 1998 Tierra del Fuego Ltd.