cat /etc/apt/sources.list
deb http://deb.debian.org/debian buster main
deb-src http://deb.debian.org/debian buster main
deb http://security.debian.org/ buster/updates main
deb-src http://security.debian.org/ buster/updates main
deb http://deb.debian.org/debian buster-updates main
deb-src http://deb.debian.org/debian buster-updates main
deb http://deb.debian.org/debian buster-backports main
deb-src http://deb.debian.org/debian buster-backports main
wget -O - https://packages.icinga.com/icinga.key | apt-key add -
echo "deb http://packages.icinga.com/debian icinga-buster main" > /etc/apt/sources.list.d/icinga.list
echo "deb-src http://packages.icinga.com/debian icinga-buster main" >> /etc/apt/sources.list.d/icinga.list
apt-get update
apt-get install icinga2 monitoring-plugins
systemctl status icinga2.service
â—Ź icinga2.service - Icinga host/service/network monitoring system
Loaded: loaded (/lib/systemd/system/icinga2.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2017-07-28 13:46:00 BST; 16s ago
apt-get install icinga2-ido-mysql mariadb-server mariadb-client
Questions during installation:
- Enable Icinga 2's ido-mysql feature?
No
- Configure database for icinga2-ido-mysql with dbconfig-common?
No
mysql_secure_installation
mysql -u root -p
CREATE DATABASE icinga2 CHARACTER SET utf8 COLLATE utf8_general_ci;
GRANT ALL ON icinga2.* TO 'icinga2'@'localhost' IDENTIFIED BY 'your-icinga2-pwd';
mysql -p icinga2 < /usr/share/icinga2-ido-mysql/schema/mysql.sql
icinga2 feature enable ido-mysql
vim /etc/icinga2/features-available/ido-mysql.conf
- password = "",
- host = "localhost",
+ password = "your-icinga2-pwd",
+ host = "127.0.0.1",
apt-get install apache2 icingacli icingaweb2 icingaweb2-module-monitoring \
php php-intl php-imagick php-gd php-mysql php-curl php-mbstring
vim /etc/php/7.3/apache2/php.ini
-;date.timezone =
+date.timezone = Europe/Paris
systemctl restart apache2.service
mysql -u root -p
CREATE DATABASE icingaweb2 CHARACTER SET utf8 COLLATE utf8_general_ci;
GRANT ALL ON icingaweb2.* TO 'icingaweb2'@'localhost' IDENTIFIED BY 'your-icingaweb2-pwd';
mysql -p icingaweb2 < /usr/share/icingaweb2/etc/schema/mysql.schema.sql
icinga2 feature enable command
systemctl restart icinga2.service
icingacli setup config directory --group icingaweb2
icingacli setup token create
http://your-public-host.name/icingaweb2/setup
Setup Token: Your Token
Next
Modules enabled: Monitoring
Next
Authentication Type: Database
Next
Resource Name: icingaweb_db
Database Type: MySQL
Host: 127.0.0.1
Port: 3306
Database Name: icingaweb2
Username: icingaweb2
Password: your-icingaweb2-pwd
Character Set: utf8
Use SSL: False
Next
Backend Name: icingaweb2
Next
Username: admin
Password: your-admin-pwd
Repeat password: your-admin-pwd
Next
Show Stacktraces: Yes
Show Application State Messages: Yes
User Preference Storage Type: Database
Logging Type: Syslog
Logging Level: Error
Application Prefix: icingaweb2
Facility: user
Next
Backend Name: icinga
Backend Type: IDO
Next
Resource Name: icinga_ido
Database Type: MySQL
Host: 127.0.0.1
Port: 3306
Database Name: icinga2
Username: icinga2
Password: your-icinga2-pwd
Character Set: utf8
Use SSL: False
Next
Transport Name: icinga2
Transport Type: Local Command File
Command File: /var/run/icinga2/cmd/icinga2.cmd
Next
Protected Custom Variables: *pw*,*pass*,community
Next
wget -O - https://packages.grafana.com/gpg.key | apt-key add -
echo "deb https://packages.grafana.com/oss/deb stable main" > /etc/apt/sources.list.d/grafana.list
apt-get update
apt-get install grafana influxdb influxdb-client
systemctl daemon-reload
systemctl enable grafana-server.service
systemctl start grafana-server.service
influx
CREATE DATABASE icinga2;
CREATE USER icinga2 WITH PASSWORD 'your-icinga2-pwd';
icinga2 feature enable influxdb
vim /etc/icinga2/features-enabled/influxdb.conf
- //host = "127.0.0.1"
- //port = 8086
- //database = "icinga2"
- //flush_threshold = 1024
- //flush_interval = 10s
- //host_template = {
- // measurement = "$host.check_command$"
- // tags = {
- // hostname = "$host.name$"
- // }
- //}
- //service_template = {
- // measurement = "$service.check_command$"
- // tags = {
- // hostname = "$host.name$"
- // service = "$service.name$"
- // }
- //}
+ host = "127.0.0.1"
+ port = 8086
+ database = "icinga2"
+ username = "icinga2"
+ password = "your-icinga2-pwd"
+ enable_send_thresholds = true
+ enable_send_metadata = true
+ flush_threshold = 1024
+ flush_interval = 10s
+ host_template = {
+ measurement = "$host.check_command$"
+ tags = {
+ hostname = "$host.name$"
+ }
+ }
+ service_template = {
+ measurement = "$service.check_command$"
+ tags = {
+ hostname = "$host.name$"
+ service = "$service.name$"
+ }
+ }
systemctl restart icinga2.service
Url: http://your-public-host.name:3000
Username: admin
Password: admin
Add Datasource: http://your-public-host.name:3000/datasources/new?gettingstarted
Name: InfluxDB
Type: InfluxDB
Default: Yes
Url: http://127.0.0.1:8086
Access: Server (Default)
Database: icinga2
User: icinga2
Password: your-icinga2-pwd
Import Dashboard: http://your-public-host.name:3000/dashboard/import
Paste JSON from https://raw.githubusercontent.com/Mikesch-mp/icingaweb2-module-grafana/v1.1.8/dashboards/influxdb/base-metrics.json
cd /usr/share/icingaweb2/modules
wget -qO- https://github.com/Mikesch-mp/icingaweb2-module-grafana/archive/v1.3.5.tar.gz | tar xvz
mv icingaweb2-module-grafana-1.3.5 grafana
mkdir /etc/icingaweb2/modules/grafana
Module configuriation (config.ini)
vim /etc/icingaweb2/modules/grafana/config.ini
Graph configuriation (graphs.ini)
vim /etc/icingaweb2/modules/grafana/graphs.ini
vim /etc/grafana/grafana.ini
[auth.anonymous]
# enable anonymous access
-;enabled = false
+enabled = true
# set to true if you want to allow browsers to render Grafana in a <frame>, <iframe>, <embed> or <object>. default is false.
-;allow_embedding = false
+allow_embedding = true
systemctl restart grafana-server.service
icingacli module enable grafana
chown -R www-data:icingaweb2 /etc/icingaweb2
Go to the service configuration and set the custom var grafana_graph_disable
for all services, which have no Grafana graph: ssh
, http
, disk
, and icinga
.
vim /etc/icinga2/conf.d/services.conf
+ vars.grafana_graph_disable = true
systemctl restart icinga2.service
apt-get install snmp snmpd libsnmp-dev
systemctl stop snmpd.service
net-snmp-config --create-snmpv3-user -ro -A "your-secret-auth-pwd" -X "your-secret-priv-pwd" -a SHA -x AES snmp
vim /etc/snmp/snmpd.conf
- rocommunity public default -V systemonly
- rocommunity6 public default -V systemonly
+# rocommunity public default -V systemonly
+# rocommunity6 public default -V systemonly
- rouser authOnlyUser
+# rouser authOnlyUser
- trapsink localhost public
+# trapsink localhost public
-iquerySecName internalUser
-rouser internalUser
-defaultMonitors yes
-linkUpDownNotifications yes
+#iquerySecName internalUser
+#rouser internalUser
+#defaultMonitors yes
+#linkUpDownNotifications yes
systemctl start snmpd.service
Script to monitor open file handles: check_open_files
apt-get install bc
mkdir -p /usr/local/lib/nagios/plugins
vim /usr/local/lib/nagios/plugins/check_open_files
chmod +x /usr/local/lib/nagios/plugins/check_open_files
vim /etc/snmp/snmpd.conf
- extend test1 /bin/echo Hello, world!
- extend-sh test2 echo Hello, world! ; echo Hi there ; exit 35
-#extend-sh test3 /bin/sh /tmp/shtest
+ extend open_files /usr/local/lib/nagios/plugins/check_open_files
systemctl restart snmpd.service
snmpwalk -v3 -l authPriv -u snmp -a SHA -A "your-secret-auth-pwd" -x AES -X "your-secret-priv-pwd" 127.0.0.1 .1.3.6.1.4.1.8072.1.3.2
Output:
...
iso.3.6.1.4.1.8072.1.3.2.4.1.2.10.111.112.101.110.95.102.105.108.101.115.1 = STRING: "0.27"
iso.3.6.1.4.1.8072.1.3.2.4.1.2.10.111.112.101.110.95.102.105.108.101.115.2 = STRING: "open=1088 max=401859"
apt-get install nagios-snmp-plugins libdigest-hmac-perl
Hosts configuriation (hosts.conf)
vim /etc/icinga2/conf.d/hosts.conf
Services configuriation (services.conf)
vim /etc/icinga2/conf.d/services.conf
Groups configuriation (groups.conf)
vim /etc/icinga2/conf.d/groups.conf
Graph configuriation (graphs.ini)
vim /etc/icingaweb2/modules/grafana/graphs.ini
systemctl restart icinga2.service
In case you experience issues with the network interface (Unknown interface eth0
), use the following command to get a list of available network interfaces:
/usr/lib/nagios/plugins/check_snmp_int.pl -x your-secret-auth-pwd -p 161 -n eth0 -l snmp -X your-secret-priv-pwd -L sha,aes -H 127.0.0.1 -v
Import Dashboard: http://your-public-host.name:3000/dashboard/import
Use the grafana-snmp-dashboard.