I've wrote a script for fetch real uptime and display in monit
. But I think it displays just exit error status. My uptime script is:
#!/bin/sh
uptime=`uptime | awk -F " " '{print $3}'`
echo $uptime
exit $uptime
When I run it in terminal result is true
For example:
# uptime
08:39:01 up 421 days, 19:54, 1 user, load average: 0.06, 0.10, 0.06
# ./up_time.sh
421
Script works well. But when monit starts to run this script by up_time.conf file;
Program Status Last started Exit value
days_up Status ok Thu, 01 Aug 2013 08:41:08 165
I saw on the browser. I guess that Exit value
is the bash exit error code. I cant get why other script are works fine but this one does not do his job
Speaking of which, monit
up_time.conf
file is like this:
check program days_up with path "/etc/monit/scripts/up_time.sh"
if status < 1 then alert