Code Monkey home page Code Monkey logo

check_activemq's Introduction

check_activeMQ

This repository provides a check that is able to query the Jolokia API of activeMQ services and provide detailed metrics.

Usage

usage: check_active_mq.py [-h] [--host HOST] [--port PORT] [-u USERNAME] [-p PASSWORD] --check CHECK [--broker BROKER] [-q QUEUE] [-c CRIT] [-w WARN]

optional arguments:
  -h, --help            show this help message and exit
  --host HOST           Host of the Apache-MQ REST service
  --port PORT           Port of the Apache-MQ REST service (default: 8161)
  -u USERNAME, --username USERNAME
                        Username to be used to login
  -p PASSWORD, --password PASSWORD
                        Password to be used to login
  --check CHECK         'health' or 'queue'. With 'queue' the '--queue' parameter is required
  --broker BROKER       Brokername used to determine which broker to check. Defaults to localhost
  -q QUEUE, --queue QUEUE
                        Queuename which is required
  -c CRIT, --crit CRIT  Critical Value for the Queuesize
  -w WARN, --warn WARN  Warning Value for the Queuesize

Example

check_active_mq.py --host $HOST -u $user -p $pass --check health

check_active_mq.py --host $HOST -u $user -p $pass --check queue --queue "ActiveMQ.DLQ" --warn 10 --crit 15

check_active_mq.py --host $HOST -u $user -p $pass --check queue --queue "*"

Queue

usage: check_active_mq.py queue [-h] [-b BROKER] -q QUEUE [-c CRIT] [-w WARN]

optional arguments:

  -h, --help            show this help message and exit

  -b BROKER, --broker BROKER Brokername used to determine which broker to check. Defaults to localhost

  -q QUEUE, --queue QUEUE Queuename which is needed

  -c CRIT, --crit CRIT  Critical Value for the Queuesize

  -w WARN, --warn WARN  Warning Value for the Queuesize

Health

usage: check_active_mq.py health [-h] [-b BROKER]

optional arguments:

  -h, --help            show this help message and exit

  -b BROKER, --broker BROKER Brokername used to determine which broker to check. Defaults to localhost

check_activemq's People

Contributors

kevinhonka avatar bodsch avatar

Stargazers

Carsten avatar

Watchers

Carsten avatar  avatar

check_activemq's Issues

reduce traceback and use nicer errorhandling

19:57 $ ./check_active_mq.py --host localhost health
Traceback (most recent call last):
  File "./check_active_mq.py", line 202, in query_amq
    req = requests.get(url, auth=auth)
  File "/usr/lib64/python3.6/site-packages/requests/api.py", line 72, in get
    return request('get', url, params=params, **kwargs)
  File "/usr/lib64/python3.6/site-packages/requests/api.py", line 58, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/lib64/python3.6/site-packages/requests/sessions.py", line 508, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/lib64/python3.6/site-packages/requests/sessions.py", line 612, in send
    adapter = self.get_adapter(url=request.url)
  File "/usr/lib64/python3.6/site-packages/requests/sessions.py", line 703, in get_adapter
    raise InvalidSchema("No connection adapters were found for '%s'" % url)
requests.exceptions.InvalidSchema: No connection adapters were found for 'localhostread/org.apache.activemq:type=Broker,brokerName=localhost'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./check_active_mq.py", line 250, in <module>
    check.get_health_status(args.broker)
  File "./check_active_mq.py", line 84, in get_health_status
    data = self.query_amq(self.host + amq_path, auth=(self.user, self.password))
  File "./check_active_mq.py", line 209, in query_amq
    self.log.error("Apache-MQ - CRITICAL {}".format(ex.message))
AttributeError: 'InvalidSchema' object has no attribute 'message'

The correct access should be this link:

curl -uadmin:admin http://localhost:8161/api/jolokia/read/org.apache.activemq:type=Broker,brokerName=localhost

