Icinga Installation Guide 1o1

director
graphite
icinga2
icingaweb2

(Christian Moritz) #1

This will be a Beginner’s Guide for the Basic Install of a running Icinga Enviroment.

This Guide should help out other new Users with setting up their own Monitoring for Icinga2.

I needed aprox. 2 Weeks until i got mine running with all the required thinks i need, cause of reading a lot of diferent guides and test them for my needs.

So i will start with my Basic Setup:

Icinga2 VM

OS: Ubuntu Xenial Xerus 16.04 x64 Minimal
VM: 2x vCPU Cores
RAM: 4GB
HDD: 20GB

After the clean & fresh Ubuntu Install:

apt update && sudo apt dist-upgrade && sudo apt autoremove

installing VMware Tools

mkdir /mnt/cdrom
mount /dev/cdrom /mnt/cdrom or  mount /dev/sr0 /mnt/cdrom
ls /mnt/cdrom
tar xzvf /mnt/cdrom/VMwareTools-10.1.15-6677369.tar.gz -C /tmp/
cd /tmp/vmware-tools-distrib/
./vmware-install.pl -d

Reboot
Alternative Install Open-VM-Tools

apt-get -y install open-vm-tools

Change NIC (if required)

nano /etc/network/interfaces

Icinga2 install

wget -O - http://packages.icinga.org/icinga.key | apt-key add -
echo 'deb http://packages.icinga.org/ubuntu icinga-xenial main' > /etc/apt/sources.list.d/icinga-main-xenial.list
apt update

apt-get -y install icinga2
icinga2 feature list
apt-get -y install nagios-plugins
apt-get -y install mysql-server mysql-client
	SQL Root PW
apt-get -y install icinga2-ido-mysql
	Yes
nano  /etc/icinga2/features-available/ido-mysql.conf
icinga2 feature enable ido-mysql
systemctl restart icinga2
apt-get -y install apache2
apt-get -y install php7.0 libapache2-mod-php7.0
apt-get -y install icingaweb2
icinga2 feature enable command
systemctl restart icinga2
addgroup --system icingaweb2
usermod -a -G icingaweb2 www-data
nano /etc/php/7.0/apache2/php.ini

changeTimezone

apt-get -y install php7.0-gd
apt-get -y install php-pgsql
systemctl restart apache2

create Token

icingacli setup config directory --group icingaweb2;
icingacli setup token create;

Installing Additional Features

apt-get -y install monitoring-plugins nagios-snmp-plugins nagios-nrpe-plugin

Director install

apt-get -y install php-curl
apt-get -y install git
icinga2 api setup
service icinga2 restart
nano /etc/icinga2/conf.d/api-users.conf
[...]
object ApiUser "root" {
  password = "Root User PASSWORD”
  permissions = [ "*" ]
}
cd /usr/share/icingaweb2/modules
git clone -b v1.4.3 --single-branch https://github.com/Icinga/icingaweb2-module-director.git /usr/share/icingaweb2/modules/director director

mysql -u root -p
CREATE DATABASE director CHARACTER SET 'utf8';
GRANT ALL ON director.* TO director@localhost IDENTIFIED BY PASSWORD;
FLUSH PRIVILEGES;
Exit

Dashing install

mkdir -p /etc/sysconfig
ln -s /usr/lib/icinga2/icinga2 /etc/sysconfig/icinga2

apt-get -y install ruby bundler nodejs npm
gem install bundler
gem install dashing
cd /usr/share
git clone https://github.com/dnsmichi/dashing-icinga2.git
cd dashing-icinga2
bundle install --system
icinga2 feature enable api
nano /etc/icinga2/conf.d/api-users.conf
[...]
object ApiUser "dashing" {
  password = "f6acCfj4k8aC"
  permissions = [ "status/query", "objects/query/*" ]
}
[...]
systemctl restart icinga2
nano /usr/share/dashing-icinga2/config/icinga2.json
[...]
{
  "icinga2": {
    "api": {
      "host": "ICINGA2",
      "port": 5665,
      "user": "dashing",
      "password": "PASSWORD"
    }
  },
  "icingaweb2": {
    "url": "http://ICINGA2/icingaweb2"
  }
}
 [...]

Dashing Syntax

./restart-dashing
dashing start –p 8005
dashing stop
cp /usr/share/dashing-icinga2/tools/systemd/dashing-icinga2.service /etc/systemd/system/
systemctl daemon-reload
systemctl start dashing-icinga2.service		| Starten
systemctl enable dashing-icinga2.service		| Autostart anlegen
systemctl status dashing-icinga2.service		| Status

Audit install

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

Graphite install

apt-get -y install graphite-web graphite-carbon libapache2-mod-wsgi
	No
icinga2 feature enable perfdata graphite
systemctl restart icinga2  
graphite-manage syncdb
	Yes
