Not getting SMS notification for services
Posted: Thu Mar 19, 2015 11:16 am
I have a temperature sensor which I can monitor with Nagios & I am trying to setup Email and SMS notification for this sensor. The Email and SMS works for the host (the sensor device itself) but I only get an email when it comes to the service checks e.g. reading the temperature. So just to clarify if the sensor looses power I get an Email and an SMS telling me the host is down, if the temperature goes above the normal range only an email is fired off. Do services only notify via email? Any help debugging would be great!
Code: Select all
define host {
host_name 172.16.64.88-LS-temphumid
alias Server - Temperature/Light/Humidity sensor
address 172.16.64.88
check_command check-host-alive
use Host_24x7_Monitoring_5min_check_120min_retry,pnp-hostgraph-popup
notification_options d,u,r,f,s
register 1
}Code: Select all
define host {
name Host_24x7_Monitoring_5min_check_120min_retry
check_command check-host-alive
max_check_attempts 1
check_interval 1
retry_interval 1
active_checks_enabled 1
check_period 24x7
event_handler_enabled 1
flap_detection_enabled 0
flap_detection_options o,d,u
process_perf_data 1
retain_status_information 1
retain_nonstatus_information 1
contacts DaveB-SMS,DaveB-Email
notification_interval 1
notification_period 24x7
first_notification_delay 0
notification_options d,u,r,f,s
notifications_enabled 1
register 0
}Code: Select all
define service {
#NAGIOSQL_CONFIG_NAME CHECK_ROOM_TEMP
host_name 172.16.64.88-LS-temphumid
service_description Check Room Temp
check_command check_roomtemp!18 23 15 26
is_volatile 1
max_check_attempts 1
check_interval 1
retry_interval 1
active_checks_enabled 1
passive_checks_enabled 1
check_period 24x7
obsess_over_service 1
check_freshness 1
event_handler_enabled 1
flap_detection_enabled 0
process_perf_data 1
retain_status_information 1
retain_nonstatus_information 1
notification_interval 1
first_notification_delay 1
notification_period 24x7
notification_options w,u,c,r,f,s
notifications_enabled 1
contacts DaveB-SMS,DaveB-Email
register 1
}Code: Select all
define service {
name Service_24x7_Monitoring_10min_check_120min_retry
is_volatile 0
max_check_attempts 1
check_interval 1
retry_interval 1
active_checks_enabled 1
passive_checks_enabled 1
check_period 24x7
parallelize_check 1
obsess_over_service 1
check_freshness 1
event_handler_enabled 1
process_perf_data 1
retain_status_information 1
retain_nonstatus_information 1
notification_interval 1
first_notification_delay 0
notification_period 24x7
notification_options w,u,c,r
notifications_enabled 1
contacts DaveB-SMS,DaveB-Email
register 0
}Code: Select all
define contact {
contact_name DaveB-SMS
alias DaveB Phone
host_notifications_enabled 1
service_notifications_enabled 1
host_notification_period 24x7
service_notification_period 24x7
host_notification_options d,u,r,f,s
service_notification_options w,u,c,r,f,s,n
host_notification_commands notify-host-by-sms-AGAIN
service_notification_commands notify-service-by-sms
can_submit_commands 1
retain_status_information 1
retain_nonstatus_information 1
pager 0XXXXXXXXXX <--- Removed etc.
register 1
}Code: Select all
define contact {
contact_name DaveB-Email
alias DaveB Email
contactgroups admins
host_notifications_enabled 1
service_notifications_enabled 1
host_notification_period 24x7
service_notification_period 24x7
host_notification_options d,u,r,f,s
service_notification_options w,u,c,r,f,s
host_notification_commands notify-host-by-email
service_notification_commands notify-service-by-email
email [email protected] <---- Removed etc.
register 1
}Code: Select all
define command {
command_name notify-host-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
register 1
}
define command {
command_name notify-host-by-sms-AGAIN
command_line /usr/bin/printf "%b" "Notification Type: $NOTIFICATIONTYPE$ Host: $HOSTNAME$ State: $HOSTSTATE$ Address: $HOSTADDRESS$ Info: $HOSTOUTPUT$ Date/Time: $LONGDATETIME$" | smssend $CONTACTPAGER$
register 1
}
define command {
command_name notify-service-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
register 1
}
define command {
command_name notify-service-by-sms
command_line smssend $CONTACTPAGER$ "Service Issue"
register 1
}