check_logs.sh
348 Bytes
#!/bin/bash
#Define state
STATE_OK=0
STATE_WARNING=1
STATE_CRITICAL=2
lastlog=`tail -1 /usr/local/freeswitch/log/freeswitch.log`
if [[ "$lastlog" =~ "took too long to complete or database not responding" ]];then
msg="Warning"
status=$STATE_WARNING
else
msg="OK"
status=$STATE_OK
fi
#Printing the results:
exit $status