Hi.
I needed to monitor a temperature monitor on my network. I wrote my own shell script and put it in the check commands folder as normal.
#!/bin/sh
origtemp=$(/sbin/gettemp)
temp=$(/sbin/gettemp | sed 's/\..*//')
if $temp -gt "100" ]; then
echo "Critcal Temperature: $origtemp"
exit 2
else
echo "Temperature OK: $origtemp"
exit 0
fi
However while monitoring the script in nagios I never get notifications. However I have it setup just like every other single service that we monitor. From what I know about writing scripts it should get all its info from exit codes. Which is what I used in my script.
I also noticed that current attempt never changes from 1/2 and is always in HARD state.
Current Attempt: 1/2 (HARD state)
Here is my config:
define service{
use service
hostgroup_name server_room_monitor
service_description ENVIROMUX-TEMP
check_command check_enviromux_temp
notifications_enabled 1
max_check_attempts 2
is_volatile 1
notification_interval 5
}
define serviceescalation{
host_name server-room-monitor
hostgroup_name server_room_monitor
service_description ENVIROMUX-TEMP
contacts nagiosadmin
contact_groups admin
first_notification 2
last_notification 0
notification_interval 5
escalation_period 24x7
escalation_options w,u,c,r
}
What is wrong why will it not give me any emails when in critical state?
Please help.