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)

dashern

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

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Reddit
  • Twitter
  • Slashdot
  • StumbleUpon

Tags: , ,

20 Responses to “Our new dashboard”

  1. morten Says:

    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

  2. morten Says:

    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

  3. morten Says:

    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

  4. Justin Trouble Says:

    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.

  5. GQS Says:

    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

  6. Carlo Says:

    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.

  7. Justin Trouble Says:

    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 :-/

  8. mortis Says:

    hmmm justin, maybe its too many chars for the comment or something. Try using pastebin.org or something (and select “retained forever”)

  9. Carlo Says:

    Any ideas why my dashboard is not displaying any alerts?

  10. mortis Says:

    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.

  11. Carlo Says:

    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

  12. morten Says:

    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.

  13. morten Says:

    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

  14. Carlo Says:

    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?

  15. Carlo Says:

    Scratch that, restarted after running import.php and everything is working.

    Fantastic dashboard!

  16. Carlo Says:

    Last question – how do I ensure hosts/service updates are reflected in merlin?

  17. morten Says:

    Carlo, I suggest you send an email to the merlin mailinglist as I’m not that familiar with merlin :)

  18. foobar Says:

    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!

  19. foobar Says:

    http://github.com/foobar0815/nagios-dashboard

  20. morten Says:

    sweet, nice work :)

Leave a Reply