• Statistics query examples for the Wowza Streaming Engine REST API

    Wowza Streaming Engine™ media server software has a REST Application Programming Interface (API) that can be used to configure, manage, and monitor the media server through HTTP requests. This article demonstrates ways to get statistics related to applications, live streams, and the Wowza Streaming Engine server using some basic cURL examples to query the Wowza Streaming Engine REST service. For a complete breakdown and documentation of the API, see How to access documentation for the Wowza Streaming Engine REST API.

    Note: Wowza Streaming Engine 4.3.0 or later is required. You must also have working knowledge of cURL and REST-related services.

    Contents


    Get general statistics
    Get incoming stream statistics
    Get historical application statistics
    Get historical server statistics

    Get general statistics


    The following request returns application-related statistics in terms of total connections, bandwidth, and connection counts by protocol. This is similar to the statistics available in the dashboard under a given application in Wowza Streaming Engine Manager.
    curl -X GET --header 'Accept:application/json; charset=utf-8' http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/testlive/monitoring/current
    The response includes:
    {"restURI":"http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/testlive/monitoring/current","uptime":0,"bytesIn":0,"bytesOut":0,"bytesInRate":0,"bytesOutRate":0,"totalConnections":0,"connectionCount":{"CUPERTINO":0,"RTP":0,"MPEGDASH":0,"SMOOTH":0,"DVRCHUNKS":0,"WEBM":0,"RTMP":0,"SANJOSE":0}

    Get incoming stream statistics


    The following example shows how to request statistics for a specific incoming stream. This example uses a stream named myStream:
    curl -X GET --header 'Accept:application/json; charset=utf-8' http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/testlive/instances/_definst_/incomingstreams/myStream/monitoring/current
    The resulting data is similar to the following:
    {"restURI":"http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/testlive/instances/_definst_/incomingstreams/myStream/monitoring/current","uptime":0,"bytesIn":0,"bytesOut":0,"bytesInRate":0,"bytesOutRate":0,"totalConnections":0,"connectionCount":{"CUPERTINO":0,"RTP":0,"MPEGDASH":0,"SMOOTH":0,"RTMP":0,"SANJOSE":0},"applicationInstance":"_definst_","name":"myStream"}

    Get historical application statistics


    To get related statistics over time, you can invoke the historic option through the application, as follows:
    curl -X GET --header 'Accept:application/json; charset=utf-8' http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/testlive/monitoring/historic
    An example result:
    {"restURI":"http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/testlive/monitoring/historic","entries":{"min":[{"dateTime":"2015-05-04T11:00:00","data":[0,0,0,0,0,0,0,0,0,0]},{"dateTime":"2015-05-04T12:00:00","data":[0,0,0,0,0,0,0,0,0,0]},{"dateTime":"2015-05-04T13:00:00","data":[0,0,0,0,0,0,0,0,0,0]},{"dateTime":"2015-05-04T14:00:00","data":[0,0,0,0,0,0,0,0,0,0]},{"dateTime":"2015-05-04T16:00:00","data":[0,0,0,0,0,0,0,0,0,0]},{"dateTime":"2015-05-04T17:00:00","data":[0,0,0,0,0,0,0,0,0,0]}],"max":[{"dateTime":"2015-05-04T11:00:00","data":[0,0,0,0,0,0,0,0,0,0]},{"dateTime":"2015-05-04T12:00:00","data":[0,0,0,0,0,0,0,0,0,0]},{"dateTime":"2015-05-04T13:00:00","data":[0,0,0,0,0,0,0,0,0,0]},{"dateTime":"2015-05-04T14:00:00","data":[0,0,0,0,0,0,0,0,0,0]},{"dateTime":"2015-05-04T16:00:00","data":[0,0,0,0,0,0,0,0,0,0]},{"dateTime":"2015-05-04T17:00:00","data":[0,0,0,0,0,0,0,0,0,0]}],"actual":[],"average":[{"dateTime":"2015-05-04T11:00:00","data":[0,0,0,0,0,0,0,0,0,0]},{"dateTime":"2015-05-04T12:00:00","data":[0,0,0,0,0,0,0,0,0,0]},{"dateTime":"2015-05-04T13:00:00","data":[0,0,0,0,0,0,0,0,0,0]},{"dateTime":"2015-05-04T14:00:00","data":[0,0,0,0,0,0,0,0,0,0]},{"dateTime":"2015-05-04T16:00:00","data":[0,0,0,0,0,0,0,0,0,0]},{"dateTime":"2015-05-04T17:00:00","data":[0,0,0,0,0,0,0,0,0,0]}]}}

    Get historical server statistics


    To get historical statistics at the server level, the request is similar to that of the Get historical application statistics command above, but it doesn't include the reference to an application (vhosts/_defaultVHost_/applications/testlive/):
    curl -X GET --header 'Accept:application/json; charset=utf-8' http://localhost:8087/v2/servers/_defaultServer_/monitoring/historic
    This command will return maximum, minimum, and average data arrays, in JSON syntax, similar to the following:
      {
                "dateTime": "2016-02-02T14:00:00",
                "data":[
                   1,
                   0,
                   3,
                   16
                ]
             },
    The breakdown of this return is as follows:
      {
                "dateTime":"Date Time",
                "data":[
                   CPU (percentage),
                   Memory (MB),
                   Connection Counts,
                   Heap Memory (MB)
                ]
             },

    Originally Published: 06-16-2015.
    Updated: For Wowza Streaming Engine 4.3.0 on 10-06-2015.

    If you're having problems or want to discuss this article, post in our forum.