Ad Widget

Collapse

Get host availibility through API

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • eitan
    Junior Member
    • Jan 2022
    • 2

    #1

    Get host availibility through API

    Hi, I'm new here and learning zabbix for the first time. My client wants to use Zabbix server and send the monitored items through Zabbix API to an app I'm building.
    So here is my question - can I get a Host "availability" status (the field that lets you see if the host is currently connected to the server) through the API?
    I haven't found it in the documentation. I also sent a "host.get" method and tried to check the entire object in order to find something that looks like a field that sends me the info, but found nothing.
    Thanks!
    Last edited by eitan; 25-01-2022, 09:09.
  • Semiadmin
    Senior Member
    • Oct 2014
    • 1625

    #2
    Hi!
    I suppose you need a hostinterface.get method, property "available" of the host interface object

    Comment

    • eitan
      Junior Member
      • Jan 2022
      • 2

      #3
      Thanks! that's indeed what I was looking for.

      Comment

      • Harish Munagapati
        Junior Member
        • Jun 2023
        • 3

        #4
        Here is an option tested on Zabbix 6.0

        This will list the hosts with "unavailable" status mean you availability status on the host is in grey

        Output : Hostname and host id

        {
        "jsonrpc": "2.0",
        "method": "host.get",
        "params": {
        "output": [
        "hostid",
        "host"
        ],
        "filter": {
        "available": [
        "0"
        ]
        }
        },
        "id": 2,
        "auth": "apitoken"
        }

        Availability details are available under Interfaces, the below parameters helps query information information for all the hosts.

        {
        "jsonrpc": "2.0",
        "method": "host.get",
        "params": {
        "output": "extend",
        "selectInterfaces": "extend"
        },
        "id": 2,
        "auth": "apitoken"
        }

        Comment

        • Harish Munagapati
          Junior Member
          • Jun 2023
          • 3

          #5
          Originally posted by Harish Munagapati
          Here is an option tested on Zabbix 6.0

          This will list the hosts with "unavailable" status mean you availability status on the host is in grey

          Output : Hostname and host id

          {
          "jsonrpc": "2.0",
          "method": "host.get",
          "params": {
          "output": [
          "hostid",
          "host"
          ],
          "filter": {
          "available": [
          "0"
          ]
          }
          },
          "id": 2,
          "auth": "apitoken"
          }

          Availability details are available under Interfaces, the below parameters helps query information information for all the hosts.

          {
          "jsonrpc": "2.0",
          "method": "host.get",
          "params": {
          "output": "extend",
          "selectInterfaces": "extend"
          },
          "id": 2,
          "auth": "apitoken"
          }
          This help only when using Zabbix Agent not Zabbix Agent (Active).

          Comment

          Working...