Ad Widget

Collapse

Pulling Zabbix Data to Cherwell via API randomly misses hosts that are in the DB

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • stelees
    Junior Member
    • Nov 2020
    • 1

    #1

    Pulling Zabbix Data to Cherwell via API randomly misses hosts that are in the DB

    Hey there,
    Per the subject, we have a bit of a head scratcher here. I have a call from Cherwell to Zabbix to pull in certain host information to populate in the Cherwell CMDB. This process runs almost flawlessly but it just misses hosts, for example if it runs against a subset of 20 hosts and all 20 are confirmed in Zabbix, it will just not pull info back for 3 or 4 of them.

    For every host I successfully can pull back the authkey, regardless of it the results after that are populated, so that is constant.

    The webservice calls to this location
    https://<our URL>/zabbix/api_jsonrpc.php

    Code:
    {
    "params": {
    "filter": {
    "host": "<host name variable here>",
    "name": [
    "Memory Total",
    "GPU Name",
    "Processor Count",
    "Host Manufacturer",
    "Operating System information",
    "Host name"
    ]
    },
    "output": [
    "lastvalue"
    ],
    "sortfield": "name"
    },
    "jsonrpc": "2.0",
    "method": "item.get",
    "auth": "<Zabbix Auth Variable here>,
    "id": 1
    }
    The results come back as JSON, I parse it and write it to the relevant fields.

    But, as I said, it isn't consistent and we can't figure out why. I have a specific query of hosts that I am testing this with, all appearing in Zabbix and from the 10 hosts, 8 only ever are returning information. We deleted one of the hosts from Zabbix, it was rediscovered so then I ran my process again, 8 returns, 2 misses including the newly rediscovered one.

    The process is efficient as it wouldn't work for any of them, so I am wondering what may be different in Zabbix.

    Are there any suggestions on what I should look at in relation to the host records in Zabbix to see if there is something that jumps out as to why I wouldn't be able to retrieve the information via the API call when it works 'most' of the time.

    Thanks.
  • hunter-360
    Junior Member
    • Dec 2020
    • 1

    #2
    I had a similar issue pulling from the API. Go to your users and check to make sure that the account using the API has access to the Host Group that the Host you are missing is in, hope this helps.

    Comment

    • LenR
      Senior Member
      • Sep 2009
      • 1005

      #3
      I had an API problem that ended up being the use of "host" vs. "name". It didn't matter until someone added a visible name to a host.

      Comment

      Working...