Icinga2 Dashing Installation On Ubuntu 16.04 - Untold.IT

Breaking

Post Top Ad

Tuesday, October 31, 2017

Icinga2 Dashing Installation On Ubuntu 16.04

Dashing creates dashboards with Icinga2 data giving a front-end monitoring information of all your environment systems. Made out of Sinatra dialect on top of Ruby which is then implemented on Dashing framework, it is designed to deploy pretty and simple dashboards out of complex data. It makes the task of monitoring much better.




On my previous post, I have mentioned the steps on how to install Icinga2 on Ubuntu 16.04 with Dashing ready setup. (see post here)

First, we need to know the software stack needed to install and run Dashing on Icinga2.

Requirements:

  • curl git apt-get gnupg2 - To install the required packages
  • Dashing
    • ruby - The programming language used by dashing platform
      • RVM - Ruby enVironment manager will be used to install Ruby environment
      • Bundler - Bundler manage gems dependency
      • Dashing - Dashing is the dashboard framework
    • nodejs
    • Dashing Icinga - Icinga2 dashboards
  • Icinga2
    • MySQL - To be used as database backend for monitoring data.
    • Icinga2 - Icinga2 service
If you have already installed Icinga2 using the guide on my previous post, we will skip the installation of MySQL since it has been discussed already.

Installation:

Step 1: Install API Feature and Restart Icinga2 Service

root@ubuntu:~#icinga2 api setup
root@ubuntu:~#systemctl restart icinga2

Step 2: Install GnuPG 2

root@ubuntu:~#apt-get install gnupg2

Step 3: Use curl to download RVM install script and pipe it to bash

root@ubuntu:~#curl -L https://get.rvm.io | bash -s stable

Step 4: Once RVM is installed you must run its profile script so it extend your shell with its functions and create an abstraction to make its versioning.

root@ubuntu:~#source /etc/profile.d/rvm.sh

Step 5: Install Ruby Environment

root@ubuntu:~#rvm install 2.4.2

It takes time to install the Ruby environment so just be patient.

Step 6: Use RVM

root@ubuntu:~#rvm use 2.4.2

Step 7: Use RVM Default

root@ubuntu:~#rvm default 2.4.2

Step 8: Autolibs

Autolibs is a feature of RVM to allow you to automatically install dependencies on your system. This is particularly useful to solve broken dependencies such as openssl libraries installed at custom location.

root@ubuntu:~#rvm autolibs enable

Step 9: Installing Gems and Bundler (used to manage Gem Dependencies)

root@ubuntu:~#gem install bundler

Step 10: Installing Dashing Gem

This gem is the framework which create dashboards.

root@ubuntu:~#gem install dashing

Step 11: Install Node.js

In order to run dashing you must have a JavaScript back-end. In this setup, we will use Node.js back-end and its package manager.

root@ubuntu:~#apt-get install nodejs npm

Step 12: Install Dashing

We need to create the directory where we will be hosting the dashing files and the restart-dashing script that comes with the project.

On this setup, we will use the default location /usr/share/.

root@ubuntu:~#cd /usr/share/

Step 13: Cloning Dashing Icinga2 from Github

root@ubuntu:/usr/share/#git clone https://github.com/Icinga/dashing-icinga2.git

Step 14: Enter the Dashing Directory

root@ubuntu:/usr/share/#cd dashing-icinga2/

Step 15: Use bundle to install required gems into the system

root@ubuntu:/usr/share/dashing-icinga2#bundle install --system


Configuration:

Step 1: Enable REST API

Check if API feature is already enabled in Icinga2 to interface Dashing

root@ubuntu:~#icinga2 feature enable api
warning/cli: Feature 'api' already enabled.

Step 2: Authentication

To use the REST API, dashing Icinga2 must be authenticated. We are going to create its credentials. 
Open the api-users.conf file with vi or your favorite editor.
root@ubuntu:~#vim /etc/icinga2/conf.d/api-users.conf
Now add the dashing user the same as the one we used on Icinga Web Admin account.
object ApiUser "icingaadmin" {
password = "webadminpassword"
permissions = [ "status/query", "objects/query/*" ]
}

Step 3: Restart Icinga2

root@ubuntu:~#systemctl restart icinga2

Step 4: Check if icinga2 is running and listening.

root@ubuntu:~#netstat -putona | egrep icinga

The result should look like this.

tcp        0      0 0.0.0.0:5665            0.0.0.0:*               LISTEN      15040/icinga2    off (0.00/0/0)

Step 5: Dashing Authentication

From within Dashing Icinga2 project directory, open the configuration file

root@ubuntu:/usr/share/dashing-icinga2#vim config/icinga2.json

In the icinga2.json file we just need to change the credentials as previously created on icinga2, you should also point the correct host if you are running icinga2 and dashing on different hosts.

{
"icinga2": {
"api": {
"host": "localhost",
"port": 5665,
"user": "icingaadmin",
"password": "webadminpassword"
}
}
}

Step 6: Restart Dashing

root@ubuntu:/usr/share/dashing-icinga2#./restart-dashing

Finally, we need to check if both services are running using netstat and curl.

root@ubuntu:~#netstat -putona | egrep '5665|8005'
tcp        0      0 0.0.0.0:5665            0.0.0.0:*               LISTEN      1280/icinga2     off (0.00/0/0)
tcp        0      0 0.0.0.0:8005            0.0.0.0:*               LISTEN 


Use curl to check for HTML output.

root@ubuntu:~#curl localhost:8005/icinga2


At this point, you can now access the dashboard via web browser using the IP address of your icinga2 server and the dashing port.

http://<your icinga2 server IP>:8005/icinga2




In my experience, dashing service won't run automatically on startup. This made me do a restart dashing command every time I reboot the server. As a solution, I added the dashing service to run at startup.


root@ubuntu:~#vim /etc/rc.local


Add this command on the file before "exit 0"

cd /usr/share/dashing-icinga2
sudo ./restart-dashing







You can customize the dashboard style by editing the icinga2.erb file inside the dashing directory.

root@ubuntu:/usr/share/dashing-icinga2/dashboards#vi icinga2.erb



Conclusion:


This is only for my personal reference. Any difference may be possible in your own situation.
Many thanks to https://linoxide.com for being my main reference for this project.




No comments:

Post a Comment

Post Top Ad