我试图通过监视si检测磁盘抖动,所以从vmstat命令。 我正在使用nagios监视其他服务,并在每5分钟后进行一次服务检查。 对于这种颠簸服务,我希望nagios每20分钟检查一次,如果返回的状态不正确(即警告或严重),则应每隔3分钟检查一次颠簸服务,直到服务返回状态变为OK。 所有其他服务的服务检查时间保持不变。
我是Nagios新手,任何帮助,将非常感激。
假设interval_length指令被默认设置为60:
$ grep interval_length /usr/local/nagios/etc/nagios.cfg # This value works of the interval_length you specify later. If you leave # actual seconds rather than a multiple of the interval_length variable. interval_length=60
对于特殊服务,您需要在/usr/local/nagios/etc/objects/templates.cfg为其定义不同的模板:
define service{ name special-service ... max_check_attempts 3 normal_check_interval 20 retry_check_interval 3 notification_interval 60 ... }
注意:
normal_check_interval :这个服务在正常情况下每20分钟检查一次 retry_check_interval :在服务更改为非正常状态时,安排重新检查之前要等待的分钟数。 注意,如果服务已经重试了max_attempts时间而没有改变它的状态,它将恢复到以check_interval速率计划。 并使用此模板为您的服务:
define service{ use special-service host_name xx service_description yy check_command zz contact_groups admins }
您可能还需要定义一个服务升级,以根据服务状态更改notification_interval ,如下所示:
define serviceescalation{ host_name xx service_description yy last_notification 0 notification_interval 10 escalation_options [w,u,c] contact_groups admins }
这意味着当服务处于WARNING,UNKNOWN或CRITICAL状态时,将使用此服务升级。 而你现在有了一个新的通知间隔:10分钟。