nagios安装rabbitmq监控插件

post by rocdk890 / 2012-12-11 13:47 Tuesday linux技术
  老大要求我在测试服务器上安装nagios监控rabbitmq的插件,经过一天的研究终于搞定了,下文环境因为我把rabbitmq和nagios是安装在一台服务器上的,所以只给出链接,大家如果想自己测试的话,记得安装完.
  系统:centos 5.5
  需要的软件包:rpmforge-release-0.5.2-2.el5.rf.i386.rpm
               epel-release-5-4.noarch.rpm
               nagios-cn-3.2.3.tar.bz2
               nagios-plugins-1.4.15.tar.gz
               nrpe-2.12.tar.gz
               jdk-7u3-linux-i586.rpm
               simplejson-2.6.1.tar.gz
               otp_src_R15B01.tar.gz
               rabbitmq-server-2.8.5.tar.gz
1.安装前准备
yum -y install httpd php gcc glibc glibc-common gd gd-devel /
openssl openssl-devel bzip2 zlib-devel openssl-devel perl /
cpio expat-devel gettext-devel openssl zlib curl autoconf tk

2.安装git
安装git的话,请看这篇文章centos下两种方法安装git.

3.安装nagios
安装nagios的话,请看centos安装nagios服务端centos在被监控端安装nrpe.

4.安装rabbitmq
安装rabbitmq的话,请看centos安装RabbitMQ这篇文章.

5.安装nagios监控rabbitmq插件
git clone https://github.com/jamesc/nagios-plugins-rabbitmq.git
cd /root/nagios-plugins-rabbitmq/scripts
cp * /usr/local/nagios/libexec/
chmod -R 775 /usr/local/nagios/libexec/
chown -R nagios.nagios /usr/local/nagios/libexec/

rabbitmq-plugins list
[e] amqp_client                       0.0.0
[ ] cowboy                            0.5.0-rmq0.0.0-git4b93c2d
[ ] eldap                             0.0.0-gite309de4
[ ] erlando                           0.0.0
[e] mochiweb                          2.3.1-rmq0.0.0-gitd541e9a
[ ] rabbitmq_auth_backend_ldap        0.0.0
[ ] rabbitmq_auth_mechanism_ssl       0.0.0
[ ] rabbitmq_consistent_hash_exchange 0.0.0
[ ] rabbitmq_federation               0.0.0
[ ] rabbitmq_federation_management    0.0.0
[ ] rabbitmq_jsonrpc                  0.0.0
[ ] rabbitmq_jsonrpc_channel          0.0.0
[ ] rabbitmq_jsonrpc_channel_examples 0.0.0
[E] rabbitmq_management               0.0.0
[e] rabbitmq_management_agent         0.0.0
[ ] rabbitmq_management_visualiser    0.0.0
[e] rabbitmq_mochiweb                 0.0.0
[ ] rabbitmq_old_federation           0.0.0
[ ] rabbitmq_shovel                   0.0.0
[ ] rabbitmq_shovel_management        0.0.0
[ ] rabbitmq_stomp                    0.0.0
[ ] rabbitmq_tracing                  0.0.0
[ ] rabbitmq_web_stomp                0.0.0
[ ] rabbitmq_web_stomp_examples       0.0.0
[ ] rfc4627_jsonrpc                   0.0.0-gita5e7ad7
[ ] sockjs                            0.2.1-rmq0.0.0-gitd3b1a8b
[e] webmachine                        1.9.1-rmq0.0.0-git52e62bc

perl -MCPAN -e shell
cpan[1]> install JSON

如果安装了JSON之后还是报错的话,请去看解决Can't locate Nagios/Plugin.pm in @INC错误这篇文章.

6.验证
/usr/local/nagios/libexec/check_rabbitmq_server -H serverage
RABBITMQ_SERVER OK - Memory OK (2.58%) Process OK (0.02%) FD OK (0.04%) Sockets OK (0.00%) | Memory=2.58%;80;90 Process=0.02%;80;90 FD=0.04%;80;90 Sockets=0.00%;80;90

可以看到可以使用check_rabbitmq_server这些组件了.

7.commands.cfg配置
# 'check_rabbitmq_server' command definition
define command{
    command_name    check_rabbitmq_server
    command_line    $USER1$/check_rabbitmq_server -p $ARG1$ -H $ARG2$
    }

# 'check_rabbitmq_broker' command definition
define command{
        command_name    check_rabbitmq_broker
        command_line    $USER1$/check_rabbitmq_server -p $ARG1$ -H $HOSTNAME$
        }

# 'check_rabbitmq_aliveness' command definition
define command{
        command_name    check_rabbitmq_aliveness
        command_line    $USER1$/check_rabbitmq_aliveness -p $ARG1$ -H $HOSTADDRESS$
        }

# 'check_rabbitmq_objects' command definition
define command{
        command_name    check_rabbitmq_objects
        command_line    $USER1$/check_rabbitmq_objects -p $ARG1$ -H $HOSTADDRESS$
        }

# 'check_rabbitmq_overview' command definition
define command{
        command_name    check_rabbitmq_overview
        command_line    $USER1$/check_rabbitmq_overview -p $ARG1$ -H $HOSTADDRESS$
        }

# 'check_rabbitmq_queue' command definition
define command{
        command_name    check_rabbitmq_queue
        command_line    $USER1$/check_rabbitmq_queue -p $ARG1$ -H $HOSTADDRESS$
        }
好了,其他的nagios配置就不再多说了.
夜空- 本站版权
1、本站所有主题由该文章作者发表,该文章作者与夜空享有文章相关版权
2、其他单位或个人使用、转载或引用本文时必须同时征得该文章作者和夜空的同意
3、本帖部分内容转载自其它媒体,但并不代表本站赞同其观点和对其真实性负责
4、如本帖侵犯到任何版权问题,请立即告知本站,本站将及时予与删除并致以最深的歉意
5、原文链接:blog.slogra.com/post-296.html

标签: centos 监控 git 插件 rabbitmq nagios

  1. 2015-06-17 17:49
    @H:看来你没有认真看文章啊,可以直接到https://github.com/jamesc/nagios-plugins-rabbitmq.git这里去看说明的.
  1. 2015-06-17 17:48
    @H:Currently we have the following checks:

        check_rabbitmq_aliveness
            Use the /api/aliveness-test API to send/receive a message.

        check_rabbitmq_connections
            Use the /api/connections API to gather details of connections used, their state and their throughput

        check_rabbitmq_objects
            Use a variety of APIs to count instances of various objects on the server. These include vhosts, exchanges, bindings, queues and channels.

        check_rabbitmq_overview
            Use the /api/overview API to collect the number of pending, ready and unacknowledged messages on the server

        check_rabbitmq_partition
            Use the /api/nodes API to check for partitions in a RabbitMQ cluster.

        check_rabbitmq_queue
            Use the /api/queue API to collect the number of pending, ready and unacknowledged messages and the number of consumers on a given queue

        check_rabbitmq_server
            Use the /api/nodes API to gather resource usage of the rabbitmq server node

        check_rabbitmq_shovels
            Use the /api/nodes API check that all the shovels of the given RabbitMQ host are running

        check_rabbitmq_watermark
            Use the /api/nodes API to check to see if mem_alarm has been set to true

    See the relevant POD documentation/man pages for more information on usage.
  1. gravatar H
    2015-06-17 17:27
    请问这些监控项有没有说明文档
  1. 2013-10-30 15:50
    @零下一度:我不知道你是否有按照我文章上的去做,出现这样的问题,我估计有可能是你没有安装rabbitmq,当然前提是nagios和rabbitmq是在一台机器上的.
  1. gravatar 零下一度
    2013-10-29 18:51
    您好,看了这个文章以后,我在实验中遇到一个这样的问题:[root@mq02 ~]# /usr/local/nagios/libexec/check_rabbitmq_server -H mq02
    RABBITMQ_SERVER UNKNOWN - Access refused: nodes/rabbit@mq02
    不知道如何解决?

评论: