Dashing dashboard for Icinga 2 using the REST API
Dashing dashboard for Icinga 2 using the REST API
** As of v3.3 dashing-icinga2 will actually use** smashing and not dashing anymore.
Smashing is a Sinatra based framework that lets you build beautiful dashboards.
You can put your important infrastructure stats and metrics on your office dashboard. Data can be pulled with custom jobs or pushed via REST API. You can re-arrange widgets via drag&drop. Possible integrations include Icinga, Grafana, ticket systems such as RT or OTRS, sensors, weather, schedules, etc. -- literally anything which can be presented as counter or list.
The Icinga 2 dashboard is built on top of Smashing and uses the Icinga 2 API to visualize what's going on with your monitoring. It combines several popular widgets and provides development instructions for your own implementation. The dashboard also allows to embed the Icinga Web 2 host and service problem lists as Iframe.
This is a demo playground with jobs, widgets and dashboards. You can use and modify them for your own needs. You can also send PRs with custom widgets and propose their use in the dashboard.
In terms of implementation specific questions, please read the development docs first.
Supported browsers and clients:
Windows with IE and old Edge (without Chromium) is not supported since SSE (Server Sent Events) are not implemented.
The Docker image is located at dbodky/dashing-icinga2. You can also build your own Docker image from the provided Dockerfile. Modify it when needed. When pulling the image from DockerHub, the correct image architecture should get pulled automatically.
The environment variables from this project can be used to configure the container.
Example on macOS with Docker for Mac:
docker run -it -p 5666:5665 -p 8005:8005 -e ICINGA2_API_HOST='docker.for.mac.localhost' -e ICINGA2_API_PORT=5665 -e ICINGA2_API_USERNAME='root' -e ICINGA2_API_PASSWORD='icinga' dbodky/dashing-icinga2Note that the Docker container exposes port 8005 by default. Modifying this requires you to build your own image.
Either clone this repository from GitHub or download the tarball.
Git clone:
cd /usr/share
git clone https://github.com/mocdaniel/dashing-icinga2.git
cd dashing-icinga2Tarball download:
cd /usr/share
wget https://github.com/mocdaniel/dashing-icinga2/archive/master.zip
unzip master.zip
mv dashing-icinga2-master dashing-icinga2
cd dashing-icinga2yum makecache
yum -y install epel-release
yum -y install rubygems rubygem-bundler ruby-devel openssl gcc-c++ make nodejsNote: The development tools and header files are required for building the eventmachine gem.
apt-get update
apt-get -y install ruby bundler nodejsProceed with the bundler gem installation.
gem install bundlerIn case the installation takes quite long and you do not need any documentation,
add the --no-document flags.
Install the dependencies using Bundler. Do not run this as root.
cd /usr/share/dashing-icinga2
bundleNote In case bundle complains about missing write access to
/usr/share/dashing-icinga2/Gemfile.lock, add write permissions accordingly
Proceed to the configuration section.
On macOS OpenSSL was deprecated, therefore you'll need to fix the eventmachine gem:
brew install openssl
bundle config build.eventmachine --with-cppflags=-I/usr/local/opt/openssl/include
bundle install --path binpathsProceed to the configuration section.
The Icinga 2 API requires either basic authentication or client certificates.
Add a new ApiUser object to your Icinga 2 configuration. Choose the path depending on your setup type. Keep in mind that synced ApiUser objects expose the login information to other Icinga 2 instances.
vim /etc/icinga2/conf.d/api-users.conf
vim /etc/icinga2/zones.d/global-templates/api-users.confobject ApiUser "dashing" {
password = "icinga2ondashingr0xx"
permissions = [ "status/query", "objects/query/*" ]
}Set the ApiUser permissions
according to your needs. By default the Icinga 2 job fetches
data from the /v1/status and /v1/objects API endpoints, but does not require write
permissions. If you're extending the API queries on your own, keep in mind to add
proper permissions.
In case you want to use client certificates, set the client_cn attribute accordingly.
Copy the example configuration from config/icinga2.json into config/icinga2.local.json
and adjust the settings for the Icinga 2 API credentials in the icinga2 section.
The icingaweb2 section allows you to specify the Icinga Web 2 URL
for the iframe widgets. This is read on startup once.
cp config/icinga2.json config/icinga2.local.jsonvim config/icinga2.local.json
{
"icinga2": {
"api": {
"host": "localhost",
"port": 5665,
"user": "dashing",
"password": "icinga2ondashingr0xx"
}
},
"icingaweb2": {
"url": "http://localhost/icingaweb2"
},
"dashboard": {
"show_only_hard_state_problems": false,
"timezone": "UTC",
"url_prefix": ""
}
}The show_only_hard_state_problems option ignores NOT-OK states until they
reach a hard NOT-OK state (off by default). The timezone option controls the clock widget's
timezone.
If you prefer to use client certificates, set the pki_path attribute. The Icinga 2
job expects the certificate file names based on the local FQDN e.g. pki/icinga2-master1.localdomain.crt.
You can override this behaviour by specifying the node_name configuration option
explicitly.
{
"icinga2": {
"api": {
"host": "localhost",
"port": 5665,
"user": "dashing",
"pki_path": "pki/",
"node_name": "icinga2-master1.localdomain"
}
},
"icingaweb2": {
"url": "http://localhost/icingaweb2"
},
"dashboard": {
"show_only_hard_state_problems": false,
"timezone": "UTC",
"url_prefix": ""
}
}Note:
If both methods are configured, the Icinga 2 job prefers client certificates.
If you prefer to configure the Icinga 2 settings in environment variables, you can do so as well. This helps with containers or local development tests.
| Variable | Description |
|---|---|
| ICINGA2_API_HOST | Required. Host where the API is listening on. |
| ICINGA2_API_PORT | Required. Port where the API is listening on. |
| ICINGA2_API_USERNAME | Optional. Required for basic auth as username. |
| ICINGA2_API_PASSWORD | Optional. Required for basic auth as password. |
| ICINGA2_API_CERT_PATH | Optional. Client certificate path. |
| ICINGA2_API_NODENAME | Optional. If client certificates do not match the host name, override it. |
| ICINGAWEB2_URL | Optional. Set the Icinga Web 2 Url. Defaults to http://localhost/icingaweb2. |
| DASHBOARD_SHOW_ONLY_HARD_STATE_PROBLEMS | Optional. Set show_only_hard_state_problems configuration option, toggle with `0 |
| DASHBOARD_TIMEZONE | Optional. Set the timezone option for the dashboard, overriding the default UTC value. |
| DASHBOARD_URL_PREFIX | Optional. Set the url prefix e.g. when running behind a reverse proxy |
Note
Environment variables always override local configuration.
Example:
ICINGA2_API_HOST=localhost ICINGA2_API_PORT=5665 ICINGA2_API_USERNAME=root ICINGA2_API_PASSWORD=icinga puma config.ru -p 8005Install the provided Systemd service file from tools/systemd. It assumes
that the working directory is /usr/share/dashing-icinga2 and the Smashing gem
is installed to /usr/local/bin/smashing. Adopt these paths for your own needs.
cp tools/systemd/dashing-icinga2.service /usr/lib/systemd/system/
systemctl daemon-reload
systemctl start dashing-icinga2.service
systemctl status dashing-icinga2.servicecp tools/systemd/dashing-icinga2.service /lib/systemd/system/
systemctl daemon-reload
systemctl start dashing-icinga2.service
systemctl status dashing-icinga2.serviceYou can start smashing as daemon by using this script:
./restart-dashingAdditional options are available through ./restart-dashing -h.
Navigate to http://localhost:8005
You can run Smashing in foreground for tests and debugging too:
export PATH="/usr/local/bin:$PATH"
puma config.ru -p 8005Or with environment variables:
ICINGA2_API_HOST=localhost ICINGA2_API_PORT=5665 ICINGA2_API_USERNAME=root ICINGA2_API_PASSWORD=icinga puma config.ru -p 8005To configure the application to run in a subfolder, e.g. for a reverse proxy, set the DASHBOARD_URL_PREFIX environment
variable or set the corresponding value in config/icinga2.local.json
Apache 2 reverse proxy example for DASHBOARD_URL_PREFIX=/icinga2-dashing
ProxyPass http://127.0.0.1:8005/icinga2-dashing/
ProxyPassReverse http://127.0.0.1:8005/icinga2-dashing/
You can install the provided logrotate script to rotate the Dashing log in /usr/share/dashing-icinga2/log.
cp tools/logrotate/dashing-icinga2 /etc/logrotate.dOriginal author:
Maintainer as of May 2020:
Thanks to all contributors! :)
No open issues yet, or sync has not completed.