Icinga2 – Installing reporting module for SLA

https://unsplash.com/photos/gYo3B_9So3Y?utm_source=unsplash&utm_medium=referral&utm_content=creditShareLink

After installing icinga2 for monitoring you may want to install reporting module for SLA purposes. In this post, I will show you how I installed this module for SLA.

For this module we will require the following:

  • Icinga Web 2 (>= 2.6)
  • PHP (>= 5.6, preferably 7.x)
  • MySQL / MariaDB or PostgreSQL
  • Icinga Web 2 modules:
    • reactbundle (>= 0.4)
    • Icinga PHP Library (ipl) (>= 0.2.1)
    • pdfexport (>= 0.9)

Since I have already installed icinga2, the first 3 are already there. I only need to install other required icinga2 modules.

Reactbundle

Copy and paste the following in your terminal.

Note: The version might change in the future so take a look in the README.md section at https://github.com/Icinga/icingaweb2-module-reactbundle#sample-git-installation

MODULE_NAME=reactbundle
MODULE_VERSION=v0.8.0
REPO="https://github.com/Icinga/icingaweb2-module-${MODULE_NAME}"
MODULES_PATH="/usr/share/icingaweb2/modules"
git clone ${REPO} "${MODULES_PATH}/${MODULE_NAME}" --branch "${MODULE_VERSION}"
icingacli module enable "${MODULE_NAME}"

IPL module

Copy and paste the following in your terminal.

Note: The version might change in the future so take a look in the README.md section at https://github.com/Icinga/icingaweb2-module-ipl#sample-git-installation

MODULE_NAME=ipl
MODULE_VERSION=v0.5.0
REPO="https://github.com/Icinga/icingaweb2-module-${MODULE_NAME}"
MODULES_PATH="/usr/share/icingaweb2/modules"
git clone ${REPO} "${MODULES_PATH}/${MODULE_NAME}" --branch "${MODULE_VERSION}"
icingacli module enable "${MODULE_NAME}"

pdfexport

For installation in any other distro than Ubuntu then refer to https://github.com/Icinga/icingaweb2-module-pdfexport/blob/master/doc/02-Installation.md

apt-get -y install apt-transport-https gnupg wget
wget -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list
apt-get update
apt-get install google-chrome-stable

Clone the repo and enable the module

cd /usr/share/icingaweb2/modules/
git clone https://github.com/Icinga/icingaweb2-module-pdfexport.git
mv icingaweb2-module-pdfexport pdfexport
icingacli module enable pdfexport

Create database for reporting.

CREATE DATABASE reporting;
CREATE USER 'reporting'@'localhost' IDENTIFIED BY 'secret';
GRANT SELECT, INSERT, UPDATE, DELETE, DROP, CREATE VIEW, INDEX, EXECUTE ON reporting.* TO 'reporting'@'localhost';

Reporting

Clone the reporting module.

cd /usr/share/icingaweb2/modules/
git clone https://github.com/Icinga/icingaweb2-module-reporting.git
mv icingaweb2-module-reporting reporting

We will need the database schema under this reporting folder. Import the MySQL schema

mysql -u root -p reporting < /usr/share/icingaweb2/modules/reporting/schema/mysql.sql

Enable the module

icingacli module enable reporting

Note: If you do not have icingacli then enable module from icingaweb2 GUI (Configuration -> Modules -> reporting)

Go to resources and add new resources (Configuration -> Application -> Resources). You can name resource anything. Make sure to enter the previous database credentials. Make sure that you set the character set to “utf8mb4”.

icinga2 reporting resource

Now go to backend and choose this resource (Configuration -> Modules -> reporting -> Backend)

Clone idoreports for Host and Service SLA

cd /usr/share/icingaweb2/modules/
git clone https://github.com/Icinga/icingaweb2-module-idoreports.git
mv icingaweb2-module-idoreports idoreports

Import the database schema under idoreports folder. We need to import this in IDO database. If you are not sure about the login details then it should be in /etc/icinga2/features-available/ido-mysql.conf

mysql -p -u root icinga2 < /usr/share/icingaweb2/modules/idoreports/schema/mysql/slaperiods.sql
mysql -p -u root icinga2 < /usr/share/icingaweb2/modules/idoreports/schema/mysql/get_sla_ok_percent.sql

Enable the module

icingacli module enable idoreports

Now you can create a SLA report and export it as PDF or even mail it.

icinga2 reporting module

Reference: https://icinga.com/blog/2019/06/17/icinga-reporting-hands-on/

Leave a Reply

Your email address will not be published. Required fields are marked *