chown _graphite:_graphite /var/lib/graphite/graphite.db
a2enmod wsgi
nano /etc/apache2/ports.conf
[...]
Add: Listen 8000 (leave 80 for the Icinga2 webserver)
[...]
cp /usr/share/graphite-web/apache2-graphite.conf /etc/apache2/sites-available/graphite.conf
nano /etc/apache2/sites-available/graphite.conf
[...]
Add: <Virtualhost *:8000>
[...]
a2ensite graphite
systemctl restart apache2
cd /usr/share/icingaweb2/modules/  
git clone https://github.com/Icinga/icingaweb2-module-graphite
mv icingaweb2-module-graphite graphite
mkdir /etc/icingaweb2/modules/graphite
nano /etc/icingaweb2/modules/graphite/config.ini
[...]
[graphite]
base_url = http://ICINGA2:8000/render?
host_name_template = icinga2.$host.name$.host.$host.check_command$.perfdata.$metric$.value
service_name_template = icinga2.$host.name$.services.$service.name$.$service.check_command$.perfdata.$metric$.value
[...]
apt-get install graphite-carbon
nano /etc/carbon/storage-schemas.conf
[...]
[icinga_internals] 
pattern = ^icinga2\..*\.(max_check_attempts|reachable|current_attempt|execution_time|latency|state|state_type) retentions = 5m:7d 
[icinga_default] 
pattern = ^icinga2\. retentions = 1m:2d,5m:10d,30m:90d,360m:4y
[...]
systemctl restart carbon-cache.service
systemctl restart icinga2  
systemctl restart apache2 

vSphere Connect

apt-get -y install php7.0-soap php7.0-posix
systemctl restart apache2 
cd /usr/share/icingaweb2/modules
git clone https://github.com/Icinga/icingaweb2-module-vsphere vsphere
icingacli module enable vsphere

BI Prozess

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

Deploy Agent on Windows Hosts

For this u need a local share in your enviroment where u can store the Icinga2Agent PSM (Powershell Module) and the required x64 an/or x86 Installer. This could be downloaded from:

http://packages.icinga.com/windows/

Then u can go on with the setup inside the Director:


after this u can use a powershell file storred on your fileserver. (f.e. together with the install msi & the psm)

# Copy IcingaAgent PSM to Windows Powershell
copy-item -Path \\PathToIcinga\Icinga2Agent  -Destination C:\Windows\System32\WindowsPowerShell\v1.0\Modules -Recurse
# Load Icinga2Agent Powershell Module
Import-Module Icinga2Agent
#Install Agent and Connect to Server
$icinga = Icinga2AgentModule `
-DirectorUrl 'http://icinga.mydomain/director/' `
-DirectorAuthToken 'MasterToken' `
-RunInstaller
$icinga.install();
#exit

and then u can go with RDP to the Server or with Powershell Remote(WinRM / enter-pssession)
and kick off the install with this powershell 1 liner.

Powershell.exe -ExecutionPolicy Bypass \\PathToIcinga\icinga_install.ps1

Icinga Installation Best Practice?
Install icinga2 from source
No Data in graphite Module von icingaweb2
Icingaweb2 Installation Monitoring Plugins (Nagios)
(Rafael Voss) #2

Just a short discussion topic about vmware tools:

I always use open-vm-tools for my linux VMs. They are for more easier to install and the use is recommended by vmware: VMWare KB about open-vm-tools


(Christian Moritz) #3

sure u can use the open vm tools.
but for me i got in some enviroments problems with open vm tools and a vm backup over the vsphere with f.e. IBM TSM or some other backup apps.
with the original vmware linux tools for me it works fine.


#4
  1. I’m also in favor for the open-vm-tools. But this is to decided by everyone for themselves.
    I would add that this step is only necessary for VMware environments :wink: just to be sure.

  2. I wouldn’t use git clone to install the director, but rather checkout a specific (lastest) release. The master branch you get with a normal clone may contain bugs:
    git clone -b v1.4.3 --single-branch https://github.com/Icinga/icingaweb2-module-director.git /usr/share/icingaweb2/modules/director
    (not a sure if this call is 100% correct, but it works for me)

  3. I install the following packages for having the most used plugins ready: monitoring-plugins nagios-snmp-plugins nagios-nrpe-plugin

Other than that: nice how to! I will check the graphite-stuff out some time soon :slight_smile:


(Christian Moritz) #5

@log1c: ive added your stuff to the guide. thx


Can anybody suggest latest WORKING link providing step by step instructions for Icingaweb2 and Icinga Agent Installation..!?
(Roland) #6

You can remove nagios-plugins from the list as this package is just a dummy package to install monitoring-plugins.

For configuring Ubuntu to run on Hyper-V you could add this URL: Supported Ubuntu virtual machines on Hyper-V


#7

i think this part is wrong - should be something like

url = “http://10.147.42.36


#8

i think this part is wrong - should be something like

As shown here the configuration depends on the versions being used…


#9

yes it is the newest version 1.1.0 found there


#10

Hello,

maybe I am the only one, but at this point I had to change the lines from:

to

[icinga_internals] 
pattern = ^icinga2\..*\.(max_check_attempts|reachable|current_attempt|execution_time|latency|state|state_type) retentions = 5m:7d 
[icinga_default] 
pattern = ^icinga2\. retentions = 1m:2d,5m:10d,30m:90d,360m:4y

Perhaps this can help someone out there.


(Christian Moritz) #11

thx for the hint… ive changed it in the how²