nrpe使用一例

NRPE的作用是在远程主机上运行Nagios插件,以便监控远程主机。

Ubuntu Server下安装NRPE很方便:

$ sudo apt-get install nagios-nrpe-server nagios-plugins

默认的几个检查命令(check_users, check_load等)都已经在/etc/naigos/nrpe.cfg和/etc/nagios/nrpe_local.cfg配置好了。在Nagios里配置监控服务使用类似如下的监控命令就可以了:

check_command                   check_nrpe!check_load

如果需要自定义监控命令,只需在/etc/nagios/nrpe_local.cfg里设置,重启NRPE服务,再在Nagios里配置监控服务即可。比如,要添加一个监控TCP各种状态的命令,步骤如下:

@remotehost
$ cd /usr/lib/nagios/plugins
$ sudo wget http://www.tuschy.com/nagios/plugins/check_tcp_count
$ sudo chmod +x check_tcp_count
$ cd /etc/nagios
$ sudo vi nrpe_local.cfg
command[check_tcp_count]=/usr/lib/nagios/plugins/check_tcp_count
$ sudo service nagios-nrpe-server restart

@nagioshost
$ sudo vi remotehost.cfg
define service{
        use                                  generic-service
        host_name                      remotehostname
        service_description        Tcp count
        check_command            check_nrpe!check_tcp_count
}

Leave a Reply

Your email address will not be published. Required fields are marked *

*

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.
For more help see http://daringfireball.net/projects/markdown/syntax

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>