View stream statistics by using the Wowza Streaming Engine REST API

You can use the Wowza Streaming Engine™ media server software REST API to view current and historical statistics about applications, incoming streams, and the server itself.

Notes:

' + "
" + "
    "; var el, title, link, newLine; $(".hg-article-body h2, .hg-article-body h3").each(function(i) { el = $(this); title = el.text(); anchorTitle = el.text().replace(/([~!@#$%^&*()_+=`{}\[\]\|\\:;'<>,.\/\? ])+/g, '-').toLowerCase(); link = "#" + anchorTitle; el.html('' + el.html()); if (el.is('h2:first')){ newLine = '" + "
" + ""; $("#snippet-prepend").before(ToC); });

Before you start


You should be familiar with the following concepts:

  • API authentication methods. The examples assume the AuthenticationMethod property in the Server.xml is set to none. See Query the Wowza Streaming Engine REST API for information about including authentication in API requests.

Get current statistics for an application


View current statistics for an application, including total connections, the number and rate of bytes entering and leaving the server, and the number of connections per protocol by sending a GET request:

curl -X GET \
-H 'Accept:application/json; charset=utf-8' \
-H 'Content-Type:application/json; charset=utf-8' \
"http://localhost:8087/v2/servers/{serverName}/vhosts/{vhostName}/applications/{appName}/monitoring/current"


Note:  You will replace {appName} with the name of your application.

The command should return a response that looks something like this (if the application is running, you should see real values, not zeros):

{
   "serverName": "{serverName}",
   "uptime": 0,
   "bytesIn": 0,
   "bytesOut": 0,
   "bytesInRate": 0,
   "bytesOutRate": 0,
   "totalConnections": 0,
   "connectionCount": {
      "WEBM": 0,
      "DVRCHUNKS": 0,
      "RTMP": 0,
      "MPEGDASH": 0,
      "CUPERTINO": 0,
      "SANJOSE": 0,
      "SMOOTH": 0,
      "RTP": 0
   }
}

 

Get current statistics for an incoming stream


View current statistics for an incoming stream by sending a GET request to the /v2/servers/{serverName}/vhosts/{vhostName}/applications/{appName}/instances/_definst_/incomingstreams/{streamName}/monitoring/current endpoint.

You can use the following sample request, making sure to:

  • Set serverName, vhostName, and instanceName to match your environment.
  • Set appName to the name of your application.
  • Set streamName to the name of your stream.
curl -X GET \
-H 'Accept:application/json; charset=utf-8' \
-H 'Content-Type:application/json; charset=utf-8' \
"http://localhost:8087/v2/servers/{serverName}/vhosts/{vhostName}/applications/{appName}/instances/{instanceName}/incomingstreams/{streamName}/monitoring/current"

The command should return a response that looks something like this (if the application is running, you should see real values, not zeros):

{
   "serverName": "serverName",
   "uptime": 0,
   "bytesIn": 0,
   "bytesOut": 0,
   "bytesInRate": 0,
   "bytesOutRate": 0,
   "totalConnections": 0,
   "connectionCount": {
      "RTMP": 0,
      "MPEGDASH": 0,
      "CUPERTINO": 0,
      "SANJOSE": 0,
      "SMOOTH": 0,
      "RTP": 0
   },
   "applicationInstance": "instanceName",
   "name": "streamName"
}

Get historical statistics for an application


View historical details for an application by sending a GET request to the /v2/servers/{serverName}/vhosts/{vhostName}/applications/{appName}/monitoring/historic endpoint.

You can use the following sample request, making sure to:

  • Set serverName and vhostName to match your environment.
  • Set appName to the name of your application.
curl -X GET \
-H 'Accept:application/json; charset=utf-8' \
-H 'Content-Type:application/json; charset=utf-8' \
"http://localhost:8087/v2/servers/{serverName}/vhosts/{vhostName}/applications/{appName}/monitoring/historic"

