Page 1 of 1

Nagios core 3.4.1 - Audio alerts command fails

Posted: Wed Nov 28, 2012 5:22 am
by techwin
I've configured nagios core 3.4.1 on centos 5.1 server and everything works fine including alert emails. Now, I am trying to configure the audio alerts with the given below configuration.

define command{
command_name play_siren
command_line /bin/bash /usr/local/nagios/etc/objects/play_siren.sh
}
-----------------------------------------------------------

#vi play_siren.sh

#!/bin/bash
/usr/bin/aplay -q /usr/share/nagios/etc/objects/alarm.wav
---------------------------------------------------

define contact{
name generic-contact
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r,f,s
host_notification_options d,u,r,f,s
service_notification_commands notify-service-by-email,play_siren
host_notification_commands notify-host-by-email,play_siren
register 0
}
-----------------------------------------------------
Whenever the alert triggers the email is sent but no audio is played.
when I run the file from shell ,ie. #/usr/local/nagios/etc/objects/play_siren.sh , it plays well.

In message log I get the logs like:

Nov 28 15:19:35 monitor nagios: HOST NOTIFICATION: nagiosadmin;inet-corp;DOWN;notify-host-by-email;CRITICAL - Packet Filtered (8.8.8.8)
Nov 28 15:50:35 monitor nagios: HOST NOTIFICATION: nagiosadmin;inet-corp;DOWN;play_siren;CRITICAL - Packet Filtered (8.8.8.8)
But no sound!
Please help.

Re: Nagios core 3.4.1 - Audio alerts command fails

Posted: Wed Nov 28, 2012 5:07 pm
by jsmurphy
If you su to the Nagios user and try to run the play_siren.sh does it work? My thinking currently is that it possibly doesn't have permissions to execute either the script itself or /usr/bin/aplay

Re: Nagios core 3.4.1 - Audio alerts command fails

Posted: Thu Nov 29, 2012 4:40 am
by techwin
Thank you!

It was permission problem.

#chmod 777 -R /dev/snd

It solved the problem!