前のトピック: SNMP を介した拡張スクリプトの再設定

次のトピック: モニタ プロセス

ログ ファイルのモニタと、電子メールによる通知の送信

この例では、Windows 修正プログラムのログ ファイルをモニタして、「fatal」という文字列がないかどうかを確認します。 「fatal」という文字列がある場合、SystemEDGE は電子メールによって通知を送信します。 この例は、sysedge.cf ファイルのエントリと、関連する Send_Notification_Mail.cmd スクリプトから構成されています。

注: #no_actions ディレクティブはアクティブにしないでください。 先頭にコメント(#)文字を付加してください。

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

Send_Notification_Mail.cmd スクリプト

rem *** 関連する引数を取得 ***
set regexpr=%3
set lasttime=%5
set description=%6

rem  *** 引数 %10 を %9 として取得するためにシフト ***
shift
set current_file=%9

rem *** 電子メールを呼び出す *** 
“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%’