Our new dashboard
The old dashboard we used earlier had a couple of issues. It showed all SOFT nagios states and it also listed every service pr host that was down. Since it’s pretty obvious that a service is down on a host that is down, we wanted to change that. Instead of continuing the rather hard work of changing the dirty status.dat parsing, we just dropped that project and checked out Merlin. Once installed and configured correctly, merlin will enable an eventbrokermodule in the nagiosconfig and update merlins mysql database via the eventbroker. The database contains all hosts and statuses state changes and so on, so this is what we ended up with : (Pic of our current dashboard in our office)
This dashboard lists only hosts that are down and not acknowledged in nagios in its upper left corner. Then there’s a little tactical overview in the upper right corner (this will have more info shortly) and finally all unhandled serviceproblem listed below. Exactly what we want.
The bottom “toolbar” is transparent and has a countdown timer for page refresh and shows the current time.
Thanks again to Jonas, for the design!
You can download the 2 php files here : dashv2
Just change the login info in merlin.php to match your merlin database and it should run smoothly.
Note: The dashboard needs firefox 3.6.
Enjoy.
EDIT: Now available on github for those interested in contributing: http://github.com/mortis1337/nagios-dashboard
Tags: dashboard, merlin, nagios

May 3rd, 2010 at 13:45
If you dont want to show services that are scheduled for downtime on this dashboard, just change the sql on line 125ish to to the following
select service.host_name,service.service_description,service.last_hard_state,service.last_hard_state_change,service.last_check from service,host,scheduled_downtime where host.host_name = service.host_name and service.last_hard_state in (1,2) and service.problem_has_been_acknowledged = 0 and host.problem_has_been_acknowledged = 0 and host.last_hard_state not like 1 and host.host_name not in (select distinct host_name from scheduled_downtime where start_time unix_timestamp()) group by service.service_description order by service.last_hard_state desc
May 6th, 2010 at 09:43
I made an error in the group by clause, it should be : select service.host_name,service.service_description,service.last_hard_state,service.output, service.last_hard_state_change,service.last_check from service,host,scheduled_downtime where host.host_name = service.host_name and service.last_hard_state in (1,2,3) and service.problem_has_been_acknowledged = 0 and host.problem_has_been_acknowledged = 0 and host.last_hard_state not like 1 and host.host_name not in (select distinct host_name from scheduled_downtime where start_time unix_timestamp()) group by service.host_name, service.service_description order by service.last_hard_state desc;
update it or you might be missing a few hosts
May 27th, 2010 at 08:52
A guy changed the query to only show info from a certain contactgroup.
Here’s what he says (Thanks, Per!):
I got it to work, but I had to add an index to the host_contactgroup table.
W/O the index my query took 1,5 minutes adn we have some 800 hosts.
Our query looks like this
$query = “select service.host_name, service.service_description,”;
$query = $query.” service.last_hard_state, service.output, service.last_hard_state_change,”;
$query = $query.” service.last_check”;
$query = $query.” from service, host, scheduled_downtime”;
$query = $query.” where service.host_name in”;
$query = $query.” (select host.host_name from host”;
$query = $query.” join host_contactgroup on host.id = host_contactgroup.host”;
$query = $query.” join contactgroup on host_contactgroup.contactgroup = contactgroup.id”;
$query = $query.” where contactgroup.contactgroup_name = ‘CONTACTGROUP’)”;
$query = $query.” and host.host_name = service.host_name”;
$query = $query.” and service.last_hard_state in (1, 2)”;
$query = $query.” and service.problem_has_been_acknowledged = 0″;
$query = $query.” and host.problem_has_been_acknowledged = 0″;
$query = $query.” and host.last_hard_state not like 1″;
$query = $query.” and host.host_name not in”;
$query = $query.” (select distinct host_name from scheduled_downtime”;
$query = $query.” where start_time unix_timestamp())”;
$query = $query.” group by service.host_name, service.service_description”;
$query = $query.” order by service.last_hard_state desc”;
The new index where created like this
create index ix_contactgroup_host USING BTREE ON host_contactgroup (contactgroup,host);
/Per
July 6th, 2010 at 20:22
Thanks so much for this really awesome dashboard monitor! It’s just what we needed.
I have one question though…
Why on line 13 of merlin.php do you query to see if last_hard_state?
last_hard_state doesn’t get set until a HARD state is triggered PLUS the time of the retry_interval! :-s
If the retry interval is configured as 1 minute then the dashboard will only display the host down an extra 1 minute after you can see it down in the Nagios web interface.
July 15th, 2010 at 16:36
Would it be possible to integrate an alert sound to the dashboard? So when an issue comes up it plays a alert sound.
thks a lot
July 16th, 2010 at 09:45
This looks great, but it’s not working for me.
I’ve installed Merlin, edited merlin.php, however, nagios.php does not display any data.
All that’s displayed is the countdown timer.
Any ideas? Using nagios 3.2.1
I can confirm that data is being written to the merlin database.
July 19th, 2010 at 17:27
I’m trying to paste some code to let you have sounds with your alerts, but this comments thing won’t let me and just presents me with a blank screen :-/
July 19th, 2010 at 18:29
hmmm justin, maybe its too many chars for the comment or something. Try using pastebin.org or something (and select “retained forever”)
July 20th, 2010 at 06:35
Any ideas why my dashboard is not displaying any alerts?
July 20th, 2010 at 07:45
carlo, did you get your databaselogin info in merlin.php correct?
Are you sure merlin is working? Try go into mysql and see whats in the database. Are the tables empty? Did you run the import script in merlin? Also, nagios.php uses some fancy css stuff that might not work / will look bad ..in older browsers.
July 20th, 2010 at 09:33
mortis, merlin.php database information is correct. merlind is running.
You are correct – it seems there is no data within the merlin database.
Which import script are you referring to?
I followed the merlin quickstart guide below:
https://wiki.op5.org/merlin:docs:quickstart-debian5
Thanks in advance,
Carlo
July 20th, 2010 at 09:37
in our setup its in /usr/local/nagios/addons/merlin/import.php
(you prolly gotta edit it and change user/password)
but be sure that you still get host/service events updated in merlin after you run this initially.
July 20th, 2010 at 10:06
Ok, I’ve put this on github now, if someone wants to make changes to it, or contribute with some new stuff.
http://github.com/mortis1337/nagios-dashboard
July 20th, 2010 at 11:26
morten, I have run import.php and can confirm that the database has been populated with data.
I have already changed merlin.php to reflect the correct database credentials.
Still no luck? Any ideas?
July 20th, 2010 at 11:41
Scratch that, restarted after running import.php and everything is working.
Fantastic dashboard!
July 20th, 2010 at 11:45
Last question – how do I ensure hosts/service updates are reflected in merlin?
July 20th, 2010 at 12:12
Carlo, I suggest you send an email to the merlin mailinglist as I’m not that familiar with merlin
August 16th, 2010 at 15:22
does a database populated by ndoutils theoretically store similar information? would be great to use that as an alternative backend for this nice dashboard. maybe I will have a look into it. thanks for your work!
August 19th, 2010 at 11:39
http://github.com/foobar0815/nagios-dashboard
August 22nd, 2010 at 12:49
sweet, nice work