SSH is a super easy and secure way, to execute monitoring plugins on a remote host.
If you don't have a SSH-Key for your user
nagios yet, you need to create one.
su nagios mkdir /var/lib/nagios/.ssh ssh-keygen
Also you should import the ssh host key of the target host right now:
ssh <target-host> and just confirm with
For this example you need to install the
apt-get install nagios-plugins
In the next step we create a new user
monitoring which will be used to execute the checks via SSH.
addgroup --system monitoring adduser --system --shell /bin/bash monitoring adduser monitoring monitoring mkdir -p /home/monitoring/.ssh/ chown monitoring:monitoring /home/monitoring -R touch /home/monitoring/.ssh/authorized_keys chmod 644 /home/monitoring/.ssh/authorized_keys
Now copy your public key to the file
First of all, make sure that the command
check_by_ssh at Basic Monitoring Commands is set with the right parameters.
Set as command line
$USER1$/check_by_ssh -H $HOSTADDRESS$ -l "$ARG1$" -C "$ARG2$" and press on save. (In previous versions the quotes where missing)
Due to the fact that we are lazy, we create a new macro Expert Monitoring User Defined Macros and set the value to
Now we do not need to set the base path for every plugin we like to execute via SSH.
Go to Basic Monitoring Services "New" to create a new service, which will be checked by SSH.
First of all you need to select the host, were you like to create the service for and the service template
The system will now load all predefined values of the service template.
Change the Name to
CPU Load and click on Expert settings.
New you need to pass your arguments. For Username we set
monitoring and for Command
$USER2$/check_load -w 15,10,5 -c 30,25,20.
$USER2$ will be automatically replaced with the value from the macro we defined earlier.
Now press on "Save" and repeat this step for every service.
Once you created all services, you need to "Refresh the monitoring configuration".
The new services will be now monitored by the system:
© 2020 it-novum GmbH - All Rights Reserved