I’m trying to set up two types of notifications, namely emails and sms messages using gnokii.
I want the emails to go 24x7, but the sms only to go out of work hours.
The problem is, no matter what I try nagios sends out sms messages 24x7.
I have tried commenting out the notification_period in the hosts.cfg and services.cfg file.
A subset of my config files is below (addresses and names changed). Can anyone see what I’ve missed?
hosts.cfg
‘host1’ host definition
define host{
use generic-host ; Name of host template to use
host_name host1
parents main_switch
alias host1 definition
address aaa.bbb.ccc.ddd
check_command check-host-alive
max_check_attempts 10
notification_interval 0
notification_period 24x7
notification_options d,u,r
}
services.cfg
define service{
use generic-service ; Name of service template to use
host_name host1
service_description PING
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
contact_groups server-admins
notification_interval 120
notification_period 24x7
notification_options c,r
check_command check_ping!250.0,33%!2000.0,80%
}
hostgroups.cfg
'server-admins group definition
define hostgroup{
hostgroup_name server-admins
alias Servers
members host1,host2
}
contactgroups.cfg
‘server-admins’ contact group definition
define contactgroup{
contactgroup_name server-admins
alias Server Administrators
members bob,bobbysms
}
contacts.cfg
‘bob’’ contact definition
define contact{
contact_name bob
alias bob
service_notification_period 24x7
host_notification_period 24x7
service_notification_options c,r
host_notification_options d,r
service_notification_commands notify-by-email
host_notification_commands host-notify-by-email
email [email protected]
}
‘bobbysms’ contact definition
define contact{
contact_name bobsms
alias bob
service_notification_period ournonworkhours
host_notification_period ournonworkhours
service_notification_options c,r
host_notification_options d,r
service_notification_commands notify-by-gnokii-queue
host_notification_commands host-notify-by-gnokii-queue
pager 123456789
}
timeperiods.cfg
‘24x7’ timeperiod definition
define timeperiod{
timeperiod_name 24x7
alias 24 Hours A Day, 7 Days A Week
sunday 00:00-24:00
monday 00:00-24:00
tuesday 00:00-24:00
wednesday 00:00-24:00
thursday 00:00-24:00
friday 00:00-24:00
saturday 00:00-24:00
}