RPi - icinga2

Icinga2-core Installation

sh# apt update && apt install icinga2

sh# mysql_secure_installation


sh# apt install icinga2-ido-mysql

Configuration

sh# cd /etc/icinga2

Create passwords manually.

sh# openssl passwd -1 "password"

sh# mysql

mysql> use icingaweb2;

mysql> update icingaweb_user set password_hash = "<HASH>" where name = "<USERNAME>";

IcingaWeb2 Installation

sh# apt update && apt install icingaweb2 mariadb-server

icinga2-ido-mysql

sh# mysql

mysql> create database icinga2;

mysql> grant SELECT, INSERT, UPDATE, DELETE, DROP, CREATE VIEW, INDEX, EXECUTE ON icinga2.* TO 'icinga2'@'localhost' identified by 'icinga2-ido';


sh# icinga2 feature enable ido-mysql

sh# systemctl restart icinga2

php timezone

sh# vi /etc/php/7.0/apache2/php.ini

...

date.timezone = Canada/Eastern

sh# systemctl reload apache2

Icinga2 IDO Installation 

Host with multiple interfaces

sh# cd /etc/icinga2

sh# vi hosts.conf

object Host "rpi-1.localhost" {

  import "generic-host"


  address = "192.168.45.1"

  vars.os = "Linux


  vars.interfaces = {

    eth0 = {

      ipv4 = "192.168.45.1"

      mac  = ""

      vlan = ""

    }

    eth1 = {

      ipv4 = "192.168.72.1"

      mac  = ""

      vlan = ""

    }

    eth0.35 = {

      ipv4 = "192.168.35.1"

      mac  = ""

      vlan = "35"

    }

  }

}


sh# cd /etc/icinga2

sh# vi services.conf

...

apply Service for ( ifname => ifattrs in host.vars.interfaces ) {

  import "generic-service"


  vars.address = ifattrs.ipv4

  check_command = "ping4"

}

Icinga2 Client Setup

client-1.localhost:sh# icinga2 node wizard

Welcome to the Icinga 2 Setup Wizard!


We'll guide you through all required configuration details.




Please specify if this is a satellite setup ('n' installs a master setup) [Y/n]: y

Starting the Node setup routine...

Please specifiy the common name (CN) [client-1.localhost]: 

Please specifiy the local zone name [client-1.localhost]: 

Please specify the master endpoint(s) this node should connect to:

Master Common Name (CN from your master setup): rpi-1.localhost

Do you want to establish a connection to the master from this node? [Y/n]: y

Please fill out the master connection information:

Master endpoint host (Your master's IP address or FQDN): rpi-1.localhost

Master endpoint port [5665]: 

Add more master endpoints? [y/N]: n

Please specify the master connection for CSR auto-signing (defaults to master endpoint host):

Host [rpi-1.localhost]: 

Port [5665]: 

information/base: Writing private key to '/etc/icinga2/pki/client-1.localhost.key'.

information/base: Writing X509 certificate to '/etc/icinga2/pki/client-1.localhost.crt'.

information/cli: Fetching public certificate from master (rpi-1.localhost, 5665):


Certificate information:


 Subject:     CN = rpi-1.localhost

 Issuer:      CN = Icinga CA

 Valid From:  Feb 11 22:00:38 2018 GMT

 Valid Until: Feb  7 22:00:38 2033 GMT

 Fingerprint: ....


Is this information correct? [y/N]: y

information/cli: Received trusted master certificate.


Please specify the request ticket generated on your Icinga 2 master.

 (Hint: # icinga2 pki ticket --cn 'client-1.localhost'): aabbb...........

information/cli: Requesting certificate with ticket 'aabbb........'.


information/cli: Created backup file '/etc/icinga2/pki/client-1.localhost.crt.orig'.

information/cli: Writing signed certificate to file '/etc/icinga2/pki/client-1.localhost.crt'.

information/cli: Writing CA certificate to file '/etc/icinga2/pki/ca.crt'.

Please specify the API bind host/port (optional):

Bind Host []: 

Bind Port []: 

Accept config from master? [y/N]: y

Accept commands from master? [y/N]: y

information/cli: Disabling the Notification feature.

Disabling feature notification. Make sure to restart Icinga 2 for these changes to take effect.

information/cli: Enabling the Apilistener feature.

Enabling feature api. Make sure to restart Icinga 2 for these changes to take effect.

information/cli: Created backup file '/etc/icinga2/features-available/api.conf.orig'.

information/cli: Generating local zones.conf.

information/cli: Dumping config items to file '/etc/icinga2/zones.conf'.

information/cli: Created backup file '/etc/icinga2/zones.conf.orig'.

information/cli: Updating constants.conf.

information/cli: Created backup file '/etc/icinga2/constants.conf.orig'.

information/cli: Updating constants file '/etc/icinga2/constants.conf'.

information/cli: Updating constants file '/etc/icinga2/constants.conf'.

Done.


Now restart your Icinga 2 daemon to finish the installation!

SNMP

Installation

sh# apt install monitoring-plugins-standard snmp-mibs-downloader

sh# snmpwalk -