-
Notifications
You must be signed in to change notification settings - Fork 812
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add activemq_xml agent check #1227
Conversation
Thanks Brett! |
thanks remh right now it is only doing metrics for queues (since that is what we needed), but if you guys are going to accept I can also add in metrics for topics and subscribers |
self._process_data(data) | ||
|
||
def _fetch_data(self, url, username, password): | ||
passman = urllib2.HTTPPasswordMgrWithDefaultRealm() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you use the python-requests library instead ?
I know that in previous checks we use urllib2 but starting with Agent 5.x we bundle python requests which makes http calls easier to write and to read.
Thanks!
also have it uses requests library rather than urllib2
8d779ac
to
2699a0f
Compare
hey remh I changed to use requests instead of urllib2 and also added in metrics for topics and subscribers. we have this agent check running as-is in production now without any issues, except we do not have an subscriber data, so I have been unable to test that part fully. |
Thanks @brettlangdon ! |
What an outrage! TEST my code?! Yeah, ill see if I can get around to it today. I noticed before you guys
|
:) Travis would be the best if it's possible to setup if you can setup active mq on Travis. If not then unit test that would mock Activemq would be enough ! Thanks a lot ! |
doing this so we can more easily test methods which make use of the requests library
@remh I just pushed the unit tests for activemq_xml, would love a review. also, I hope you dont mind, I added |
Thanks @brettlangdon ! ======================================================================
ERROR: test_process_topics_data_normal (tests.test_activemq_xml.ActiveMQXMLTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/travis/build/DataDog/dd-agent/tests/test_activemq_xml.py", line 147, in test_process_topics_data_normal
check._process_topic_data(data)
File "/home/travis/build/DataDog/dd-agent/checks.d/activemq_xml.py", line 82, in _process_topic_data
for topic in root.iter("topic"):
AttributeError: _ElementInterface instance has no attribute 'iter' |
:( I'll take a look, thanks.
|
@remh all good, |
Thanks @brettlangdon ! |
I wrote a quick ActiveMQ agent check based on the xml queue status page, e.g.
http://user:pass@localhost:8161/admin/xml/queues.jsp
It will emit the following gauges for each queue with the tag
queue:<queue-name>
activemq.queue.consumer_count
activemq.queue.dequeue_count
activemq.queue.enqueue_count
activemq.queue.size
And an additional gauge
activemq.queues.count
which is the total count of queues.