Rest API endpoint for current host dependencies from the Runtime database
This section is for searching for live objects being monitored by Opsview. This is in the Runtime database, hence the URL path is /rest/runtime/{objecttype}
.
URL: /rest/runtime/network
. Requires authentication - requires VIEWALL or VIEWSOME permission.
- GET - returns host dependency map
- POST, PUT, DELETE - not implemented
Access Control
VIEWALL allows all hosts to be returned.
VIEWSOME allows only hosts where permission has been granted based on the access object selection.
Retrieving Host Dependency Map
Parameters:
- hostgroupid - includes this host group (by id) in list. Can be repeated. Note, this will return all hosts in this hosgroupid and below in the hierarchy (so a hostgroupid of 1 effectively returns all hosts).
- fromhostname - if set, then only the host descendants will be returned. Can be repeated.
- host - filter hosts by this host name. Can be repeated.
- only_with_children - if set, then only hosts with at least 1 child are returned.
- monitoredby - if set, filter hosts if it is monitored by the monitoring server by this id.
- rows - if set, sets the maximum of rows requested.
Response:
-
rows - the number of actual rows returned.
-
allrows - the total number of rows based on filtering parameters.
-
total - the total number of rows if filtering is not applied.
-
list - an associative array of:
- name - name of the host
- children - this will be a list of the children nodes by host name
- parents - this will be a list of the parents nodes by host name
Note: If due to permission restriction children/parents are not visible null
will be used instead of host name.
Example response:
{
rows => 4,
total => 20,
allrows => 8,
list => [
{
name: "opsview",
parents: [],
children: [ "opsviewdev1", null, "cisco" ]
},
{
name: "opsviewdev1",
parents: [ "opsview" ],
children: []
},
{
name: "cisco",
parents: [ "opsview" ],
children: [ "monitored_by_collector", "cisco4" ]
},
{
name: "cisco4",
parents: [ "cisco" ],
children: [ null ]
}
]
}