diff --git a/Dockerfile b/Dockerfile index 9e18a11..b7a98a5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ libssl-dev nodejs build-essential \ && rm -rf /var/lib/apt/lists/* && mkdir -p /usr/share/dashing-icinga2 -RUN echo 'gem: --no-document' >> /etc/gemrc && gem install --quiet bundle bundler dashing +RUN echo 'gem: --no-document' >> /etc/gemrc && gem install --quiet bundler WORKDIR /usr/share/dashing-icinga2 ADD Gemfile /usr/share/dashing-icinga2 diff --git a/Gemfile b/Gemfile index e4125bc..d5561e4 100644 --- a/Gemfile +++ b/Gemfile @@ -1,15 +1,11 @@ source 'https://rubygems.org' -if dashing = ENV['DASHING_PROVIDER'] - gem dashing, :require => false -else - # force the most recent dashing version to avoid #48 - gem 'dashing', '>= 1.3.7', :require => false -end +gem 'smashing' # dashing server -gem 'thin' +gem 'puma' gem 'eventmachine' +gem 'sd_notify' # sinatra pulls rack-protection which pulls rack-test >= 0. v0.8.0 requires Ruby >= 2.2.2 (this fails on RHEL7). gem 'rack-test', '< 0.8.0' @@ -17,3 +13,6 @@ gem 'rack-test', '< 0.8.0' # Icinga 2 job gem 'rest-client' gem 'json' + +# Misc +gem 'sassc', '<= 2.1.0' diff --git a/README.md b/README.md index 6341b4a..6202163 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ ![](https://img.shields.io/docker/cloud/build/dbodky/dashing-icinga2) # Dashing with Icinga 2 +** As of v3.3 dashing-icinga2 will actually use** `smashing` and not `dashing` anymore. + #### Table of Contents 1. [Introduction](#introduction) @@ -16,7 +18,7 @@ ## Introduction -[Dashing](http://shopify.github.io/dashing/) is a Sinatra based framework +[Smashing](https://smashing.github.io/) is a Sinatra based framework that lets you build beautiful dashboards. You can put your important infrastructure stats and metrics on your office @@ -29,7 +31,7 @@ etc. -- literally anything which can be presented as counter or list. ### Icinga 2 Dashboard -The Icinga 2 dashboard is built on top of Dashing and uses the [Icinga 2 API](https://www.icinga.com/products/icinga-2/) +The Icinga 2 dashboard is built on top of Smashing and uses the [Icinga 2 API](https://www.icinga.com/products/icinga-2/) 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](https://www.icinga.com/products/icinga-web-2/) @@ -48,13 +50,13 @@ first. ## License * The code for jobs, dashboards and libraries is licensed under the MIT license. -* Dashing is licensed under the [MIT license](https://github.com/Shopify/dashing/blob/master/MIT-LICENSE). +* Smashing is licensed under the [MIT license](https://github.com/Smashing/smashing/blob/master/MIT-LICENSE). * Chartjs is licensed under the [MIT license](https://github.com/chartjs/Chart.js/blob/master/LICENSE.md). ## Requirements * Ruby, Gems and Bundler -* Dashing or Smashing Ruby Gem +* Smashing Ruby Gem * Icinga 2 (v2.11+) and the REST API Supported browsers and clients: @@ -134,12 +136,6 @@ In case the installation takes quite long and you do not need any documentation, add the `--no-document` flags. #### Proceed with bundling for all systems (CentOS, Ubuntu, Debian etc.) -> **Note** -> -> In case you want to use `smashing` instead of `dashing`, -> set the environment variable like this: -> -> `export DASHING_PROVIDER=smashing` Install the dependencies using Bundler. **Do not run this as root.** @@ -156,13 +152,6 @@ Proceed to the [configuration](#configuration) section. ### Unix and macOS -> **Note** -> -> In case you want to use `smashing` instead of `dashing`, -> set the environment variable like this: -> -> `export DASHING_PROVIDER=smashing` - On macOS [OpenSSL was deprecated](https://github.com/eventmachine/eventmachine/issues/602), therefore you'll need to fix the eventmachine gem: @@ -172,13 +161,6 @@ bundle config build.eventmachine --with-cppflags=-I/usr/local/opt/openssl/includ bundle install --path binpaths ``` -Note: Dashing is running inside thin server which by default uses epoll from within the eventmachine library. -This is not available on Unix based systems, you can safely ignore this warning: - -``` -warning: epoll is not supported on this platform -``` - Proceed to the [configuration](#configuration) section. @@ -213,7 +195,7 @@ proper permissions. In case you want to use client certificates, set the `client_cn` attribute accordingly. -### Dashing Configuration +### Smashing Configuration #### Configuration File @@ -307,7 +289,7 @@ DASHBOARD_TIMEZONE | **Optional.** Set the `timezone` option for the dashb Example: ``` -ICINGA2_API_HOST=localhost ICINGA2_API_PORT=5665 ICINGA2_API_USERNAME=root ICINGA2_API_PASSWORD=icinga dashing start -p 8005 +ICINGA2_API_HOST=localhost ICINGA2_API_PORT=5665 ICINGA2_API_USERNAME=root ICINGA2_API_PASSWORD=icinga puma config.ru -p 8005 ``` ## Run @@ -315,13 +297,8 @@ ICINGA2_API_HOST=localhost ICINGA2_API_PORT=5665 ICINGA2_API_USERNAME=root ICING ### Systemd Service Install the provided Systemd service file from `tools/systemd`. It assumes -that the working directory is `/usr/share/dashing-icinga2` and the Dashing gem -is installed to `/usr/local/bin/dashing`. Adopt these paths for your own needs. - -> **Note** -> -> In order to use `smashing` instead of `dashing`, modify `tools/systemd/dashing-icinga2.service` -> to run the smashing binary. +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. #### Redhat/CentOS @@ -343,7 +320,7 @@ systemctl status dashing-icinga2.service ### Script -You can start dashing as daemon by using this script: +You can start smashing as daemon by using this script: ``` ./restart-dashing @@ -356,20 +333,19 @@ Navigate to [http://localhost:8005](http://localhost:8005) ### Foreground -You can run Dashing in foreground for tests and debugging too: +You can run Smashing in foreground for tests and debugging too: ``` export PATH="/usr/local/bin:$PATH" -dashing start -p 8005 +puma config.ru -p 8005 ``` Or with environment variables: ``` -ICINGA2_API_HOST=localhost ICINGA2_API_PORT=5665 ICINGA2_API_USERNAME=root ICINGA2_API_PASSWORD=icinga dashing start -p 8005 +ICINGA2_API_HOST=localhost ICINGA2_API_PORT=5665 ICINGA2_API_USERNAME=root ICINGA2_API_PASSWORD=icinga puma config.ru -p 8005 ``` -Replace the calls above to `dashing` with `smashing` if you are using this Gem instead. ### Logrotate @@ -402,6 +378,7 @@ Thanks to all contributors! :) * [micke2k](https://github.com/micke2k) for [proper time formatting](https://github.com/dnsmichi/dashing-icinga2/pull/2). * [lazyfrosch](https://github.com/lazyfrosch) for ideas on [Dashing with Icinga](https://github.com/lazyfrosch/dashing-icinga). * [roidelapliue](https://github.com/roidelapluie) for the [Icinga 1.x dashing script](https://github.com/roidelapluie/dashing-scripts). +* [](https://github.com/austinjhung) for reevaluating switching to Puma + Smashing instead of Thin + Dashing. ## Troubleshooting @@ -419,7 +396,7 @@ Please add these details when you are asking a question on the community channel * Open your browser's development console and check for errors. * Ensure that the job runner does not log any errors. -* Stop the dashing daemon and run it in foreground. +* Stop the smashing daemon and run it in foreground. ### Connection Errors @@ -434,8 +411,6 @@ The Icinga 2 daemon might have been reloaded at that time. ### Misc Errors * Port 8005 is not reachable. Ensure that the firewall rules are setup accordingly. -* Iframe is not working. Try [this solution](https://monitoring-portal.org/woltlab/index.php?thread/39888-icinga2-dashing-iframe-issue-resolved/) -and ensure that the `X-Frame-Options` variable is **not** set to `DENY`. ## Development @@ -456,7 +431,7 @@ maximum value at runtime. `list` was updated to highlight colors and change font You can use environment variables to quickly set the required configuration settings: ``` -ICINGA2_API_HOST=localhost ICINGA2_API_PORT=5665 ICINGA2_API_USERNAME=root ICINGA2_API_PASSWORD=icinga dashing start -p 8005 +ICINGA2_API_HOST=localhost ICINGA2_API_PORT=5665 ICINGA2_API_USERNAME=root ICINGA2_API_PASSWORD=icinga puma config.ru -p 8005 ``` ### Icinga 2 Library diff --git a/docker/start.sh b/docker/start.sh index f906e5d..05e6201 100755 --- a/docker/start.sh +++ b/docker/start.sh @@ -5,4 +5,4 @@ export LANG=en_US.UTF-8 export LC_CTYPE=en_US.UTF-8 export LC_ALL=en_US.UTF-8 -dashing start -p 8005 +puma config.ru -p 8005 diff --git a/tools/logrotate/dashing-icinga2 b/tools/logrotate/dashing-icinga2 index df7e865..08e3e7e 100644 --- a/tools/logrotate/dashing-icinga2 +++ b/tools/logrotate/dashing-icinga2 @@ -1,4 +1,4 @@ -/usr/share/dashing-icinga2/log/thin.log { +/usr/share/dashing-icinga2/log/puma.log { daily rotate 7 compress @@ -6,6 +6,6 @@ missingok notifempty postrotate - /bin/kill -USR1 $(cat /var/run/thin.pid 2> /dev/null) 2> /dev/null || true + /bin/kill -USR1 $(cat /var/run/puma.pid 2> /dev/null) 2> /dev/null || true endscript } diff --git a/tools/systemd/dashing-icinga2.service b/tools/systemd/dashing-icinga2.service index 62630bc..31bf6a4 100644 --- a/tools/systemd/dashing-icinga2.service +++ b/tools/systemd/dashing-icinga2.service @@ -3,11 +3,10 @@ Description=Dashing-Icinga2 host/service/network monitoring system After=syslog.target network.target postgresql.service mariadb.service carbon-cache.service icinga2.service [Service] -Type=oneshot -RemainAfterExit=yes +Type=notify +WatchdogSec=10 WorkingDirectory=/usr/share/dashing-icinga2 -ExecStart=/usr/local/bin/dashing start -d -p 8005 --pid /var/run/thin.pid -ExecStop=/usr/local/bin/dashing stop +ExecStart=/usr/local/bin/puma -p 8005 --pid /var/run/puma.pid [Install] WantedBy=multi-user.target