使用 icinga's (nagios'?) apt CheckCommand如果有可用的软件包更新,我会收到警告。我注意到apt CheckCommand中还有一个--upgrade
参数。
是否可以apt-get upgrade
使用 icinga2 在远程主机上执行?如果是,那将是什么方法?我不希望包升级完全自动完成,而是使用 icinga 按需执行所有主机的升级。
apt CheckCommand(脚本)如下所示:
object CheckCommand "apt" {
import "plugin-check-command"
command = [ PluginDir + "/check_apt" ]
timeout = 5m
arguments += {
"--critical" = {
description = "If the full package information of any of the upgradable packages match this REGEXP, the plugin will return CRITICAL status. Can be specified multiple times."
value = "$apt_critical$"
}
"--dist-upgrade" = {
description = "Perform a dist-upgrade instead of normal upgrade. Like with -U OPTS can be provided to override the default options."
value = "$apt_dist_upgrade$"
}
"--exclude" = {
description = "Exclude packages matching REGEXP from the list of packages that would otherwise be included. Can be specified multiple times."
value = "$apt_exclude$"
}
"--extra-opts" = {
description = "Read options from an ini file."
value = "$apt_extra_opts$"
}
"--include" = {
description = "Include only packages matching REGEXP. Can be specified multiple times the values will be combined together."
value = "$apt_include$"
}
"--timeout" = {
description = "Seconds before plugin times out (default: 10)."
value = "$apt_timeout$"
}
"--upgrade" = {
description = "[Default] Perform an upgrade. If an optional OPTS argument is provided, apt-get will be run with these command line options instead of the default."
value = "$apt_upgrade$"
}
}
}