zhouandtao 发表于 2019-1-12 13:14:13

利用 nagios 监控 URL 地址

  利用 nagios 监控 URL 地址,分两种情况来分析。如果我们的 WEB Server 是 linux 系统,我们可以通过主动和被动(通过 nrpe 插件)两种方式来监控。假如我们的 WEB Server 为
  Windows系统,由于 windows上没办法安装 nrpe 插件,所以我们对于它的 URL 做监控使用主动方式无疑是最佳选择。那我们分别来看下如何使用主动和被动方式来监控 url 。
  主动监控方式:
  1.       编辑 Server 端的 /usr/local/nagios/etc/objects/commands.cfg 配置文件,增加以下内容,定义监控 URL 的 command 。
  define command{
  command_name check_http_by_domain
  command_line $USER1$/check_http $ARG1$
  }
  2.       编辑 Server 端的 /usr/local/nagios/etc/objects/services.cfg 配置文件,添加以下内容,定义监控服务的 command 。
  define service{
  host_name          win-2003-125
  service_description    check-url-wanqiu
  check_period         24x7
  max_check_attempts    5
  normal_check_interval   3
  retry_check_interval   2
  contact_groups      sagroup
  notification_interval    10
  notification_period    24x7
  notification_options   w,u,c,r
  check_command      check_http_by_domain!-H www.wanqiu.cn
  }
  被动监控方式:
  1.       修改 Clinet 端的 /usr/local/nagios/etc/nrpe.cfg 配置文件,添加以下内容,定义需要通过 nrpe 监控的 command 。
  command=/usr/local/nagios//libexec/check_http -H www.wanqiu.cn
  2.       修改 Server 端 /usr/local/nagios/etc/objects/services.cfg 配置文件,添加以下内容,定义监控服务的 command 。
  define service{
  host_name          win-2003-125
  service_description    check-url-wanqiu
  check_period         24x7
  max_check_attempts    5
  normal_check_interval   3
  retry_check_interval   2
  contact_groups      sagroup
  notification_interval    10
  notification_period    24x7
  notification_options   w,u,c,r
  check_command      check_nrpe! check_webpage
  }

页: [1]
查看完整版本: 利用 nagios 监控 URL 地址