Ad Widget

Collapse

API query for Host listing and status grabbing.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • psiquetp
    Junior Member
    • Jul 2014
    • 4

    #1

    API query for Host listing and status grabbing.

    Hi guys, first of all thank you for your help.

    So I got a basic requirement. I'm building a Java Swing app that displays a popup notification whenever a server is down.

    I'm able to retrieve the authentification token no problems whatsoever, and I think I'm also able to query the host.get for hostid. Here is my query and what is returned:

    {
    "jsonrpc": "2.0",
    "method": "host.get",
    "params": { "output": ["hostid"], "selectParentTemplates": [ "templateid", "name" ] },
    "auth": "7dc4d4850a00ee95e5aae9ae291c7999",
    "id": "5"
    }

    {"jsonrpc":"2.0","result":[{"parentTemplates":[],"hostid":"10051"},{"parentTemplates":[],"hostid":"10052"},{"parentTemplates":[],"hostid":"10054"},{"parentTemplates":[],"hostid":"10056"},{"parentTemplates":[],"hostid":"10017"},{"parentTemplates":[],"hostid":"10055"}],"id":"5"}

    I have played with the query but I just cannot get the list of names and the status.

    If anybody can help me. Please also find attached the current configuration I'm facing.
    Attached Files
  • ingus.vilnis
    Senior Member
    Zabbix Certified Trainer
    Zabbix Certified SpecialistZabbix Certified Professional
    • Mar 2014
    • 908

    #2
    Hello and welcome!

    I really can't advise you on Java and API programming issues, but aren't you satisfied with the built-in frontend messaging functions in Zabbix?


    Best Regards,
    Ingus

    Comment

    • psiquetp
      Junior Member
      • Jul 2014
      • 4

      #3
      Have a particular requirements set.

      Hi Ingus

      Thank you for your reply. Well you know, I don't need help with the Java part... but I can't really find the correct information using the API... maybe I can try parsing that front end you are showing... though I bet my boss prefers the API option.

      hopefully someone else can help.

      Thanks

      Comment

      Working...