I'm a total noob to Zabbix and this is my first assignment... I need to build a monitor using Zabbix and monitor how long one script runs. The script looks like that:
device0="/home/build/aggregator/scripts/aggregator.lock"
if [ -e "$device0" ]
then
echo process is already running
else
touch $device0
java -Xms6g -Xmx6g -jar /home/build/aggregator/aggregator-1.0-SNAPSHOT-jar-with-dependencies.jar
rm $device0
fi
The script creates a file called aggregator.lock
which makes sure the script runs only once, the script is configured in Crontab to run every minute.
I've created the next Items:
While the aggregator.lock
file exists, Zabbix vfs.file.exists
returns: 1.
[root@zabbix ~]# zabbix_get -s 10.200.X.X -k vfs.file.exists[/home/build/aggregator/scripts/aggregator.lock]
1
[root@zabbix ~]#
And vfs.file.time
check returns: 1400057821 (Unix time).
While the aggregator.lock
file doesn't exist, Zabbix returns: 0.
And vfs.file.time
check returns: ZBX_NOTSUPPORTED .
The check runs every 30 secs in order to minimize traffic in the network but the script runs for about 10-20 seconds every time. So I need to find the best way to monitor the run time of the script, what would be the best way to achieve this aim?