3ewsd 发表于 2019-1-16 09:46:13

nagios监控单个文件大小,超过设定的最大值则发出警报

  nagios监控单个文件大小,超过设定的最大值则发出警报,找了半天结果发现nsclient内置就有这样的功能。解决办法如下
  1:在nsc.ini中添加如下内容
  check_tempdb=inject CheckFileSize ShowAll MaxWarn=600M MaxCrit=1000M File:Tempdb.MDF=C:\PROGRA~1\MICROS~1\MSSQL.1\MSSQL\Data\tempdb.mdf

  check_templog=inject CheckFileSize ShowAll MaxWarn=600M MaxCrit=1000M File:Templog.ldf=C:\PROGRA~1\MICROS~1\MSSQL.1\MSSQL\Data\templog.ldf
  这里主意如果目录中有空格请用~1来表示
  2:在nagios中定义如下命令
  define service{
      use                     generic-service
      host_name               DBSLHX
      service_description   Check tempdb
      check_command         check_nrpe!check_tempdb
      normal_check_interval   5
      max_check_attempts      6
      notification_interval   30
      retry_check_interval    1
      }
define service{
      use                     generic-service
      host_name               DBSLHX
      service_description   Check templog
      check_command         check_nrpe!check_templog
      normal_check_interval   5
      max_check_attempts      6
      notification_interval   30
      retry_check_interval    1
      }前提是你要已经定义好了check_nrpe哇,在command.cfg中定义
  接下来去看看你的nagios中吧,已经现实ok了。。
  http://www.nsclient.org/nscp/wiki/CheckFileSize这个文章有详细的说明这个命令。



页: [1]
查看完整版本: nagios监控单个文件大小,超过设定的最大值则发出警报