2

使用 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$"
      }
  }

}
4

1 回答 1

1

我可能已经在 monitoring-portal.org 上回答了这个问题,但也会在这里添加。

Icinga 不是生命周期管理工具,它主动确保您的系统处于指定状态,即包版本 => 最新。Icinga 用于监控这一事实并提醒负责该系统的人员。

您不应该以自动方式运行升级的原因 - 包更新有时需要数据迁移或服务重新启动。如果没有安排维护窗口(最好的例子:apache 和会话,或 mysql 服务器连接),这可能会损害您的运营业务。

将 Foreman 等管理工具与 Puppet、Ansible 结合使用。Katello 在包管理方面也可能很有趣。

https://www.theforeman.org

于 2017-06-17T10:20:03.557 回答