how can play an alarm or bib with warning or critical

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
baber
Posts: 295
Joined: Wed Oct 21, 2015 4:39 am

Re: how can play an alarm or bib with warning or critical

Post by baber »

lmiltchev wrote:According to the Nagios Core documentation:
Audio files are assumed to be in the media/ subdirectory in your HTML directory (i.e. /usr/local/nagios/share/media).
You will need to place the audio files (hostu.wav, hostd.wav, critical.wav, warning.wav, and unknown.wav) in the "/usr/local/nagios/share/media" directory. Next, you will need to modify the cgi.cfg file by changing this:

Code: Select all

Formats:    host_unreachable_sound=<sound_file>
host_down_sound=<sound_file>
service_critical_sound=<sound_file>
service_warning_sound=<sound_file>
service_unknown_sound=<sound_file>
Examples:    host_unreachable_sound=hostu.wav
host_down_sound=hostd.wav
service_critical_sound=critical.wav
service_warning_sound=warning.wav
service_unknown_sound=unknown.wav
to this:

Code: Select all

host_unreachable_sound=hostu.wav
host_down_sound=hostd.wav
service_critical_sound=critical.wav
service_warning_sound=warning.wav
service_unknown_sound=unknown.wav
Restart nagios and apache. Let us know if you have any more questions.
thanks

now i have coy a wav file in this path

Code: Select all

/usr/local/nagios/share/media/warn.wav
and add these line at the end of cgi.cfg file and restart nagios service and httpd but now i have a critical alarm on my nagios but not play any alarm

why ?

Code: Select all

Formats:    host_unreachable_sound=<sound_file>
host_down_sound=<sound_file>
service_critical_sound=<sound_file>
service_warning_sound=<sound_file>
service_unknown_sound=<sound_file>
Examples:    host_unreachable_sound=hostu.wav
host_down_sound=hostd.wav
service_critical_sound=/usr/local/nagios/share/media/warn.wav
service_warning_sound=warning.wav
service_unknown_sound=unknown.wav

rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: how can play an alarm or bib with warning or critical

Post by rkennedy »

What is the output of ls -l /usr/local/nagios/share/media/?
Former Nagios Employee
baber
Posts: 295
Joined: Wed Oct 21, 2015 4:39 am

Re: how can play an alarm or bib with warning or critical

Post by baber »

rkennedy wrote:What is the output of ls -l /usr/local/nagios/share/media/?

Code: Select all

[root@nagios media]# ls -l /usr/local/nagios/share/media/
total 12
-rw-r--r--. 1 root root 9960 Aug  4 10:45 warn.wav
[root@nagios media]#

rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: how can play an alarm or bib with warning or critical

Post by rkennedy »

That should be fine, but what are the permissions on the folder above it? Does the nagios user have permission to open that folder?

Also -- just to clarify, are you looking for sounds to play on your computer OR off the server?
Former Nagios Employee
baber
Posts: 295
Joined: Wed Oct 21, 2015 4:39 am

Re: how can play an alarm or bib with warning or critical

Post by baber »

rkennedy wrote:That should be fine, but what are the permissions on the folder above it? Does the nagios user have permission to open that folder?

Also -- just to clarify, are you looking for sounds to play on your computer OR off the server?
this is my permission for that folder

Code: Select all


drwxrwxr-x. 2 nagios nagios 4096 Aug  4 11:28 media

what do you mean about (are you looking for sounds to play on your computer OR off the server)
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: how can play an alarm or bib with warning or critical

Post by rkennedy »

Got it, could you also post the output of this? "grep wav /usr/local/nagios/etc/cgi.cfg"
what do you mean about (are you looking for sounds to play on your computer OR off the server)
Are you looking to have YOUR computer play the sound, or have the server that is running Nagios play the sound?
Former Nagios Employee
baber
Posts: 295
Joined: Wed Oct 21, 2015 4:39 am

Re: how can play an alarm or bib with warning or critical

Post by baber »

rkennedy wrote:Got it, could you also post the output of this? "grep wav /usr/local/nagios/etc/cgi.cfg"
what do you mean about (are you looking for sounds to play on your computer OR off the server)
Are you looking to have YOUR computer play the sound, or have the server that is running Nagios play the sound?

Code: Select all

[root@nagios nagios]# grep wav /usr/local/nagios/etc/cgi.cfg
#host_unreachable_sound=hostdown.wav
#host_down_sound=hostdown.wav
#service_critical_sound=critical.wav
#service_warning_sound=warning.wav
#service_unknown_sound=warning.wav
#normal_sound=noproblem.wav
Examples:    host_unreachable_sound=hostu.wav
host_down_sound=hostd.wav
service_critical_sound=/usr/local/nagios/share/media/warn.wav
service_warning_sound=warning.wav
service_unknown_sound=unknown.wav
[root@nagios nagios]#

this is not important for me play music from nagios or pc which of them is better and easier ?

my nagios server is on a virtual machine
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: how can play an alarm or bib with warning or critical

Post by rkennedy »

Change this -

Code: Select all

service_warning_sound=warning.wav
to (since you're file is called warn.wav) -

Code: Select all

service_warning_sound=warn.wav
Then restart nagios, and it should play a sound if you load the services page and see a status that is in a warning state, it will play a sound. I just tested on my end and it works as expected.
Former Nagios Employee
baber
Posts: 295
Joined: Wed Oct 21, 2015 4:39 am

Re: how can play an alarm or bib with warning or critical

Post by baber »

rkennedy wrote:Change this -

Code: Select all

service_warning_sound=warning.wav
to (since you're file is called warn.wav) -

Code: Select all

service_warning_sound=warn.wav
Then restart nagios, and it should play a sound if you load the services page and see a status that is in a warning state, it will play a sound. I just tested on my end and it works as expected.

Since that i don' t have warning alarm and have warning add this line

Service_critical_sound=warn.wav
And then restart nagios service and httpd but not work i previously said my nagios server is on virtual machine and i don't have sound card on my server or vm is that important ?

Can say play music from pc ??
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: how can play an alarm or bib with warning or critical

Post by tgriep »

The sound will play on your PC and not the server. As long as you have a web browser open to the Nagios system and a status changes, it will play the sound file on that PC.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked