Page 1 of 1

obsess_over_services parametr

Posted: Thu Nov 07, 2013 1:11 pm
by vvz
Hello !
I have local machine with Nagios installed.
I have HP proliant server on the other machine with nrpe and plugins installed on the same lan network.
Everything is installed and looks good including web-interface.
But I don't receive email notifications.

My questions is - shall I put obsess_over_services=1 in my nagios.conf to get notifications? now it is 0



Here my configs , I'm using mutt for testing purpose

commands.cfg
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" | /usr/bin/mutt -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
}

# 'notify-service-by-email' command definition
define command{
command_name notify-service-by-email
command_line echo " TEST" | /usr/bin/mutt -s "TEST" [email protected]
}



my host and services conf.

define host {
use generic-host
name linux-box
notifications_enabled 1
event_handler_enabled 1
failure_prediction_enabled 1
process_perf_data 1
notification_options d,u,r,s
check_period 24x7
check_interval 2
retry_interval 1
max_check_attempts 5
notification_interval 1
notification_period 24x7
contacts nagiosadmin
contact_groups admins
register 0
}



define host {
use linux-box
host_name hp
alias hp proliant
address 192.168.1.70
}


define service{
use generic-service
host_name hp
service_description Current users logged in
check_command check_nrpe_users
check_interval 1
check_period 24x7
retry_interval 2
max_check_attempts 3
notification_interval 4
notification_period 24x7
notification_options c,w,u,r
contacts nagiosadmin
contact_groups admins
notifications_enabled 1
}
my contact.conf
define contactgroup{
contactgroup_name admins
alias Nagios Administrators
members root, nagiosadmin
}


############### I added this contact##############################################################

define contact{
contact_name nagiosadmin
alias Admin
host_notifications_enabled 1
host_notification_period 24x7
service_notification_options w,u,c,r
host_notification_options d,u,r
host_notification_commands notify-host-by-email
service_notifications_enabled 1
service_notification_period 24x7
service_notification_commands notify-service-by-email
service_notification_options w,u,c,r
email [email protected]
}

Re: obsess_over_services parametr

Posted: Thu Nov 07, 2013 3:53 pm
by jsmurphy
You definitely don't want to use obsess over service in this instance. Obsess over service is primarily for distributed/clustered Nagios setups, it allows you to execute a command whenever a service check receives an update.

Your problem in this case is most likely to do with Nagios being unable to execute mutt.

If you haven't already, su to the nagios user and then run your command from the linux command prompt: echo " TEST" | /usr/bin/mutt -s "TEST" [email protected]

This should hopefully tell you why it's not working, assuming that it works from the command line of your own user.

Re: obsess_over_services parametr

Posted: Thu Nov 07, 2013 4:50 pm
by vvz
I've changed shell for nagios user for bash

then I su nagios and
from command line -> echo "TEST" | /usr/bin/mutt -s "HELLO" my@gmail
and I received test email from command line


but still no emails coming from nagios :(

Re: obsess_over_services parametr

Posted: Fri Nov 08, 2013 11:03 am
by lmiltchev
Do you see any clues in the mail log?

Code: Select all

tail -50 /var/log/maillog