WAS THIS PAGE HELPFUL? Leave Feedback
7.0 Statistics APIs
The Statistics APIs query real time monitor statistics. These APIs are read only. The Statistics APIs are categorized by Totals, Hosts, Host Groups, Services, and Availability.
All Statistics queries support both XML and JSON
7.1 HTTP Headers
Header | Valid Values | Required |
---|---|---|
Content-Type | application/xml or application/json | True |
GWOS-API-TOKEN | a valid token returned from login | True |
GWOS-APP-NAME | your application name | True |
7.2 Total Statistics
Retrieve statistics by totals, system wide. Total statistics target two kinds of statistical data:
- Host Total Statistics
- Service Total Statistics
Statistics totals are grouped by the status of the statistical data. Total counts are presented for the number of hosts in the system, number of services in the system, and then individual counts are displayed for each status (“DOWN”, “UP”, ….) either by service or by host counts.
7.2.1 Method: GET Total Statistics for Hosts
GET /api/statistics/totals/hosts
7.2.2 Method: GET Total Statistics for Services
GET /api/statistics/totals/services
7.2.3 Example Queries
- query for total statistics by hosts
GET /api/statistics/totals/hosts<?xml version="1.0" encoding="utf-8" standalone="yes"?> <statistic totalHosts="20" totalServices="131" name="_ALL_" availability="75.0"> <properties> <property name="DOWN" count="0" /> <property name="UNREACHABLE" count="0" /> <property name="PENDING" count="0" /> <property name="UP" count="15" /> <property name="SCHEDULED DOWN" count="0" /> <property name="UNSCHEDULED DOWN" count="5" /> </properties> </statistic>
- query for total statistics by services
GET /api/statistics/totals/services<?xml version="1.0" encoding="utf-8" standalone="yes"?> <statistic totalHosts="20" totalServices="131" name="{color}{color:#4a86e8}{_}ALL{_}{color}{color:#4a86e8}"{color} availability="0.0"> <properties> <property name="CRITICAL" count="0" /> <property name="WARNING" count="2" /> <property name="UNKNOWN" count="0" /> <property name="OK" count="114" /> <property name="PENDING" count="0" /> <property name="SCHEDULED CRITICAL" count="0" /> <property name="UNSCHEDULED CRITICAL" count="15" /> </properties> </statistic>
7.3 Host Statistics
Retrieve statistics by hosts.
Hosts statistics accumulates statistical data for hosts. Counts are filtered by the list of hosts in the request. Individual counts are displayed for each status (e.g. "DOWN", "UP").
7.3.1 Method: GET Statistics by Host for Specified Hosts
GET /api/statistics/hosts/{one or more comma separated host names}
7.3.2 Example Queries
- query for statistics for the five given host names
GET /api/statistics/hosts/localhost,172.28.113.151,demo,malbec,qa-load-xp-1<?xml version="1.0" encoding="utf-8" standalone="yes"?> <statistic totalHosts="5" totalServices="0" name="'localhost','172.28.113.151','demo','malbec','qa-load-xp-1'" availability="0.0"> <properties> <property name="DOWN" count="0" /> <property name="UNREACHABLE" count="0" /> <property name="PENDING" count="0" /> <property name="UP" count="5" /> <property name="SCHEDULED DOWN" count="0" /> <property name="UNSCHEDULED DOWN" count="0" /> </properties> </statistic>
7.4 Host Group Statistics
Retrieve statistics by host groups.
Hosts Group statistics accumulates statistical data for host groups. Counts are filtered by the list of hosts in the request. Individual counts are displayed for each status (e.g. "DOWN", "UP").
Host Group statistics differ from Host statistics in that there is are statistics elements for each host group in the system
7.4.1 Method: GET Statistics for all host groups
GET /api/statistics/hostgroups
7.4.2 Method: GET Statistics for a list of host groups
GET /api/statistics/hostgroups/{one or more comma-separated host group names}
7.4.3 Example Queries
- query statistics for all host groups
GET /api/statistics/hostsgroups<statistics> <statistic totalHosts="2" totalServices="23" name="IT" availability="100.0"> <properties> <property name="DOWN" count="0" /> <property name="UNREACHABLE" count="0" /> <property name="PENDING" count="0" /> <property name="UP" count="2" /> <property name="SCHEDULED DOWN" count="0" /> <property name="UNSCHEDULED DOWN" count="0" /> </properties> </statistic> <statistic totalHosts="1" totalServices="4" name="HG1" availability="100.0"> <properties> <property name="DOWN" count="0" /> <property name="UNREACHABLE" count="0" /> <property name="PENDING" count="0" /> <property name="UP" count="1" /> <property name="SCHEDULED DOWN" count="0" /> <property name="UNSCHEDULED DOWN" count="0" /> </properties> </statistic> <statistic totalHosts="5" totalServices="75" name="Engineering" availability="60.0"> <properties> <property name="DOWN" count="0" /> <property name="UNREACHABLE" count="0" /> <property name="PENDING" count="0" /> <property name="UP" count="3" /> <property name="SCHEDULED DOWN" count="0" /> <property name="UNSCHEDULED DOWN" count="2" /> </properties> </statistic> <statistic totalHosts="10" totalServices="55" name="Linux Servers" availability="100.0"> <properties> <property name="DOWN" count="0" /> <property name="UNREACHABLE" count="0" /> <property name="PENDING" count="0" /> <property name="UP" count="10" /> <property name="SCHEDULED DOWN" count="0" /> <property name="UNSCHEDULED DOWN" count="0" /> </properties> </statistic> </statistics>
- query statistics for one or more host groups comma separated
GET /api/statistics/hostsgroups/Linux+Servers,Engineering<?xml version="1.0" encoding="utf-8" standalone="yes"?> <statistics> <statistic totalHosts="10" totalServices="55" name="Linux Servers" availability="100.0"> <properties> <property name="DOWN" count="0" /> <property name="UNREACHABLE" count="0" /> <property name="PENDING" count="0" /> <property name="UP" count="10" /> <property name="SCHEDULED DOWN" count="0" /> <property name="UNSCHEDULED DOWN" count="0" /> </properties> </statistic> <statistic totalHosts="5" totalServices="75" name="Engineering" availability="60.0"> <properties> <property name="DOWN" count="0" /> <property name="UNREACHABLE" count="0" /> <property name="PENDING" count="0" /> <property name="UP" count="3" /> <property name="SCHEDULED DOWN" count="0" /> <property name="UNSCHEDULED DOWN" count="2" /> </properties> </statistic> </statistics>
7.5 Service Statistics
Retrieve statistics by services.
Service statistics accumulates statistical data for for service counts grouped by service status. Individual counts are displayed for each status (e.g. "DOWN", "UP"). Service statistics supports filtering by:
- a list of all Host Groups (no filtering)
- filter by a list of Hosts
- filter by a list of Host Groups
- filter by a list of Service Groups
7.5.1 Method: GET All Service Statistics Grouped by Host Groups
GET /api/statistics/services
7.5.2 Method: GET Service Statistics Filtered by Hosts
GET /api/statistics/services/hosts/{comma separated list of host names}
7.5.3 Method: GET Service Statistics Filtered by Host Groups
GET /api/statistics/services/hostgroups/{comma separated list of host group names}
7.5.4 Method: GET Service Statistics Filtered by Service Groups
GET /api/statistics/services/servicegroups/{comma separated list of services group names}
7.5.5 Method: GET All Service Statistics Grouped by Service Groups
GET /api/statistics/services/servicegroups
7.5.6 Example GET All Service Statistics Grouped by Host Group
- query all service statistics grouped by all host groups
GET /api/statistics/services<?xml version="1.0" encoding="utf-8" standalone="yes"?> <statistics> <statistic totalHosts="2" totalServices="23" name="IT" availability="86.0"> <properties> <property name="CRITICAL" count="0" /> <property name="WARNING" count="0" /> <property name="UNKNOWN" count="0" /> <property name="OK" count="20" /> <property name="PENDING" count="0" /> <property name="SCHEDULED CRITICAL" count="0" /> <property name="UNSCHEDULED CRITICAL" count="3" /> </properties> </statistic> <statistic totalHosts="1" totalServices="4" name="HG1" availability="50.0"> <properties> <property name="CRITICAL" count="0" /> <property name="WARNING" count="0" /> <property name="UNKNOWN" count="0" /> <property name="OK" count="2" /> <property name="PENDING" count="0" /> <property name="SCHEDULED CRITICAL" count="0" /> <property name="UNSCHEDULED CRITICAL" count="2" /> </properties> </statistic> <statistic totalHosts="5" totalServices="75" name="Engineering" availability="88.0"> <properties> <property name="CRITICAL" count="0" /> <property name="WARNING" count="2" /> <property name="UNKNOWN" count="0" /> <property name="OK" count="66" /> <property name="PENDING" count="0" /> <property name="SCHEDULED CRITICAL" count="0" /> <property name="UNSCHEDULED CRITICAL" count="7" /> </properties> </statistic> <statistic totalHosts="10" totalServices="55" name="Linux Servers" availability="94.0"> <properties> <property name="CRITICAL" count="0" /> <property name="WARNING" count="0" /> <property name="UNKNOWN" count="0" /> <property name="OK" count="52" /> <property name="PENDING" count="0" /> <property name="SCHEDULED CRITICAL" count="0" /> <property name="UNSCHEDULED CRITICAL" count="3" /> </properties> </statistic> <statistic totalHosts="4" totalServices="12" name="Support" availability="75.0"> <properties> <property name="CRITICAL" count="0" /> <property name="WARNING" count="0" /> <property name="UNKNOWN" count="0" /> <property name="OK" count="9" /> <property name="PENDING" count="0" /> <property name="SCHEDULED CRITICAL" count="0" /> <property name="UNSCHEDULED CRITICAL" count="3" /> </properties> </statistic> <statistic totalHosts="5" totalServices="13" name="Eng-QA" availability="92.0"> <properties> <property name="CRITICAL" count="0" /> <property name="WARNING" count="0" /> <property name="UNKNOWN" count="0" /> <property name="OK" count="12" /> <property name="PENDING" count="0" /> <property name="SCHEDULED CRITICAL" count="0" /> <property name="UNSCHEDULED CRITICAL" count="1" /> </properties> </statistic> <statistic totalHosts="4" totalServices="9" name="Eng-test" availability="66.0"> <properties> <property name="CRITICAL" count="0" /> <property name="WARNING" count="0" /> <property name="UNKNOWN" count="0" /> <property name="OK" count="6" /> <property name="PENDING" count="0" /> <property name="SCHEDULED CRITICAL" count="0" /> <property name="UNSCHEDULED CRITICAL" count="3" /> </properties> </statistic> </statistics>
7.5.7 Example GET Service Statistics Filtered by Hosts
- query service statistics grouped by hosts for two hosts
GET /api/statistics/services/hosts/localhost,support-xp-1<?xml version="1.0" encoding="utf-8" standalone="yes"?> <statistics> <statistic totalHosts="1" totalServices="21" name="localhost" availability="0.0"> <properties> <property name="CRITICAL" count="0" /> <property name="WARNING" count="0" /> <property name="UNKNOWN" count="0" /> <property name="OK" count="19" /> <property name="PENDING" count="0" /> <property name="SCHEDULED CRITICAL" count="0" /> <property name="UNSCHEDULED CRITICAL" count="2" /> </properties> </statistic> <statistic totalHosts="1" totalServices="1" name="support-xp-1" availability="0.0"> <properties> <property name="CRITICAL" count="0" /> <property name="WARNING" count="0" /> <property name="UNKNOWN" count="0" /> <property name="OK" count="0" /> <property name="PENDING" count="0" /> <property name="SCHEDULED CRITICAL" count="0" /> <property name="UNSCHEDULED CRITICAL" count="1" /> </properties> </statistic> </statistics>
7.5.8 Example GET Service Statistics Filtered by Host Groups
- query service statistics grouped by host groups for two host groups
GET /api/statistics/services/hostgroups/Engineering,Linux+Servers<?xml version="1.0" encoding="utf-8" standalone="yes"?> <statistics> <statistic totalHosts="5" totalServices="75" name="Engineering" availability="88.0"> <properties> <property name="CRITICAL" count="0" /> <property name="WARNING" count="2" /> <property name="UNKNOWN" count="0" /> <property name="OK" count="66" /> <property name="PENDING" count="0" /> <property name="SCHEDULED CRITICAL" count="0" /> <property name="UNSCHEDULED CRITICAL" count="7" /> </properties> </statistic> <statistic totalHosts="10" totalServices="55" name="Linux Servers" availability="94.0"> <properties> <property name="CRITICAL" count="0" /> <property name="WARNING" count="0" /> <property name="UNKNOWN" count="0" /> <property name="OK" count="52" /> <property name="PENDING" count="0" /> <property name="SCHEDULED CRITICAL" count="0" /> <property name="UNSCHEDULED CRITICAL" count="3" /> </properties> </statistic> </statistics>
7.5.9 Example GET Service Statistics Filtered by Service Groups
- query service statistics grouped by service groups for one service group
GET /api/statistics/services/servicegroups/SG1<?xml version="1.0" encoding="utf-8" standalone="yes"?> <statistics> <statistic totalHosts="0" totalServices="2" name="SG1" availability="100.0"> <properties> <property name="CRITICAL" count="0" /> <property name="WARNING" count="0" /> <property name="UNKNOWN" count="0" /> <property name="OK" count="2" /> <property name="PENDING" count="0" /> <property name="SCHEDULED CRITICAL" count="0" /> <property name="UNSCHEDULED CRITICAL" count="0" /> </properties> </statistic> </statistics>
7.5.10 Example GET All Service Statistics Grouped by Service Groups
- query all service statistics grouped by all host groups
GET /api/statistics/services/servicegroups<?xml version="1.0" encoding="utf-8" standalone="yes"?> <statistics> <statistic totalHosts="0" totalServices="8" name="web-svr" availability="75.0"> <properties> <property name="CRITICAL" count="0" /> <property name="WARNING" count="0" /> <property name="UNKNOWN" count="0" /> <property name="OK" count="6" /> <property name="PENDING" count="0" /> <property name="SCHEDULED CRITICAL" count="0" /> <property name="UNSCHEDULED CRITICAL" count="2" /> </properties> </statistic> <statistic totalHosts="0" totalServices="2" name="SG1" availability="100.0"> <properties> <property name="CRITICAL" count="0" /> <property name="WARNING" count="0" /> <property name="UNKNOWN" count="0" /> <property name="OK" count="2" /> <property name="PENDING" count="0" /> <property name="SCHEDULED CRITICAL" count="0" /> <property name="UNSCHEDULED CRITICAL" count="0" /> </properties> </statistic> </statistics>
7.6 Availability Statistics
Retrieves availability percentage statistics for services and hosts.
Availability statistics return a percentage of availability (the server is up and running) of all services or hosts for a given criteria.
Types of Availability Queries
- Host Availability by Host Group Name
- Service Availability by Host Group Name
- Service Availability by Service Group Name
7.6.1 Method: GET Host Availability by Host Group Name
GET /api/statistics/availability/hosts?hostGroup={hostGroupName}
7.6.2 Method: GET Service Availability by Host Group Name
GET /api/statistics/availability/services?hostGroup={hostGroupName}
7.6.3 Method: GET Service Availability by Service Group Name
GET /api/statistics/availability/services?serviceGroup={serviceGroupName}
7.6.4 Example GET Host Availability by Host Group Name
GET /api/statistics/availability/hosts?hostGroup=Engineering
?xml version="1.0" encoding="utf-8" standalone="yes"?> <statistic availability="100.0" queryBy="hosts" queryParam="hostGroup" queryValue="HG1" />
7.6.5 Example GET Service Availability by Host Group Name
GET /api/statistics/availability/services?hostGroup=Linux+Servers
<?xml version="1.0" encoding="utf-8" standalone="yes"?> <statistic availability="50.0" queryBy="services" queryParam="hostGroup" queryValue="HG1" />
7.6.6 Example GET Service Availability by Service Group Name
GET /api/statistics/availability/services?serviceGroup=SG1
<?xml version="1.0" encoding="utf-8" standalone="yes"?> <statistic availability="100.0" queryBy="services" queryParam="serviceGroup" queryValue="SG1" />
See Appendix A for examples of usage with Curl
See Appendix B and Appendix C for example query data in both XML and JSON