activemq-nagios-plugin icon indicating copy to clipboard operation
activemq-nagios-plugin copied to clipboard

RuntimeError: ('label contains illegal characters', "Getting Queue(s) FAILED: 'value'")

Open lremes opened this issue 9 years ago • 8 comments

I'm evaluting the plugin on Centos7 and with ActiveMQ 5.12.0. AMQ is running at localhost:8161.

I get the following error running the examples:

# ./check_activemq.py queuesize
ACTIVEMQQUEUESIZE UNKNOWN: RuntimeError: ('label contains illegal characters', "Getting Queue(s) FAILED: 'value'")
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/nagiosplugin/runtime.py", line 38, in wrapper
    return func(*args, **kwds)
  File "./check_activemq.py", line 541, in main
    args.func(args)
  File "./check_activemq.py", line 116, in queuesize
    ActiveMqQueueSizeSummary()
  File "/usr/lib/python2.7/site-packages/nagiosplugin/check.py", line 115, in main
    runtime.execute(self, verbose, timeout)
  File "/usr/lib/python2.7/site-packages/nagiosplugin/runtime.py", line 118, in execute
    with_timeout(self.timeout, self.run, check)
  File "/usr/lib/python2.7/site-packages/nagiosplugin/platform/posix.py", line 19, in with_timeout
    func(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/nagiosplugin/runtime.py", line 107, in run
    check()
  File "/usr/lib/python2.7/site-packages/nagiosplugin/check.py", line 100, in __call__
    self._evaluate_resource(resource)
  File "/usr/lib/python2.7/site-packages/nagiosplugin/check.py", line 86, in _evaluate_resource
    self.perfdata.append(str(metric.performance() or ''))
  File "/usr/lib/python2.7/site-packages/nagiosplugin/metric.py", line 104, in performance
    return self.contextobj.performance(self, self.resource)
  File "/usr/lib/python2.7/site-packages/nagiosplugin/context.py", line 156, in performance
    metric.min, metric.max)
  File "/usr/lib/python2.7/site-packages/nagiosplugin/performance.py", line 49, in __new__
    raise RuntimeError('label contains illegal characters', label)
RuntimeError: ('label contains illegal characters', "Getting Queue(s) FAILED: 'value'")

Even the most basic check does not work:

# ./check_activemq.py health
ACTIVEMQHEALTH UNKNOWN - ERROR: Getting Values FAILED: 'value'
unknown: ERROR: Getting Values FAILED: 'value'

I've tried with both nagiosplugin 1.2.2 and 1.2.3 and Python is 2.7.5

Any tips how to fix this?

lremes avatar Jan 22 '16 08:01 lremes

First time I see this error, it seems to be thrown HERE. The underlying problem it that this call

loadJson(make_url(args, queue['objectName']))

in line 79 of the activemq-nagios-pugin returns a dictionary which doesn't have a key named 'value'.

As this problem never occured in my tests, could you subsitute line 79 with

qJ1 = loadJson(make_url(args, queue['objectName']))
print(qJ1)
qJ = qJ1['value']

and paste me the results.

r41d avatar Jan 22 '16 15:01 r41d

It seems the error has something to do with invalid AMQ url. When I changed the PREFIX to "localhost:", things started working. So this works:

http://admin:admin@localhost:8161/api/jolokia/read/localhost:type=Broker,brokerName=localhost,service=Health

lremes avatar Jan 25 '16 07:01 lremes

any chances of a fix being pushed out for this?

abertram-bim avatar Feb 02 '17 19:02 abertram-bim

Hello: I am also having this very issue and I'm here to provide more details, hoping it can lead to a solution.

I've used this plugin for a year with no issues (thanks). I monitor a few master-slave, two-node, ActiveMQ clusters with shared NFS kahaDB file system. Last week, we implemented a change on our ActiveMQ configuration and started having this issue. Basically, we enabled scheduler on our ActiveMQ cluster by making this change on activemq.xml configuration file for each member of the cluster ...

From this -> <broker xmlns="http://activemq.apache.org/schema/core" brokerName="localhost" dataDirectory="${activemq.data}/localhost">

To this -> <broker xmlns="http://activemq.apache.org/schema/core" brokerName="<hostname>" dataDirectory="${activemq.data}/<hostname>" schedulerSupport="true">

Clusters were restarted and verified with scheduling support for queues, but Nagios monitoring via 'check_activemq.py' stopped working...

I'm getting this now ->

/root/check_activemq.py --host <cluster_node1> --port 8161 --user admin --pwd <password> health ACTIVEMQHEALTH UNKNOWN - ERROR: Getting Values FAILED: 'value' unknown: ERROR: Getting Values FAILED: 'value'

mengano-net avatar May 22 '17 19:05 mengano-net

Never had this issue, could you replace this

status = loadJson(health_url(args))['value']['CurrentStatus']

in the health test with

print("args:", args)
s1 = loadJson(health_url(args))
print("s1:", s1)
status = s1['value']['CurrentStatus']
print("status:", status)

and paste the output somewhere.

r41d avatar May 22 '17 20:05 r41d

Thanks for taking a look, here is the output

