Skip to content
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

Merged
merged 8 commits into from
Jan 13, 2015
Merged

Conversation

brettlangdon
Copy link
Member

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.

@remh
Copy link
Contributor

remh commented Dec 3, 2014

Thanks Brett!
It looks interesting, we are going to review it and we aim at releasing for 5.2.0

@remh remh added the 1 - Ready label Dec 3, 2014
@remh remh added this to the 5.2.0 milestone Dec 3, 2014
@brettlangdon
Copy link
Member Author

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

@remh remh self-assigned this Dec 10, 2014
self._process_data(data)

def _fetch_data(self, url, username, password):
passman = urllib2.HTTPPasswordMgrWithDefaultRealm()
Copy link
Contributor

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!

@brettlangdon
Copy link
Member Author

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.

@remh
Copy link
Contributor

remh commented Dec 31, 2014

Thanks @brettlangdon !
Last thing, would it be possible to add a travis test for it ?

@brettlangdon
Copy link
Member Author

What an outrage! TEST my code?!

Yeah, ill see if I can get around to it today. I noticed before you guys
have some integration tests in Travis? Is that what you are after or just
unit tests?
On Dec 31, 2014 5:34 AM, "Remi Hakim" notifications@github.com wrote:

Thanks @brettlangdon https://github.com/brettlangdon !
Last thing, would it be possible to add a travis test for it ?


Reply to this email directly or view it on GitHub
#1227 (comment).

@remh
Copy link
Contributor

remh commented Dec 31, 2014

:) 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 !

@brettlangdon
Copy link
Member Author

@remh I just pushed the unit tests for activemq_xml, would love a review.

also, I hope you dont mind, I added mock==1.0.1 as a requirement to test-requirements.txt.

@remh
Copy link
Contributor

remh commented Jan 13, 2015

Thanks @brettlangdon !
It looks like your tests are failing on

======================================================================
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'

@brettlangdon
Copy link
Member Author

:(

I'll take a look, thanks.
On Jan 12, 2015 8:45 PM, "Remi Hakim" notifications@github.com wrote:

Thanks @brettlangdon https://github.com/brettlangdon !
It looks like your tests are failing on

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'


Reply to this email directly or view it on GitHub
#1227 (comment).

@brettlangdon
Copy link
Member Author

@remh all good, .iter isn't supported in 2.6

@remh
Copy link
Contributor

remh commented Jan 13, 2015

Thanks @brettlangdon !

remh added a commit that referenced this pull request Jan 13, 2015
@remh remh merged commit 313b21e into DataDog:master Jan 13, 2015
@brettlangdon brettlangdon deleted the activemq-xml-check branch March 13, 2015 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants