jueves, 1 de diciembre de 2011

“:::Implementing a Sound Notification for the Alarms on Nagios With Ubuntu 10.04Lts Server Edition:::”


In this how-to Nagios won’t repeat a sentence as the previously how-to, but using aplay it’ll play a sound file as a MP3. If in the previously how-to I did not explain how to install an audio system on Ubuntu 10.04Lts Server Edition the commands of using are
$: sudo apt-get install alsa alsa-base alsa-utils
after that we go to configure Nagios Core to use aplay as command-line audio file player for the ALSA sound card driver.
$: cd /usr/local/nagios/etc
$: sudo nano commands.cfg
adding the following lines
define command{
 command_name    play_siren
 command_line    /bin/bash /usr/local/nagios/etc/objects/play_siren.sh
 }
create a script to run the sound alarm
$: cd objects
$: sudo nano play_siren.sh
with those lines
#!/bin/bash
 /usr/bin/aplay -q /usr/share/nagios/etc/objects/alarm.wav
give to it the permissions and create a log
$: sudo chown nagios.nagios play_siren.sh
$: sudo chmod a+x play_siren.sh
modify the file contact.cfg to say to nagios of using the sound alarm
$: sudo nano templates.cfg:
modify the
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                     
        }


Probado en CentOS 5.6 y funciona.
Fuente: Ideasnet

No hay comentarios:

Publicar un comentario