Seitenhierarchie
Zum Ende der Metadaten springen
Zum Anfang der Metadaten

URLhttps://123.123.123.123/hosts/index.json?angular=true

Methode: GET

Response: JSON


Query Parameters:

Possible get parameter to get a filtered host list via REST API
"angular": true,
"direction": "desc",
"page": 1,
"scroll": true,
"sort": "Hoststatus.current_state",
"filter[Host.address]": null,
"filter[Host.keywords][]": "keyword1",
"filter[Host.keywords][]": "keyword2",
"filter[Host.name]": null,
"filter[Host.id]": null,
"filter[Hoststatus.output]": null,
"filter[Hoststatus.problem_has_been_acknowledged]": null,
"filter[Hoststatus.scheduled_downtime_depth]": null,
"filter[Hoststatus.current_state][]": "up",
"filter[Hoststatus.current_state][]": "down",
"filter[Host.satellite_id][]": 1,
"filter[Host.satellite_id][]": 2,

Find host by id

URLhttps://123.123.123.123/hosts/index.json?angular=true&filter[Host.id]=1

Methode: GET

Response: JSON

Response
{  
   "all_hosts":[  
      {  
         "Host":{  
            "id":"1",
            "uuid":"c36b8048-93ce-4385-ac19-ab5c90574b77",
            "hostname":"oitc.oitc.demo",
            "address":"127.0.0.1",
            "description":null,
            "active_checks_enabled":null,
            "satelliteId":0,
            "containerId":1,
            "containerIds":[  
               "1",
               "11"
            ],
            "tags":null,
            "allow_edit":true,
            "is_satellite_host":false,
            "has_graphs":true,
            "allow_sharing":true,
            "satelliteName":"Mastersystem"
         },
         "Hoststatus":{  
            "currentState":0,
            "isFlapping":false,
            "problemHasBeenAcknowledged":false,
            "scheduledDowntimeDepth":"0",
            "lastCheck":"10:31:44 - 24.10.2018",
            "nextCheck":"12:31:44 - 24.10.2018",
            "activeChecksEnabled":true,
            "lastHardStateChange":"15:28:59 - 25.09.2017",
            "last_state_change":"15:28:59 - 25.09.2017",
            "output":"OK - 127.0.0.1: rta 0.055ms, lost 0%",
            "long_output":null,
            "acknowledgement_type":0,
            "state_type":"1",
            "flap_detection_enabled":null,
            "notifications_enabled":null,
            "current_check_attempt":null,
            "max_check_attempts":null,
            "latency":null,
            "isHardstate":true,
            "isInMonitoring":true
         },
         "ServicestatusSummary":{  
            "state":{  
               "ok":17,
               "warning":0,
               "critical":1,
               "unknown":6
            },
            "total":24
         }
      }
   ],
   "paging":{  
      "page":1,
      "current":1,
      "count":1,
      "prevPage":false,
      "nextPage":false,
      "pageCount":1,
      "order":{  
         "Hoststatus.current_state":"desc"
      },
      "limit":25,
      "options":[  

      ],
      "paramType":"named",
      "queryScope":null
   }
}


Find hosts by name

URL: https://123.123.123.123/hosts/index.json?angular=true&filter[Host.name]=ansible

Methode: GET

Response: JSON

Same response as shown above.


Find hosts by state

URL: https://123.123.123.123/hosts/index.json?angular=true&filter[Hoststatus.current_state][]=down&filter[Hoststatus.current_state][]=unreachable&filter[Hoststatus.problem_has_been_acknowledged]=true

Methode: GET

Request parameters:

Example parameter to get all down, unreachable and acknowledged hosts
"angular": true,
"filter[Hoststatus.current_state][]": ["down"],
"filter[Hoststatus.current_state][]": ["unreachable"],
"filter[Hoststatus.problem_has_been_acknowledged]": true,

Response: JSON

Same response as shown above.



  • Keine Stichwörter