9.0 Graph APIs

WAS THIS PAGE HELPFUL? Leave Feedback

9.0 Graph APIs

The Graph API generates real-time RRD graphs based on a set of input parameters. Depending on the provided query parameters, one or more graphs may be created. Graphs are created per host and optionally per service. The hostName parameter is required. If the service parameter is not provided, graphs will be generated for each service type for the given host. If the application type is not provided, defaults to NAGIOS. Start and end date are represented in seconds since start of the epoch. Both start and end dates are optional. If end date is not provided, the end date defaults to now. If start date is not provided, the start date defaults to 24 hours ago.

All Graph requests support both XML and JSON

9.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
9.2 Query Fields
Field Description Required
hostName Generate a graph for this hostName. Must be a valid hostname True
name The optional serviceName. If not specified, a graph will be generated for each service of the given host. False
applicationType A valid applicationType. If not provided, defaults to “NAGIOS” False
startDate Start date is the total number of seconds since Unix epoch (time in seconds since 01-01-1970). Optional parameter. If not specified, will default to 24 hours prior to now. False
endDate End date is the total number of seconds since Unix epoch (time in seconds since 01-01-1970). Optional parameter. If not specified, defaults to now. False
graphWidth The width of the graph in pixels. If not specified, defaults to 620 False
9.3 Method: GET Graphs

GET /api/graphs

9.4 Example Queries

These examples are not HTTP encoded for readability. In practice queries must be encoded.

  1. query for all services for the host named “localhost”
    GET /api/graphs?hostName=localhost
  2. query for all services for the host named localhost and service named “http_alive”
    GET /api/graphs?hostName=localhost&serviceName=http_alive
  3. query for all services for the host named “localhost”, start date = August 1, 2013
    GET /api/graphs?hostName=localhost&startDate=61333484400000
  4. query all services host named “localhost”, start date = August 1, 2013, graph width 600 pixels
    GET /api/graphs?hostName=localhost&startDate=61333484400000&graphWidth=600

The results are returned in either JSON or XML, with a collection of graph elements, each containing a label attribute and base64 encoded representation of the image (graph).

9.5 Example Results
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<graphs>
  <graph label="local_process_gw_listener: Process Count">
    <graph>...(base64 encoding)...</graph>
  </graph>
  <graph label="local_mem_nagios: Memory Utilization">
    <graph>...(base64 encoding)...</graph>
  </graph>
  <graph label="local_load: Load Averages">
    <graph>...(base64 encoding)...</graph>
  </graph>
</graphs>
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.