hao1nan 发表于 2017-4-20 09:22:07

改变nagios ssh监控端口

NAGIOS默认监控服务默认的端口,但是如果把服务的端口改了后如何监控呢。
比如我把SSH改成1500后,NAGIOS再不能监控到SSH了,应该怎么改才能让它监控到1500就是SSH呢?
好像官方默认带的pluging文件都是编译好的不能修改,用守住每一天大侠的脚本就可以了
http://bbs.chinaunix.net/viewthread.php?tid=1416669

不好意思,我明白了官方的自带的pluging的配置文件其实你可以根据commands.cfg里指定的来设置一些参数,比如

define command{
      command_name    check_http
      command_line    $USER1$/check_http -I $HOSTADDRESS$ $ARG1$
      }



define command{
      command_name    check_ssh
      command_line    $USER1$/check_ssh $ARG1$ $HOSTADDRESS$

那你就可以在localhost.cfg

define service{
      use                           local-service         ; Name of service template to use
      host_name                     localhost
      service_description             SSH
      check_command                   check_ssh! -p 22!192.168.0.123
      notifications_enabled         0
      }


define service{
      use                           local-service         ; Name of service template to use
      host_name                     localhost
      service_description             HTTP
      check_command                   check_http! -I 192.168.0.123!80
      notifications_enabled         0
      }

例:
define service{
      use   generic-service
      host_name       webserver
      service_description   SSH
      check_command   check_ssh! -p 1500!远程被监控服务器IP
}
页: [1]
查看完整版本: 改变nagios ssh监控端口