Page 3 of 13
Re: contacts.cfg is not working properly
Posted: Tue Oct 06, 2015 2:03 pm
by sinkak
Code: Select all
define contactgroup {
contactgroup_name DevNull
alias DevNull
members wsawarn
}
define contactgroup {
contactgroup_name Dustin-admins
alias Dustin
members wsawarn
}
define contactgroup {
contactgroup_name SmsOnlyOnce
alias SmsOnlyOnce
members wsawarn
}
define contactgroup {
contactgroup_name admins
alias Nagios Administrators
members wsacritical,wsawarn
}
define contactgroup {
contactgroup_name sms-admins
alias SMS
members wsawarn
}
define contact {
contact_name wsacritical
alias WSACRITICAL
service_notification_period 24x7
host_notification_period 24x7
service_notification_options c
host_notification_options d
service_notification_commands notify-service-by-sms-only-once,notify-service-by-email
host_notification_commands notify-host-by-sms-only-once,notify-host-by-email
email [email protected]
minimum_importance 0
host_notifications_enabled 1
service_notifications_enabled 1
can_submit_commands 1
retain_status_information 1
retain_nonstatus_information 1
}
define contact {
contact_name wsawarn
alias WSAWarn
service_notification_period 24x7
host_notification_period 24x7
service_notification_options r,w,u
host_notification_options r,u
service_notification_commands notify-service-by-email
host_notification_commands notify-host-by-email
email [email protected]
minimum_importance 0
host_notifications_enabled 1
service_notifications_enabled 1
can_submit_commands 1
retain_status_information 1
retain_nonstatus_information 1
Re: contacts.cfg is not working properly
Posted: Tue Oct 06, 2015 3:21 pm
by hsmith
Can we take a look at your templates for generic-service,srv-pnp and any more upstream templates you may have?
Re: contacts.cfg is not working properly
Posted: Wed Oct 07, 2015 11:12 am
by sinkak
Code: Select all
define service{
name generic-service ; The 'name' of this service template
active_checks_enabled 1 ; Active service checks are enabled
passive_checks_enabled 1 ; Passive service checks are enabled/accepted
parallelize_check 1 ; Active service checks should be parallelized (disabling this can lead to major performance problems)
obsess_over_service 1 ; We should obsess over this service (if necessary)
check_freshness 0 ; Default is to NOT check service 'freshness'
notifications_enabled 1 ; Service notifications are enabled
event_handler_enabled 1 ; Service event handler is enabled
flap_detection_enabled 1 ; Flap detection is enabled
failure_prediction_enabled 1 ; Failure prediction is enabled
process_perf_data 1 ; Process performance data
retain_status_information 1 ; Retain status information across program restarts
retain_nonstatus_information 1 ; Retain non-status information across program restarts
notification_interval 0 ; Only send notifications on status change by default.
is_volatile 0
check_period 24x7
normal_check_interval 5
retry_check_interval 1
max_check_attempts 4
notification_period 24x7
notification_options w,u,c,r
contact_groups admins
register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL SERVICE, JUST A TEMPLATE!
}
Code: Select all
define service{
name srv-pnp
action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=$SERVICEDESC$' class='tips' rel='/pnp4nagios/index.php/popup?host=$HOSTNAME$&srv=$SERVIC
EDESC$
register 0
}
Code: Select all
define host{
name generic-host ; The name of this host template
notifications_enabled 1 ; Host notifications are enabled
event_handler_enabled 1 ; Host event handler is enabled
flap_detection_enabled 1 ; Flap detection is enabled
failure_prediction_enabled 1 ; Failure prediction is enabled
process_perf_data 1 ; Process performance data
retain_status_information 1 ; Retain status information across program restarts
retain_nonstatus_information 1 ; Retain non-status information across program restarts
check_command check-host-alive
max_check_attempts 10
notification_interval 0
notification_period 24x7
notification_options d,u,r
contact_groups admins,SmsOnlyOnce
register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE!
}
define host {
name host-pnp
action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=_HOST_' class='tips' rel='/pnp4nagios/index.php/popup?host=$HOSTNAME$&srv=_HOST_
register 0
}
Re: contacts.cfg is not working properly
Posted: Wed Oct 07, 2015 12:05 pm
by hsmith
Everything appears to be in order in your configuration files. Time to dive a little bit deeper. Can you su to the nagios user, and try to manually submit an email to the address in question?
For example:
Code: Select all
/usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: test\n\nService: test\nHost: test\nAddress: test\nState: test\n\nDate/Time: test\n\nAdditional Info:\n\test\n" | /bin/mail -s "** test Service Alert: test/test is test **" "[email protected]"
Re: contacts.cfg is not working properly
Posted: Wed Oct 07, 2015 1:21 pm
by sinkak
during initial setup
Code: Select all
sudo useradd nagios
sudo groupadd nagcmd
sudo usermod -a -G nagcmd nagios
i never gave password for nagios
now after
Code: Select all
ubuntu@nagios-2015:~$ su nagios
Password:
su: Authentication failure
Re: contacts.cfg is not working properly
Posted: Wed Oct 07, 2015 1:24 pm
by hsmith
Can you su to nagios using root?
Re: contacts.cfg is not working properly
Posted: Wed Oct 07, 2015 1:27 pm
by sinkak
ubuntu@nagios-2015:~$ sudo su nagios
ubuntu@nagios-2015:~$ whoami
ubuntu
ubuntu@nagios-2015:~$
Re: contacts.cfg is not working properly
Posted: Wed Oct 07, 2015 2:21 pm
by sinkak
I did this with out user nagios
Code: Select all
ubuntu@nagios-2015:/usr/local/nagios/etc$ /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: test\n\nService: test\nHost: test\nAddress: test\nState: test\n\nDate/Time: test\n\nAdditional Info:\n\test\n" | /usr/bin/mail -s "** test Service Alert: test/test is test **" "[email protected]"
ubuntu@nagios-2015:/usr/local/nagios/etc$
Code: Select all
ubuntu@nagios-2015:/usr/local/nagios/etc$ /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: test\n\nService: test\nHost: test\nAddress: test\nState: test\n\nDate/Time: test\n\nAdditional Info:\n\test\n" | /usr/bin/mail -s "** test Service Alert: test/test is test **" "[email protected]"
none of them worked.
Re: contacts.cfg is not working properly
Posted: Wed Oct 07, 2015 2:28 pm
by hsmith
Silly question, but are you checking your spam box? The method that mail uses to send emails is often marked as spam.
Re: contacts.cfg is not working properly
Posted: Wed Oct 07, 2015 2:33 pm
by sinkak
No nothing on spam either.