ICINGA2

Install Plugins & NRPE

apt-get install nagios-nrpe-server                                #Nagios Remote Plugin Executor Server                                         -> install on icinga2 server
apt-get install nagios-nrpe-server monitoring-plugins             #NRPE Server + Plugins for nagios compatible monitoring systems (metapackage) -> install on clients
apt-get install monitoring-plugins                                #Plugins for nagios compatible monitoring systems (metapackage)
apt-get install nagios-nrpe-plugin                                #contains e. g. check_nrpe for Icinga Server                                  -> install on clients

Commands

service icinga2 checkconfig
icinga2 daemon -C                                                 #Detailed syntax check icinga config files
icinga2 daemon --validate
icinga2 feature list
icinga2 --version                                                 #Show version and application paths
icinga2 object list --type Endpoint                               #Show endpoints, possible types: Endpoint, Host, HostGroup, Notification, ScheduledDowntime, Service, ServiceGroup, TimePeriod, User, UserGroup, Zone
icinga2 object list --type notification
icinga2 object list --type notificationcommand 
icinga2 feature list
Disabled features: debuglog elasticsearch gelf influxdb livestatus opentsdb perfdata statusdata graphite compatlog graphite
Enabled features:  api checker ido-mysql mainlog notification syslog                                                     #basic features
Enabled features: api checker ido-mysql influxdb mainlog notification perfdata syslog                                    #with influxdb and perfdata
find /var/spool/icinga2/perfdata -type f -ctime +90 -exec rm {} \;

Basic features:

checker        #icinga2 
command        #icinga2                                         #DEPRECATED and will be removed in future releases
ido-mysql      #icingaweb2
notification   #icinga2
api            #Just needed when working with zones

NRPE Server

Encryption

“No ssl” (/etc/default/nagios-nrpe-server):

DAEMON_OPTS="--no-ssl"                     #default: '#DAEMON_OPTS="--no-ssl"'
NRPE_OPTS="-n"                             #on debian (10) system/ raspian, >=ubuntu20.04

NRPE-Checks

Examples Linux (/etc/nagios/nrpe.cfg):

#####Set Port:
server_port=5666
#####Add IP Icinga-Host:
allowed_hosts=127.0.0.1,10.5.8.10

#####################Linux-default###############################################
command[check_users]=/usr/lib/nagios/plugins/check_users -w 5 -c 10
command[check_load]=/usr/lib/nagios/plugins/check_load -w 15,10,5 -c 30,25,20
command[check_zombie_procs]=/usr/lib/nagios/plugins/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=/usr/lib/nagios/plugins/check_procs -w 600 -c 800

command[check_disk_root]=/usr/lib/nagios/plugins/check_disk -w 5% -c 2% -p /
command[check_disk_boot]=/usr/lib/nagios/plugins/check_disk -w 5% -c 2% -p /boot
command[check_disk_tmp]=/usr/lib/nagios/plugins/check_disk -w 5% -c 2% -p /tmp
command[check_disk_var]=/usr/lib/nagios/plugins/check_disk -w 5% -c 2% -p /var
command[check_disk_usr]=/usr/lib/nagios/plugins/check_disk -w 5% -c 2% -p /usr
command[check_disk_home]=/usr/lib/nagios/plugins/check_disk -w 5% -c 2% -p /home
#command[check_hda1]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/hda1

Commands

/usr/lib/nagios/plugins/check_nrpe -H hostname
/usr/lib/nagios/plugins/check_nrpe -n -H hostname                                             #Do no use SSL
/usr/lib/nagios/plugins/check_nrpe -n -H hostname -t 60 -c check_apt

Logging

icinga2 feature enable debuglog
tail -f /var/log/icinga2/icinga2.log
tail -f /var/log/icinga2/icinga2.log /var/log/icinga2/debug.log

SNMP

Test:

snmpget -v1 -c "public" "192.168.1.20" -mALL
snmpget -v1 -c "public" "192.168.1.20" -mALL 1.3.6.1.4.1.24681.1.2.17.1.4.1                        #qnap disk "TotalSize"
snmpwalk -v 2c -c "public" "192.168.1.20" ifIndex

Mips (Ubuntu/ Debian):

sudo apt-get install snmp-mibs-downloader    
sudo download-mibs

Fix Qnap TS 212:

https://docs.linuxconsulting.mn.it/notes/net-snmp-errors

sudo wget http://www.iana.org/assignments/ianaippmmetricsregistry-mib/ianaippmmetricsregistry-mib -O /usr/share/mibs/iana/IANA-IPPM-METRICS-REGISTRY-MIB
sudo wget http://pastebin.com/raw.php?i=p3QyuXzZ -O /usr/share/mibs/ietf/SNMPv2-PDU
sudo wget http://pastebin.com/raw.php?i=gG7j8nyk -O /usr/share/mibs/ietf/IPATM-IPMC-MIB

Zones & Satellite

https

a2ensite default-ssl
a2enmod ssl
service apache2 restart
systemctl status apache2.service

Force redirect http → https:

https://www.tmade.de/wiki/doku.php?id=server:apache#redirect

k8s

Examples

assign where (host.address || host.address6)
assign where (host.address || host.address6) || host.vars.os == "Linux"

Notification & Mail

To send emails the program “mail” and an mta like “postfix” is required. You can install it on debian based system such as:

apt install mailutils 
apt install postfix

Windows

Client:

NSClient++ (x64)
monitoring/icinga2.txt · Last modified: 2022/03/31 20:22 by tmade
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 4.0 International
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki