Search code examples
jsonhivejmxzabbix

Http request with jmx


Good afternoon! I try to get data from apache hive in JSON by zabbix http-agent and it works. But I have unpleasant situation, JSON data have more than 180000 chars. This is a problem, because MYSQL field has just 65535 max chars (my performance, I no want to change it). In this way JSON data in MYSQL field isn't valid (incomplete).

I found, as I think, a solution - it's http request with parameters. For example:

http://localhost:port/jmx                      - full JSON data
?qry=Hadoop:service=NameNode,name=NameNodeInfo - data which I need
http://localhost:port/jmx?qry=Hadoop:service=NameNode,name=NameNodeInfo - full request

I made zabbix template and zabbix item. Item has next options:

Type: http-agent
URL: http://{HOST.CONN}:10010/jmx?qry=metrics:name=api_runTasks
Type of information: text

I get incomplete JSON data in zabbix "latest data" with next url: http://localhost:port/jmx

I get empty JSON data with next url: http://{HOST.CONN}:10010/jmx?qry=metrics:name=api_runTasks

I was trying to tune zabbix agent with query field where name field is qry and value field is metrics:name=api_runTasks (I was trying many of combinations and was getting just two messages in zabbix history of latest data there are):

{"body":{ "beans" : [ ] }} or
{ } or
full incomplete JSON data

Solution

  • Zabbix item needs to have next options:

    URL: http://{HOST.CONN}:10010/jmx
    

    Query fields:

    name: qry
    value: metrics:name=api_compile
    

    Hive 2.0 have by default two enabled ways to log metrics, there are JMX and JSON file /tmp/report.json