Page 1 of 1

nagios audible alert

Posted: Tue Feb 26, 2013 1:36 pm
by benhank
i want to configure xi 2012 1.6 to not only pop up an alert on the ops screen but to make some sort of sound too.

This will allow an operator to hear the alert even if their attention is somewhere else (coughzzzzzcough) . I got the idea from watching the mntos video.

Re: nagios audible alert

Posted: Tue Feb 26, 2013 1:46 pm
by slansing
This has been integrated with Nagios Core but not XI. You may be able to out of the box, or with a little bit of modification, this is the one that I had set up a few months ago:

http://code.google.com/p/nagioschecker/

Re: nagios audible alert

Posted: Tue Feb 26, 2013 2:05 pm
by benhank
thanks man! i will let you know how it went. how does core do it?

Re: nagios audible alert

Posted: Tue Feb 26, 2013 2:16 pm
by slansing
It reads the status.cgi as linked through your Nagios system's web address and alerts you based on changes within the cgi, I am going to try to configure it today as well.

Re: nagios audible alert

Posted: Tue Feb 26, 2013 2:40 pm
by benhank
I have no clue how to make this happen bro, you can close the thread unless you want me to test what you come up with .

Re: nagios audible alert

Posted: Tue Feb 26, 2013 2:59 pm
by slansing
I was able to configure it by following along in it's GUI.

Click Add new.. then create a name for the server, Click on Nagios Web Interface tab, add the address as they have an example of below, enter username and password to the XI server "I used the nagiosadmin account."

Click the status script URL and point to the status.cgi page as is shown as an example on the page. Then save that and set up filtering, display, behavior, sounds, and advanced settings tabs. Once complete enable the saved server from the Nagios Checker main page list.

Re: nagios audible alert

Posted: Sun Mar 03, 2013 7:26 am
by cellact
I achieved this with XI by editing the merlin.php file that is used by opscreen.php (/usr/local/nagiosxi/html/includes/components/opscreen)
I added a new query to count services in warning/critical state, then set a cookie with that count and check it against the last ran query count.
The page auto refreshes every 10 seconds so that's when you'll get an alert.
I only managed to get it work with Firefox (and iceweasel on a RaspberryPi) and with ogg audio files.

Code: Select all

			$query="SELECT count(*) as total from nagios_servicestatus WHERE current_state!=0 and current_state!=3 and last_hard_state!=0";
            $result = mysql_query($query);
            $row = mysql_fetch_array($result);
            $services_down_notify = $row[0];
			
			$nowServicesDown = $services_down_notify;
			if (isset($_COOKIE['rowsservices'])) {
				$prevServicesDown = $_COOKIE['rowsservices'];
				if ($prevServicesDown < $nowServicesDown) {
					echo '<object data="notification.ogg" autostart="true" hidden="true" loop="false">';
				}
				else {echo '';}
			}
			setcookie('rowsservices', $nowServicesDown, time()+1800);

Re: nagios audible alert

Posted: Sun Mar 03, 2013 3:18 pm
by benhank
stupid explorer... this would be an awesome feature for a future release. stupid explorer...