Previous Topic: Reconfigure Extension Scripts Through SNMPNext Topic: Monitor Processes


Monitor Log Files and Send Notification Through Email

This example monitors Windows Hotfix log files for fatal string occurrences. If the fatal string occurs, SystemEDGE sends a notification through email. The example consists of an entry for the sysedge.cf file and an associated Send_Notification_Mail.cmd script.

Note: The #no_actions directive must not be active. Prepend it with the comment (#) character.

watch logfile 44 0x8 ‘%windir%\KB*.log 'fatal' 'check KB for fatal occurrence in MS hotfix log' "%CASYSEDGE%\My_Scripts\Send_Notification_Mail.cmd" 1 warning

Script Send_Notification_Mail.cmd

rem *** Get arguments in which we are interested ***
set regexpr=%3
set lasttime=%5
set description=%6

rem  *** Shift to get argument %10 as %9 ***
shift
set current_file=%9

rem *** Call email *** 
“c:\Program Files\CA\SystemEDGE\bin\email.exe” -r smtp.company.com sysedge@% COMPUTERNAME% you@company.com 'KB log fatal found' ’File monitor %description% activated. %regexpr% pattern found in %current_file% at time %lasttime%’