Ad Widget

Collapse

Java Gateway LLD Discovery

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jkhearsc
    Junior Member
    • Jan 2010
    • 1

    #1

    Java Gateway LLD Discovery

    I was looking at ZBXNEXT-1223 and did a little experimentation with jmx.discovery on a host. I noticed the gateway seems to return a JSON array of all JMX attributes but when it tries to send it back to the ZABBIX it fails.

    I was wondering if ZABBIX server is ready for the JSON array or not? Has anyone else tried it out?
    Last edited by jkhearsc; 29-11-2012, 01:24. Reason: Bad URL...oops
  • BDiE8VNy
    Senior Member
    • Apr 2010
    • 680

    #2
    First I was happy to come across the jmx.discovery key. I wanted to discover ActiveMQ destinations (what I currently do by LLD in combination with the ActiveMQ-CLI)

    Unfortunately the resulting JSON object hits the limitation of 64kb (by MAX_BUFFER_LEN) and can not be processed.

    See: ZBX-5863
    Maybe it's the same issue in Your case.

    Comment

    • danrog
      Senior Member
      • Sep 2009
      • 164

      #3
      @BDiE8VNy, could you share your script? I have to use the same workaround and I hate re-creating the wheel

      Comment

      • BDiE8VNy
        Senior Member
        • Apr 2010
        • 680

        #4
        I discover ActiveMQ destinations either by the activemq-admin cli or by a json file:

        Code:
        --- BEGIN /etc/zabbix/zabbix_agentd.d/userparameter_activemq.conf ---
        
        ### Parameter for monitoring ActiveMQresources
        UserParameter=activemq.queue.discovery.cli[*],/opt/apache-activemq/bin/activemq-admin query\ --jmxurl\ $1\ --jmxuser\ $2\ --jmxpassword\ $3\ -QQueue=\*\ --view\ BrokerName,Name | /bin/awk '$$1=="Name"||$$1=="BrokerName"{if(c==",")c="\n";else c=",";printf "\"{#"toupper($$1)"}\":\""$$3"\""c}' | /bin/awk 'BEGIN{printf "{\"data\":["};{printf c"{"$$0"}";c=","};END{print "]}"}'
        UserParameter=activemq.queue.discovery.file[*],/bin/cat $1
        
        --- END /etc/zabbix/zabbix_agentd.d/userparameter_activemq.conf ---
        Attached Files

        Comment

        • Yello
          Senior Member
          • Apr 2011
          • 309

          #5
          Hi,
          Can you show what the output should look like with this userparameter? I've been testing it against activemq 5.9.1 and the brokername doesn't seem to be returned. Seeing as the org.apache.activemq namespace has changed somewhat for this release I'm wondering if that is creating issues.


          Regards,
          David

          Comment

          • BDiE8VNy
            Senior Member
            • Apr 2010
            • 680

            #6
            Take a look at: User parameter one-liners. There is an example for the output.
            It's likely that the command has to be adjusted

            Comment

            • Yello
              Senior Member
              • Apr 2011
              • 309

              #7
              Hi,
              With activemq 5.9.x it seems that it does. The developers have made quite a few changes to the or.apache.activemq jmx namespace that mean when you query the queues with activemq-admin the brokername isn't returned. I haven't been able to work out how to return broker and queue name in a single query.

              So I have written a script to run two queries, merge them into a single json string and echo them back to the agent.

              Regards,
              David

              Comment

              • Yello
                Senior Member
                • Apr 2011
                • 309

                #8
                Hi,
                A bit more on this topic. You've done a lot more with lld than me and might know how to deal with this...

                What happens when a queue name has dots in it? I've tried escaping each dot with a slash on discovery but the items don't update. So am I right in thinking that queues with names like 'queue.name' cannot be auto discovered?

                I wonder how other people are handling that type of situation?


                Regards,
                David

                Comment

                • BDiE8VNy
                  Senior Member
                  • Apr 2010
                  • 680

                  #9
                  There is no need to escape dots.
                  Afaik escaping in item keys is only needed for '[', ']', ',' and '"'

                  Example item:
                  Code:
                  jmx["org.apache.activemq:BrokerName=localhost,Type=Queue,Destination=LOCAL.FOO.BAR.BAZ.PROCESS.ERROR",AverageEnqueueTime]
                  Edit:
                  Escaping in LLD value (JSON) should additionally be done regarding JSON syntax.
                  That can be easily validated by one of the available online validators like http://jsonlint.com/
                  Last edited by BDiE8VNy; 15-05-2014, 11:27.

                  Comment

                  • Yello
                    Senior Member
                    • Apr 2011
                    • 309

                    #10
                    Am trying to reply but the forum keeps claiming I have too many live links. I hope an admin can sort this out.

                    Regards,
                    David

                    Comment

                    Working...