Kamis, 02 Mei 2019

Monitor ssh on non-default port with Nagios


In ssh pluging config /usr/local/nagios/etc/objects/commands.cfg, there an alias named check_ssh_port.
if it not existe you may define it like above:

define command{
command_name check_ssh_port
command_line $USER1$/check_ssh  -p $ARG1$ $HOSTADDRESS$
}

in the service file /usr/local/nagios/etc/servers/hosttomonitor.cfg, define you ssh service to monitor like this:

define host{

use                                 linux-server
host_name                           hosttomonitor.localnet
alias                               hosttomonitor
address                             10.10.10.19
max_check_attempts                  5
check_period                        24x7
notification_interval               30
notification_period                 24x7

}

define service {
        use                         generic-service
        host_name                   hosttomonitor.localnet
        service_description         SSH2
        check_command               check_ssh_port!1422
        notifications_enabled       0
        }

replace 1422 by you default ssh port and server by your target.

finally restart nagios service


Tidak ada komentar: