2 new ActiveMQ monitoring scripts for Nagios (compatible monitoring systems)

I’ve recently written two new check-scripts for ActiveMQ. These nagios scripts will keep an eye out on ActiveMQ’s internal storage space and status of the queues.

Both scripts make use of activemq’s administrative web-interface (located at hostname:port/admin/ by default).

check_activemq_mem url warn crit

The url to use is the ‘print’ version, as that’s a lot simpler to parse. It can be found on http://hostname:port/admin/index.jsp?printable=true

Example output:

check_activemq_mem http://hostname:port/admin/index.jsp?printable=true 5 10
WARNING: ActiveMQ memory usage: 7/0/0 (store/memory/temp)

check_activemq_queues url

The url to use is http://hostname:port/admin/xml/queues.jsp
The configuration is done in the check_script itself. At the top there is a configuration block (perl hash) that looks like this:

my %config = (
        "ActiveMQ.DLQ"  => [
                        "* * * * *", "0" ],
        "sig-io.startJob" => [
                        "40-59 20 * * *", 5000,
                        "0-15 21 * * *", 5000,
                        "* * * * *", 100 ],
        "sig-io.finishJob" => [
                        "0-45 21 * * *", 5000,
                        "* * * * *", 100 ],
        "default"       => [ "* * * * *", "10" ],

In this config block, you can specify a number of crontab(5) like rules, all with a limit behind them. This limit will be checked against the number of items in the named queue, during the specified time-periods. If no rule is found that matches the current timeslot or matches the current Queue-name, the ‘default’ values will be used.

You can specify a limit value of 0 or a positive integer as a maximum amount of queue-items in the named queue. When this limit is passed, the script will go into warning or error state.

Specifying a limit of -1 signifies that this queue is to be completely ignored.

Example output:

check_activemq http://hostname:port/admin/xml/queues.jsp
OK: ActiveMQ: Everything reported OK (url)

10 comments to 2 new ActiveMQ monitoring scripts for Nagios (compatible monitoring systems)

  • Mike

    This is cool, thanks. Are they hosted on Nagios Exchange?

  • sig-io

    They are listed @ Nagios exchange as well, even before this post was made. But here I can provide some more background information.

  • Hi, there. Thanks for sharing this plug-in!

    CentOS users will need to run the following, perhaps more, depending on their systems:

    yum install perl-XML-Simple perl-DateTime-Event-ICal perl-DateTime perl-Set-Crontab perl-CPAN
    cpan Test::More
    cpan DateTime::Event::Cron

    I tested the above on CentOS 6.3.


  • Zach

    I am using your Activemq script (check_activemq_queues url) to monitor queues, but having difficulty to configure Command.cfg file in nagios. Could please explain how to configure ? thanks for your work.

    • sig-io

      Something like this…

      define service {
      service_description amq_queuestatus
      use some_template
      check_command check_activemq!http://host:8161/admin/xml/queues.jsp
      contact_groups some_group
      host_name hostname

      define command{
      command_name check_activemq
      command_line $USER1$/check_activemq $ARG1$

    • Zach

      thanks Sig-io to reply me that quickly. However i am able to configure the command.cfg but when i check the service status on nagios URL, it gives me this error (Service check did not exit properly). Try to find the solution on the internet but didn’t find that much help. Let me know if you have any suggestion.

    • Zach

      One more thing, I tried to change the time zone to (US/Central) like this, but didn’t work. Let me know if i have done anything wrong.

  • Zach

    Sig-io please ignore my above concerns. I have successfully fixed the (Service check did not exit properly) but now i am getting this error (**ePN /usr/lib/nagios/plugins/test_activemq: “File does not exist: at (eval 922) line 126”. ). I found the way to fix it from internet (# nagios: -epn) but it didnt work. Any idea ???

  • Naveen

    Hi Sig

    Iam getting below errors while executing through command line

    Use of uninitialized value $store in printf at ./ line 56.
    Use of uninitialized value $memory in printf at ./ line 56.
    Use of uninitialized value $temp in printf at ./ line 56.
    OK: ActiveMQ memory usage: 0/0/0 (store/memory/temp)