我使用 nagios 来警告我的 Debian buster 服务器上是否有可用的 apt 更新,但我想使用此选项:
-o, --only-critical
Only warn about upgrades matching the critical list. The total number
of upgrades will be printed, but any non-critical upgrades will not cause
the plugin to return WARNING status.
所以我编辑了/etc/nagios-plugins/config/apt.cfg
:
# 'check_apt' command definition
define command{
command_name check_apt
command_line /usr/lib/nagios/plugins/check_apt --only-critical
}
# 'check_apt_distupgrade' command definition
define command{
command_name check_apt_distupgrade
command_line /usr/lib/nagios/plugins/check_apt --only-critical -d
}
但我仍然收到包含以下内容的电子邮件:
***** Service Monitoring on freifunk *****
apt on vm02.freifunk is WARNING!
Info: APT WARNING: 2 packages available for upgrade (0 critical updates).
虽然我已经安装了monitoring-plugins-basic
2.2-6 并且--only-critical
添加了该选项,但release-2.3.3
它已经可以工作了:
# /usr/lib/nagios/plugins/check_apt
APT WARNING: 2 packages available for upgrade (0 critical updates). |available_upgrades=2;;;0 critical_updates=0;;;0
# /usr/lib/nagios/plugins/check_apt --only-critical
APT OK: 2 packages available for upgrade (0 critical updates). |available_upgrades=2;;;0 critical_updates=0;;;0
但我在 nagios 配置中设置的命令选项似乎被忽略了。
我还尝试了手动安装的最新版本这个来源,但这并没有改变结果。也许还有另一种方法可以实现这一目标?也许只是将 command_line 中的行更改为某种东西,以某种方式 grep 结果?
看起来 nagios 插件是由icinga2
.这是以下内容的一部分/etc/icinga2/constants.conf
:
/* The directory which contains the plugins from the Monitoring Plugins project. */
const PluginDir = "/usr/lib/nagios/plugins"
如何正确告诉 nagios 不要对非关键更新发出警告?