{"request":{"mbean":"org.apache.activemq:brokerName=localhost,type=Broker","type":"read"},"value":{"StatisticsEnabled":true,"TemporaryQueueSubscribers":[],"TotalConnectionsCount":0,"TotalMessageCount":0,"TempPercentUsage":0,"MemoryPercentUsage":0,"TransportConnectors":{"openwire":"tcp:\/\/activemq:61616?maximumConnections=1000&wireFormat.maxFrameSize=104857600","amqp":"amqp:\/\/activemq:5672?maximumConnections=1000&wireFormat.maxFrameSize=104857600","mqtt":"mqtt:\/\/activemq:1883?maximumConnections=1000&wireFormat.maxFrameSize=104857600","stomp":"stomp:\/\/activemq:61613?maximumConnections=1000&wireFormat.maxFrameSize=104857600","ws":"ws:\/\/activemq:61614?maximumConnections=1000&wireFormat.maxFrameSize=104857600"},"InactiveDurableTopicSubscribers":[],"StoreLimit":19354390600,"TotalProducerCount":0,"TopicProducers":[],"CurrentConnectionsCount":0,"QueueProducers":[],"JMSJobScheduler":null,"VMURL":"vm:\/\/localhost","UptimeMillis":1792590,"TemporaryTopicProducers":[],"TemporaryQueueProducers":[],"TotalDequeueCount":0,"Topics":[{"objectName":"org.apache.activemq:brokerName=localhost,destinationName=ActiveMQ.Advisory.MasterBroker,destinationType=Topic,type=Broker"}],"DurableTopicSubscribers":[],"JobSchedulerStorePercentUsage":0,"Uptime":"29 minutes","QueueSubscribers":[],"BrokerId":"ID:activemq-35791-1540489411700-0:1","AverageMessageSize":1024,"DataDirectory":"\/opt\/apache-activemq-5.15.6\/data","Persistent":true,"TopicSubscribers":[],"BrokerVersion":"5.15.6","TemporaryQueues":[],"BrokerName":"localhost","MinMessageSize":1024,"MemoryLimit":668309914,"Slave":false,"DynamicDestinationProducers":[],"TotalEnqueueCount":1,"TempLimit":19354378240,"TemporaryTopicSubscribers":[],"TemporaryTopics":[],"JobSchedulerStoreLimit":0,"Queues":[],"TotalConsumerCount":0,"StorePercentUsage":0,"MaxMessageSize":1024},"timestamp":1540491203,"status":200}

I think, the /api/jolokia part is missing in your code?

Okay, after more reverse engineering it works.

20:18 $ ./check_active_mq.py --host "http://localhost:8161/api/jolokia/" health
Apache-MQ - OK
 Uptime: 35 minutes
 BrokerVersion: 5.15.6
 Store Usage in %: 0
 Memory Usage in %: 0
 Total Connections: 0
 Total Dequeue Count: 0
 Total Enqueue Count: 1
 | Store Usage=0;;;;100 Memory Usage=0;;;;100 Uptime=35 minutes;;;; Total Dequeue Count=0;;;; Total Enqueue Count=1;;;;

but the compilation of the URI is not yet error-free enough.
e.g. http://localhost:8161/api/jolokia/ vs. http://localhost:8161/api/jolokia

Check not work after update to activemq 5.15.12

Describe the bug
After Update from activemq to 5.15.12 the check not work

To Reproduce
Update activemq from 5.15.11 to 5.15.12

Check Output
# /usr/lib64/nagios/plugins/check_activemq health Traceback (most recent call last): File "/usr/lib64/nagios/plugins/check_activemq", line 320, in <module> check.get_health_status(args.broker) File "/usr/lib64/nagios/plugins/check_activemq", line 130, in get_health_status "Uptime": data['value']['Uptime'], KeyError: 'value'
Desktop:

  • OS: centOS7
  • Browser firefox
  • Check-Version: 1.0

Additional context
The cause of the problem is an update from jolokia.
wit curl i can use the option -H "Origin: http://localhost:8161" to access jolokia api.

missing requirements

Describe the bug
i miss an requirements.txt to install all needed python packages.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.