The command should return an entries object with actual, average, minimum, and maximum arrays of data for every date and time (dateTime) the application ran. The response should look something like this (but with real values, not zeros):

{
  "serverName": "serverName",
  "entries": {
    "actual": [],
    "average": [{
        "dateTime": "2017-04-05T18:00:00",
        "data": [
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0
        ]
    }],
    "min": [{
        "dateTime": "2017-04-05T18:00:00",
        "data": [...]
    }],
    "max": [{
        "dateTime": "2017-04-05T18:00:00",
        "data": [...]
    }]
  }
}

The dateTime is the UTC date and time that the server started. The values in each data array are, in descending order:

   "data": [
       bandwidth_inbound in kilobytes/second,
       bandwidth_outbound in kilobytes/second,
       rtmp,
       rtsp,
       hds,
       hls,
       smooth,
       webrtc,
       webm,
       dash
      ]

Optionally, you can also include start and end time parameters in your query to return historical statistics only for that time range. Specify the start and end times in the format start=yyyy-mm-ddThh:mm:ss. For example, 2015-11-01T15:00:00. The following example query uses the start and end parameters:

curl -X GET \
-H 'Accept:application/json; charset=utf-8' \
-H 'Content-Type:application/json; charset=utf-8' \
"http://localhost:8087/v2/servers/{serverName}/vhosts/{vhostName}/applications/{appName}/monitoring/historic?start=2015-11-01T15:00:00&end=2015-11-01T15:01:00"

Get historical statistics for a server


View historical statistics for a server, including CPU, memory, and heap memory usage as well as connections to the server by sending a GET request to the /v2/servers/{serverName}/monitoring/historic endpoint making sure to update serverName to match your environment.

curl -X GET \
-H 'Accept:application/json; charset=utf-8' \
-H 'Content-Type:application/json; charset=utf-8' \
"http://localhost:8087/v2/servers/{serverName}/monitoring/historic"

The command should return an entries object that shows the actual, average, minimum, and maximum values for every date and time (dateTime) the server ran. The response should look something like this :

{
  "serverName": "serverName",
  "entries": {
    "actual": [],
    "average": [{
        "dateTime": "2017-04-05T18:00:00",
        "data": [
            0,
            0,
            0,
            54
        ]
    }],
    "min": [{
        "dateTime": "2017-04-05T18:00:00",
        "data": [...]
    }],
    "max": [{
        "dateTime": "2017-04-05T18:00:00",
        "data": [...]
    }]
  }
}

The dateTime is the UTC date and time that the server started. The values in each data array are, in descending order:

   "data": [
      Bandwidth usage coming into the media server in kilobytes/second,
      Bandwidth usage going out of the media server in kilobytes/second,
      Java Heap memory usage in megabytes,
      Total connection count (in AND out of the media server)
      ]

Optionally, you can also include start and end time parameters in your query to return historical statistics only for that time range. Specify the start and end times in the format start=yyyy-mm-ddThh:mm:ss. For example, 2015-11-01T15:00:00. The following example query uses the start and end parameters:

curl -X GET \
-H 'Accept:application/json; charset=utf-8' \
-H 'Content-Type:application/json; charset=utf-8' \
"http://localhost:8087/v2/servers/{serverName}/monitoring/historic?start=2015-11-01T15:00:00&end=2015-11-01T15:01:00"
'); $('.hg-comment-post textarea').keyup(function () { var tlength = $(this).val().length; $(this).val($(this).val().substring(0, maxchars)); var tlength = $(this).val().length; remain = maxchars - parseInt(tlength); $('#remain').text(remain); }); });
Was this article helpful?
Thank you for your feedback!
User Icon

Thank you for providing feedback to help us improve our documentation!

  • Admin

    Hello! We've updated this topic to include more information before the code samples to indicate which variables need to be updated. Thanks for your feedback!

  • The URL in the curl command example is not showing which values need to be replaced in the string. http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/testlive/monitoring/historic. I am not sure which how to perform a successful query. Can you update this document?