Come join our live training webinar every other Wednesday at 11am PST and hear LogicMonitor experts explain best practices and answer common questions. We understand these are uncertain times, and we are here to help!
Assume the monitored device in LogicMonitor is “app1″, and the collector monitoring “app1″ runs on the device “agenthost”. There is a cron job “cleanlogs” running at 8:30, 12:30, and 16:30 everyday on app1. Now, we want LogicMonitor to monitor:
The first step of monitoring a Linux cron task is to create a batch job definition via LogicMonitor.
The JobMonitor definition displayed above is associated with device app1, will trigger an alert if the JobMonitor isn’t finished in 10 minutes and will trigger a warning alert if the job starts more than 15 minutes after its scheduled run times of 8:30, 12:30, and 16:30. You should see the JobMonitor associated with the device app1 from the Devices page of your account.
Our cron job cleanlogs currently executes a script “/usr/local/cleanlog.pl” at 8:30, 12:30, and 16:30 everyday:
Copy lmbatchjobwrapper.sh(this file is stored in /usr/local/logicmonitor/agent/lib of collectorhost) to app1.
Run “crontab -e” (or equivalent) and update the command line to the following:
30 8,12,16 * * * /usr/local/lmcollector lmbatchjobwrapper.sh agenthost:7214 app1 "Clean log monitoring" /usr/local/cleanlog.pl
“agenthost:7214″ is the name of the device on which the collector is running and the port on which the collector listen to accept batch job execution notification sent from lmJobMonitorwrapper.js.
“app1″ is the name of the monitored device on which the batch job is running.
“Clean log monitoring” is the name we gave this scheduled task in LogicMonitor (see step 1)
/usr/local/cleanlog.pl tells the wrapper how to start the real program to clean the logs.
You can check every execution of the scheduled task from the Devices page. Executions that didn’t start on time or finished abnormally display with an error.
Assume the monitored device is “app1”, and the collector monitoring “app1” runs on the device “agenthost”. There is a Windows scheduler task “cleanlogs” running at 8:30, 12:30, and 16:30 everyday on app1. Now, we want LogicMonitor to monitor:
The first step of monitoring a Windows scheduler task is to create a batch job definition via LogicMonitor.
The JobMonitor definition displayed above is associated with device app1, will trigger an alert if the JobMonitor isn’t finished in 10 minutes and will trigger a warning alert if the job starts more than 15 minutes after its scheduled run times of 8:30, 12:30 and 16:30. You should see the JobMonitor associated with the device app1 from the Devices page of your account.
Our scheduled task cleanlogs executes a script “C:\scripts\cleanlogs.bat” at 8:30, 12:30, and 16:30 everyday:
Copy lmbatchjobwrapper.js (The file is stored in <collectorInstallationDir>\Agent\lib of collectorhost) to app1.
Open properties dialog of the scheduled task Cleanlogs, and update the command line to the following:
cscript.exe C:\lmcollector\lmbatchjobwrapper.js agenthost:7214 app1 "Clean log monitoring" "cmd.exe /C C:\script\cleanlogs.bat"
“agenthost:7214” is the name of the device on which the collector is running and the port on which the collector listen to accept batch job execution notification sent from lmbatchjobwrapper.js.
“app1” is the name of the monitored device on which the batch job is running.
“cmd.exe /C C:\script\cleanlogs.bat” tells the wrapper how to start the real program to clean the logs.
You can check every execution of the scheduled task from the Devices Page. Executions that didn’t start on time or finished abnormally will be displayed with an error.
In This Article