Icinga 2 cheat sheet

Just a post starter for some Icinga 2 commands.

Check config

icinga2 daemon -C

List objects

icinga2 object list --type Host
icinga2 object list --type Service

Refresh / dump objects

icinga2 daemon -C --dump-objects

Running icinga in the foreground with debug output

icinga2 daemon -x debug
icinga2 daemon -x notice

Checkcommand definitions

ls /usr/share/icinga2/include/plugins-contrib.d/
ls /usr/share/icinga2/include/

SSH agent config

On the target, install the Nagios plugins in preparation for executing checks:

dnf install nagios-plugins-all
cd /usr/lib64/nagios/plugins/
git clone https://github.com/justintime/nagios-plugins/
mv nagios-plugins/check_mem/check_mem.pl ./check_mem
rm -Rf nagios-plugins/

Create an Icinga user on the target host:

useradd -m icinga
passwd icinga

su as the Icinga user on the master and copy the SSH public key to the target host. Validate the SSH configuration by testing access to the target host and executing a remote check command:

sudo su - icinga
ssh-copy-id -i $HOME/.ssh/id_rsa icinga@<target>
ssh icinga@<target>
exit
/usr/lib64/nagios/plugins/check_by_ssh -H <target> -C uptime

Lock the password of the Icinga user on the target. This will restrict access through the defined SSH key:

useradd -l icinga
useradd -S icinga
(out)icinga LK 2025-12-07 0 99999 7 -1 (Password locked.)

A handy link to agent-less SSH monitoring: https://icinga.com/blog/how-to-do-agentless-monitoring-with-check_by_ssh/


Posted

in

by