Extend Icinga Dashing for your own needs

Hi,

since I get asked quite often, here’s some hints.

First off:

Read the development docs.

Modifications?

The dashing-icinga2 project is a demo playground I’ve been hacking for my Icinga Camp talks. I consider it feature complete.

If you think different, feel free to fork the GitHub project and modify it for your own needs. If you’re using the Git master, best is create a separate branch with your modifications.

git checkout -b feature/my-modifications

In case of changes upstream, follow the fork/update mechanism from GIthub.

git remote add upstream https://github.com/dnsmichi/dashing-icinga2.git
git fetch upstream

git checkout feature/my-modifications

git rebase upstream/master

<heal and fix, if there are conflicts>

git add <fixed files>
git rebase --continue

You can learn more about these Git strategies in my training sessions.

Development Ideas

The whole project has a development documentation, starting from the dashboards to widgets to jobs and the custom library which provides the native interface to the Icinga 2 REST API and collecting data.

Filter by Hostgroup

Look into lib/icinga2.rb and especially the getHostObjects() and getServiceObjects() functions. They are prepared for fetching all data, and return a hash set of all objects. These are used in other functions like the severity sorted list, or problem counts.

https://github.com/dnsmichi/dashing-icinga2/blob/master/lib/icinga2.rb#L699

These functions are prepared for taking a filter as additional parameter (right now it is just nil).

Your task is to

  • add a filter and test it
  • if you encounter problems with the metrics fetched from /v1/status, use the object counts everywhere
  • make this a configuration option being read further up, similar to how you configure the icingaweb2 URL.

Playing sounds

Look into the existing widget code and understand how they work (follow the development docs). Once you’ve figured out how Coffeescript fires the event handlers when data is received from the job send_event methods, play around with it.

Playing sounds for instance isn’t really possible since Chrome and others browsers are blocking the auto-play of tabs. Still, let yourself inspire you … https://gist.github.com/windowfinn/9ec0f617989f6a721d20

More?

Go on and try it. As said before, the interfaces, libraries and widgets are prepared for more modifications.

Cheers,
Michael