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 files from git : https://github.com/mortis1337/nagios-dashboard
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.

http://dingleberry.me/2010/04/our-new-dashboard/

Be Sociable, Share!

Tags: , ,

59 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 :)

  21. tenpin Says:

    I am getting no output on nagios.php besides countdown timer and time.

    Database has data, I ran select statements from merlin.php by hand and get results, but if I run merlin.php from the command line I get an error:

    php -l ./merlin.php
    PHP Parse error: syntax error, unexpected T_ELSE in ./merlin.php on line 28
    Errors parsing ./merlin.php

    I don’t have any unhandled host errors so it should print “All problem hosts has been acknowledged.” any suggestions?

  22. morten Says:

    tenpin what version of php are you running?

  23. tenpin Says:

    php -version
    PHP 5.3.3 (cli) (built: Jul 22 2010 17:12:45)
    Copyright (c) 1997-2010 The PHP Group
    Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

  24. morten Says:

    oki, thats odd. Are you using the code from git? http://github.com/mortis1337/nagios-dashboard

    ran the php syntax check here and get no errors.

  25. tenpin Says:

    Ok, got it figured out. Was running php53 on RHEL from the remi repository, removed remi repo, installed IUS repo, downgraded php53 to php52 and now it works.

  26. Neil Says:

    This is a great update to the original version. The only change I’ve made internally is changing the SQL query for Unhandled service problems to sort DESC so that critical problems show up first :-)

  27. qk4l Says:

    Thank you for greate Dash!

  28. mferpan Says:

    And if i am not using merling (not using any database), how could we integrate that frontend ?

  29. morten Says:

    The dashboard in this article does not support reading .dat files. However …theres a similar (older) dashboard here http://dingleberry.me/2009/11/nagios-operations-dashboard/
    and also if you are considering using ndoutils and not merlin ..you can check the fork of this dashboard here : http://github.com/foobar0815/nagios-dashboard/

  30. John R Says:

    Help please… the unhandled services section on the dash is not populating and I am getting the folowing error in the deamon log:-

    Failed to connect to ‘merlin’ at ‘localhost’:’0′ as root:(null): 1045: Access denied for user ‘root’@'localhost’ (using password: YES)

    Any advice would be appreciated

  31. mortis Says:

    John R : that is your mysql permissions.

    log in to mysql and do something like : grant all privileges on *.* to ‘root’@'localhost’ identified by ‘yourpasswordhere’;

    and change the php file to have the same user/pass

  32. mortis Says:

    yeah, and i wouldnt advise you to use ‘root’ tho, as you could rather make a merlin user

  33. John R Says:

    Thanks for the info Mortis, got a question though. The php file is it the import.php?

  34. Greg F Says:

    Great dashboard. I’ve written a mklivestatus backend for it but can’t seem to figure out how to upload files to the github. Do I first create a fork of the nagios-dashboard project and upload to that? My files are ready to upload as soon as I can figure out how to do it.

    -greg

  35. Greg F Says:

    I’m having trouble with the dashboard displaying colors or text in IE 7 and 8. The headings and table structure is visible but all the table fields display white. Any ideas or suggestions as to cause?

    Thanks,

    -greg

  36. mortis Says:

    hey Greg, yep, suggestion as to cause is : IE is not meant to be used for internet. Download firefox and live happily ever after :)

  37. Greg F Says:

    Okay, I reread the blog and see where it says it requires FF 3.6, I take that to mean that IE does not work.

  38. Greg F Says:

    Mortis,

    Is there a way to upload a livestatus.php file to allow your dashboard to work with mklivestatus without using a git client. I’m not familiar with git at all and am hoping to avoid traveling down that road. But I’d like to contribute this code to your project. Please advise.

    Thanks,

    Greg F

  39. mortis Says:

    A guy wrote support for ndoutils for this dashboard. He forked the dashboard on git and added his stuff. That is the adviced way to do it. If you dont feel like doing that, you could upload the file somewhere and give me the link, and i could upload it to git and give you credits for your work :)

  40. Matt P Says:

    Hi,
    This is a great dashboard and does exactly what we need however could anyone shed some light on the reason why it is only supported on Firefox as I am interested in seeing if we can get it operational on IE/Opera/Safari.

  41. Joseph L Says:

    Greg and Mortis,

    I would like to try the livestatus.php based on the mklivestatus method. Is there any new info about the livestatus.php? If there is a place to download the php it would be great.

    Thanks.

  42. MrMe Says:

    The dashboard featured on OP5 website, with added features by Ipnett AS:
    http://www.op5.org/community/plugin-inventory/dasboards/dashboard

    cool :)

  43. Efrain Ireland Says:

    Typically I do not submit on posts, but I may enjoy to say that this site seriously pressured me to get it done! Thanks, really great submit.

  44. Dapper89 Says:

    Hey guys

    I am very very interested in the livestatus setup. Is there any way i can get hold of the livestatus.php file?

  45. Nagios Operations Dashboard | Osties.com! Says:

    [...] herramienta, pero esta nueva versión es para Nagios con Mysql, ya que la ultima usa el status.dat. Nueva Versión Linux, Nagios, OtrosSysadmin! ← Nagios 3.2.3 + Nagios Theme + Cacti en Debian 6 Squeeze [...]

  46. BOK Says:

    FYI – I created a “fork” for Icinga on Github
    https://github.com/hbokh/icinga-dashboard
    based on foobar’s ndoutils-code. This one uses ido2db instead.

  47. morten Says:

    nice BOK :)

  48. Erik Says:

    Would be nice if it would talk with mklivestatus, as I’m using that now.

    Any ideas about that?

  49. morten Says:

    Erik, it currently asks a merlin-populated mysql-database, but if you use mklivestatus to populate mysql in the same way, that would work. If you wanna use mklivestatus directly, you’ll need to do a lot of coding i think :)

  50. M N Says:

    is this in active development? and can you provide some documentation for customising this.

  51. morten Says:

    M N: check http://www.op5.org/community/plugin-inventory/dashboards/dashboard

  52. op5 Monitor or Nagios dashboard using Merlin backend | An It-Slave in the digital saltmine Says:

    [...] The original project place is http://dingleberry.me/2010/04/our-new-dashboard/ [...]

  53. Mark Whaite Says:

    @tenpin I was having the same problem on Cent OS 6.3 using PHP 5.3. If you change the php.ini file and turn on short tags then the script works fine.

  54. Fabrizio Says:

    Great!!!
    Thank fro sharing this with the Nagios community!!

    Any idea to add sound on new event?

  55. SBo Says:

    Great!! works fine, any idea about playing sounds when warning/critical ?

  56. fnord Says:

    I’ve done some coding on this and collected a few patches from other people, so the dashboard now, among other things, works in most browsers and handles acknowledgement and downtime; my fork is at https://github.com/fnordpojk/merlin-dashboard if you want to have a look. :)

  57. gaudijon Says:

    Hi,

    This great dashboard !!! :)
    I would like to have this one hostgroup and not all hosts on the dashboard?
    is it possible?
    What should I change?

    Thanks
    gaudijon

  58. morten Says:

    gaudijon, i guess you could modify the sql-sentances?

  59. onetwofree Says:

    I didn’t understand how it might be working
    Do i need a mysql-server with nagios connected to it ? Or mysql need only for the dash ?

Leave a Reply