Skip to content

Commit

Permalink
Change thin->puma, dashing->smashing
Browse files Browse the repository at this point in the history
  • Loading branch information
mocdaniel committed Apr 6, 2022
1 parent 2a36680 commit 34f418d
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 57 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 6 additions & 7 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
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'

# Icinga 2 job
gem 'rest-client'
gem 'json'

# Misc
gem 'sassc', '<= 2.1.0'
59 changes: 17 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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
Expand All @@ -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/)
Expand All @@ -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:
Expand Down Expand Up @@ -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.**

Expand All @@ -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:

Expand All @@ -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.


Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -307,21 +289,16 @@ 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

### 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

Expand All @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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

Expand All @@ -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

Expand All @@ -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

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docker/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions tools/logrotate/dashing-icinga2
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/usr/share/dashing-icinga2/log/thin.log {
/usr/share/dashing-icinga2/log/puma.log {
daily
rotate 7
compress
delaycompress
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
}
7 changes: 3 additions & 4 deletions tools/systemd/dashing-icinga2.service
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 34f418d

Please sign in to comment.