大网数据广告活动
服务器运维问答

How to make a persistent acknowledgment in Icinga/Nagios?

· 52CE 我爱测

I am using Icinga (Nagios fork) to also monitor uptime of external hosts and services. Currently when looking at the "Critical" count I find it difficult to decide if an internal service is affected (I should take immediate actio…

问题原文

原帖链接 · blerontin · CC BY-SA 3.0

I am using Icinga (Nagios fork) to also monitor uptime of external hosts and services. Currently when looking at the "Critical" count I find it difficult to decide if an internal service is affected (I should take immediate action) or an external service (I just acknowledge the problem).

Is there a way to keep a problem acknowledgement for future down-times of the checked host/service? Is there some way to auto-acknowledge the state change of external hosts/services?

已采纳解答

原帖链接 · blerontin · CC BY-SA 3.0

Have found out how to do auto-acknowledges for external hosts.

First define an event handler for the external host:

define host {
        name            some-external-server
        # ...
        event_handler   handle_external_host
        # ...
}

Then define the command to be used as the event handler:

define command {
        command_name    handle_external_host
        command_line    $USER1$/eventhandlers/acknowledge_host_problem $HOSTNAME$ icingaadmin "Handled by external user"
}

Finally put the event handler script into file /usr/local/icinga/libexec/eventhandlers/acknowledge_host_problem (or where your event handers are installed):

#!/bin/sh

printf_cmd="/usr/bin/printf"
command_file="/usr/local/icinga/var/rw/icinga.cmd"

hostname="$1"
author="$2"
comment="$3"

# get the current date/time in seconds since UNIX epoch
now=`date +%s`

# pipe the command to the command file
$printf_cmd "[%lu] ACKNOWLEDGE_HOST_PROBLEM;%s;1;1;0;%s;%s\n" $now "$hostname" "$author" "$comment" >> $command_file

Don't forget to make the script executable using command "chmod +x" or similar. For details on ACKNOWLEDGE_HOST_PROBLEM see the Icinga documentation.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2013-10-02)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。