【问题标题】:Monitor unix process with Nagios Core使用 Nagios Core 监控 unix 进程
【发布时间】:2019-07-11 09:01:52
【问题描述】:

我是 Nagios 的初学者,我正在尝试监视我的 unix 机器上的特定进程是否启动。 服务器和客户端在同一台机器上:试图从运行在其上的 Nagios 监控该机器。 我已经安装了 Nagios Core 4、nrpe 和它的插件。在网上查看后,我找到了如何使用 check_procs 插件(向上或向下)监视进程的答案,这就是我在文件中实际拥有的内容:

1- 在 /etc/nagios/nrpe.cfg

server_address=127.0.0.1
command[check_service]=/usr/lib/nagios/plugins/check_procs -c 1: -C $ARG1$

2- 我在 /usr/local/nagios/etc/servers/ 中创建了一个名为“ubunutu_host.cfg”的文件:

# Ubuntu Host configuration file
    define host {
            use                          linux-server
            host_name                    ubuntu_host
            alias                        Ubuntu Host
            address                      127.0.0.1
            register                     1
    }


    define service {
          host_name                       ubuntu_host
          service_description             check_apache2
          check_command                   check_service!apache2
          max_check_attempts              2
          check_interval                  2
          retry_interval                  2
          check_period                    24x7
          check_freshness                 1
          contact_groups                  admins
          notification_interval           2
          notification_period             24x7
          notifications_enabled           1
          register                        1
    }

3- 在 /etc/nagios-plugins/configp/rocs.cfg 中:

define command{
command_name check_service
command_line /usr/lib/nagios/plugins/check_procs -c 1: -C ‘$ARG1$’
}

我的问题是: 运行此命令时:

/usr/lib/nagios/plugins/check_procs -c 1: -C apache2

这就是我的结果

PROCS OK: 7 processes with command name 'apache2' | procs=7;;1:;0;

但是在 Nagios 中,低于我所拥有的(apache2 总是很关键): Problem proc apache2 is always shown critical

【问题讨论】:

  • 帮助大家!谢谢
  • serverfault.comaskubuntu.com 是解决这个问题的更好的论坛。 StackOverflow 用于编程问题,而 ServerFault 涵盖管理问题,AskUbuntu 涵盖一般问题。
  • 尝试以 Nagios 用户身份运行此命令 /usr/lib/nagios/plugins/check_procs -c 1: -C apache2 并尝试将 ‘$ARG1$’ 替换为 "$ARG1$",以防万一……

标签: ubuntu apache2 monitoring nagios nrpe


【解决方案1】:

首先,NRPE 用于发出和接收远程插件调用。您没有指定要在哪个服务器上修改/etc/nagios/nrpe.cfg,但您的检查命令是/usr/lib/nagios/plugins/check_procs,这意味着 Nagios 正在本地运行此插件,也许这就是您想要的,我不知道不知道,但在那种情况下,根本没有涉及 NRPE 的意义。

既然你提到你在“运行”命令时得到了你想要的输出(你没有指定是什么用户):

/usr/lib/nagios/plugins/check_procs -c 1: -C apache2

我猜你运行它的用户实际上可以看到你的apache2 进程,而运行实际 Nagios 检查的用户不能。尝试使用su 更改为您的 Nagios 用户,看看输出是否有差异。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-02-18
    • 1970-01-01
    相关资源
    最近更新 更多