Playing .wav audio-files


Anybody knows if it is possible to play the .wav audio-files in case of service- or host criticals? When activated from the cgi.cfg, I have troubles with the mimetype: application/wav. No matter what browser I use, Safari, Firefox or Internet Explorer, there are problems with this mimetype. Anybody who knows of a workaround?


huh? the event is handled by nagios, not the webpage. the webpage is just reading from status.dat or a database if you’ve got nagios 3. the nagios webpage is a front end that displays existing information.

You’re going to have to find a way to play a wav file from command-line. I don’t know your linux distribution, and i can’t say i’ve ever tried to play a sound from a bash prompt, but mplayer will totally do it up. make a script that starts up mplayer /home/me/alertsound.wav then closes mplayer.

Once you get that script worked out, add it to your host-notify-by-email and notify-by-email commands in misccommands.cfg (the important bit is bolded. remember your semicolon) :

define command{
command_name notify-by-email
command_line ; /usr/bin/printf “%b” “***** Nagios Alert ***\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" | /bin/mail -s " $NOTIFICATIONTYPE$ alert - $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **” $CONTACTEMAIL$

Then when nagios processes a critical alert, it will play a sound and email you!