Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Borderless table

Abfrage Parameter:

Code Block
languagebash
themeMidnight
titleMögliche get Parameter, um eine gefilterte Service Liste über die REST API zu bekommen
"angular": true,
"direction": "desc",
"page": 1,
"scroll": true,
"sort": "Servicestatus.current_state",
"filter[Host.id]": null,
"filter[Host.name]": null,
"filter[Service.keywords][]": "keyword1",
"filter[Service.keywords][]": "keyword2",
"filter[Service.servicename]": null,
"filter[Servicestatus.active_checks_enabled]": null,
"filter[Servicestatus.current_state][]": "ok",
"filter[Servicestatus.current_state][]": "warning",
"filter[Servicestatus.current_state][]": "critical",
"filter[Servicestatus.current_state][]": "unknown",
"filter[Servicestatus.output]": null,
"filter[Servicestatus.problem_has_been_acknowledged]": null,
"filter[Servicestatus.scheduled_downtime_depth]": null,

Finde Services über den Namen

URLhttps://123.123.123.123/services/index.json?angular=true&filter[Service.servicename]=ping

Methode: GET

Antwort: JSON

Code Block
languagebash
themeMidnight
titleAntwort
{  
   "all_services":[
      {  
         "Service":{  
            "id":"11",
            "uuid":"bb8c6680-8875-460a-a8a5-9e4a5d6bb01b",
            "servicename":"Ping",
            "description":null,
            "active_checks_enabled":true,
            "tags":null,
            "host_id":4,
            "allow_edit":true,
            "disabled":false,
            "has_graph":true
         },
         "Host":{  
            "id":"4",
            "uuid":"5c67a508-787d-4139-9aff-bb7f2de0199e",
            "hostname":"cloud.oitc.demo",
            "address":"192.168.46.4",
            "description":null,
            "active_checks_enabled":null,
            "satelliteId":0,
            "containerId":null,
            "containerIds":[  
               "1"
            ],
            "tags":null,
            "allow_edit":true,
            "is_satellite_host":false
         },
         "Servicestatus":{  
            "currentState":0,
            "lastHardState":null,
            "isFlapping":false,
            "problemHasBeenAcknowledged":false,
            "scheduledDowntimeDepth":0,
            "lastCheck":"11:33:40 - 24.10.2018",
            "nextCheck":"11:38:40 - 24.10.2018",
            "activeChecksEnabled":"1",
            "lastHardStateChange":"12:44:48 - 11.01.2018",
            "last_state_change":"12:44:48 - 11.01.2018",
            "processPerformanceData":null,
            "state_type":"1",
            "acknowledgement_type":0,
            "flap_detection_enabled":null,
            "notifications_enabled":null,
            "current_check_attempt":null,
            "output":"PING OK - Packet loss = 0%, RTA = 0.62 ms",
            "long_output":null,
            "perfdata":null,
            "latency":null,
            "max_check_attempts":null,
            "isHardstate":true,
            "isInMonitoring":true
         },
         "Hoststatus":{  
            "currentState":0,
            "isFlapping":false,
            "problemHasBeenAcknowledged":false,
            "scheduledDowntimeDepth":null,
            "lastCheck":"",
            "nextCheck":"",
            "activeChecksEnabled":null,
            "lastHardStateChange":"12:40:38 - 11.01.2018",
            "last_state_change":"",
            "output":null,
            "long_output":null,
            "acknowledgement_type":null,
            "state_type":null,
            "flap_detection_enabled":null,
            "notifications_enabled":null,
            "current_check_attempt":null,
            "max_check_attempts":null,
            "latency":null,
            "isHardstate":false,
            "isInMonitoring":true
         }
      }
   ],
   "scroll":{  
      "page":1,
      "limit":25,
      "offset":25,
      "hasPrevPage":false,
      "prevPage":1,
      "nextPage":2,
      "current":1,
      "hasNextPage":false
   }
}


Finde Services über den Host Namen

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

Methode: GET

Antwort: JSON

Die selbe Antwort wie bereits oben angezeigt.


Finde Services über den Status

URL: https://123.123.123.123/services/index.json?angular=true&filter[Servicestatus.current_state][]=warning&filter[Servicestatus.current_state][]=critical&filter[Servicestatus.problem_has_been_acknowledged]=true

Methode: GET

Abfrage Parameter:

Code Block
languagebash
themeMidnight
titleExample parameter to get all warning, critical and acknowledged servicesBeispiel Parameter, um alle Services mit dem Status warning und critical zu bekommen, die bereits acknowledged sind
"angular": true,
"filter[Servicestatus.current_state][]": ["warning"],
"filter[Servicestatus.current_state][]": ["critical"],
"filter[Servicestatus.problem_has_been_acknowledged]": true,

Antwort: JSON

Die selbe Antwort wie bereits oben angezeigt.