[14:14:34] [root@sirvmon01:~]# /root/check_activemq.py --host slatmqtst01.bmslat --port 8161 --user admin --pwd admin health ('args:', Namespace(func=<function health at 0x24477d0>, host='slatmqtst01.bmslat', jolokia_url=None, port=8161, pwd='admin', url_tail='api/jolokia/read', user='admin')) ('s1:', {u'status': 404, u'stacktrace': u'javax.management.InstanceNotFoundException: org.apache.activemq:type=Broker,brokerName=localhost,service=Health\n\tat com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getMBean(DefaultMBeanServerInterceptor.java:1095)\n\tat com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getMBeanInfo(DefaultMBeanServerInterceptor.java:1375)\n\tat com.sun.jmx.mbeanserver.JmxMBeanServer.getMBeanInfo(JmxMBeanServer.java:920)\n\tat org.jolokia.handler.ReadHandler$1.execute(ReadHandler.java:46)\n\tat org.jolokia.handler.ReadHandler$1.execute(ReadHandler.java:41)\n\tat org.jolokia.backend.executor.AbstractMBeanServerExecutor.call(AbstractMBeanServerExecutor.java:90)\n\tat org.jolokia.handler.ReadHandler.getMBeanInfo(ReadHandler.java:229)\n\tat org.jolokia.handler.ReadHandler.getAllAttributesNames(ReadHandler.java:241)\n\tat org.jolokia.handler.ReadHandler.resolveAttributes(ReadHandler.java:217)\n\tat org.jolokia.handler.ReadHandler.fetchAttributes(ReadHandler.java:183)\n\tat org.jolokia.handler.ReadHandler.doHandleRequest(ReadHandler.java:118)\n\tat org.jolokia.handler.ReadHandler.doHandleRequest(ReadHandler.java:37)\n\tat org.jolokia.handler.JsonRequestHandler.handleRequest(JsonRequestHandler.java:161)\n\tat org.jolokia.backend.MBeanServerHandler.dispatchRequest(MBeanServerHandler.java:154)\n\tat org.jolokia.backend.LocalRequestDispatcher.dispatchRequest(LocalRequestDispatcher.java:99)\n\tat org.jolokia.backend.BackendManager.callRequestDispatcher(BackendManager.java:411)\n\tat org.jolokia.backend.BackendManager.handleRequest(BackendManager.java:158)\n\tat org.jolokia.http.HttpRequestHandler.executeRequest(HttpRequestHandler.java:197)\n\tat org.jolokia.http.HttpRequestHandler.handleGetRequest(HttpRequestHandler.java:86)\n\tat org.jolokia.http.AgentServlet$4.handleRequest(AgentServlet.java:430)\n\tat org.jolokia.http.AgentServlet.handleSecurely(AgentServlet.java:313)\n\tat org.jolokia.http.AgentServlet.handle(AgentServlet.java:284)\n\tat org.jolokia.http.AgentServlet.doGet(AgentServlet.java:245)\n\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:622)\n\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:729)\n\tat org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:808)\n\tat org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:587)\n\tat org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)\n\tat org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:542)\n\tat org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)\n\tat org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)\n\tat org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)\n\tat org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)\n\tat org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)\n\tat org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)\n\tat org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:110)\n\tat org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:542)\n\tat org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:110)\n\tat org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)\n\tat org.eclipse.jetty.server.Server.handle(Server.java:499)\n\tat org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)\n\tat org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)\n\tat org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)\n\tat org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)\n\tat org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)\n\tat java.lang.Thread.run(Thread.java:745)\n', u'error_type': u'javax.management.InstanceNotFoundException', u'request': {u'type': u'read', u'mbean': u'org.apache.activemq:brokerName=localhost,service=Health,type=Broker'}, u'error': u'javax.management.InstanceNotFoundException : org.apache.activemq:type=Broker,brokerName=localhost,service=Health'}) ACTIVEMQHEALTH UNKNOWN - ERROR: Getting Values FAILED: 'value' unknown: ERROR: Getting Values FAILED: 'value' [14:14:46] [root@sirvmon01:~]#

mengano-net avatar May 22 '17 21:05 mengano-net

By changing the brokername the JMX URI also changes. Then a query for:

org.apache.activemq:type=Broker,brokerName=localhost,service=Health

fails. Have you tried to set the brokername using:

--brokerName <<Brokername>>

?

predic8 avatar May 24 '17 07:05 predic8

Yup, that was it. I'd be awesome if you could put this as a parameter to script; if not specified, then default to 'localhost'. For now, I've added it as a variable that can be specified on demand 👍

[13:01:39] [root@sirvmon01:/etc/nagios]# /root/check_activemq.py --host slatmqtst01.bmslat --port 8161 --user admin --pwd *** health
('args:', Namespace(func=<function health at 0x15997d0>, host='slatmqtst01.bmslat', jolokia_url=None, port=8161, pwd='***', url_tail='api/jolokia/read', user='admin'))
('s1:', {u'status': 200, u'timestamp': 1496260903, u'request': {u'type': u'read', u'mbean': u'org.apache.activemq:brokerName=slatmqtst01,service=Health,type=Broker'}, u'value': {u'CurrentStatus': u'Good'}})
('status:', u'Good')
ACTIVEMQHEALTH OK - CurrentStatus Good
[13:01:43] [root@sirvmon01:/etc/nagios]# 

mengano-net avatar May 31 '17 20:05 mengano-net