Playing alarm soundsRequired version: 1.1.4
April 11. 2010
IntroductionJust as the Nagios GUI, Multisite can play alarm sounds when a host or service in a certain stated is being displayed. Multisite uses the same technique for playing sounds as Nagios: it outputs an HTML tag of type object: <object type="audio/x-wav" ... > While this method is not fully portable, it is working on current versions of Firefox and Internet Explorer and has the advantage that it doesn't need a Flash plugin and that it is able to play ordinary WAV files. Whether sounds are played or not is configurable on a per-view basis. You also need to configure which sounds are mapped to which types of events in multisite.mk in order to activate sound at all. Multisite ships a handful of sound files for demonstration purposes which may be sufficient in most cases. ConfigurationIn order to enable sounds, you first have to define which sounds are to be played under which condition. This is done by setting the variable sounds in multisite.mk to a list of pairs: /etc/check_mk/multisite.mk sounds = [ ( "down", "down.wav" ), # play down.wav if a host is down... ( "critical", "critical.wav" ), # else play critical.wav if a service is critical... ( "unknown", "unknown.wav" ), # if neither is the case, handle unknown services... ( "warning", "warning.wav" ), # ... and warnings ... ( None, "ok.wav" ) # no problem being displayed => play ok.wav ] The first part of each pair is an event type, the second one the name of a sound file. The following events are available:
Please note that only the first sound according to the order in the list will be played. That means for our example, that if one host is down and one service is unknown, then only the sound down.wav will be played. And if no host is down and all services are OK, then the sound ok.wav will be played. The sound files are expected in the subdirectory sounds of the htdocs directory. That's where the shipped demo sound files are present. The default URL for down.wav is the relative URL sounds/down.wav. You can change that URL by setting sound_url to another URL: multisite.mk sound_url = "/nagios/media/" Sounds and viewsSounds are only played in views where they are explicitely switched on (this is a check box in the view configuration). Please note, that sounds can only be played for events being displayed. That means - for example - that if you create a view of services and want "host down" events to trigger a sound output, the host states must displayed somewhere - either in a group header or in the normal data rows. |
| ||||||||||||||||||||||||||||||