How to 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:

Contents


Get current statistics for an application
Get current statistics for an incoming stream
Get historical statistics for an application
Get historical statistics for a server

Get current statistics for an application


View current statistics for an application (live in this example), including total connections, the number and rate of bytes entering and leaving the server, and the number of connections per protocol:

curl -X --header 'Accept:application/json; charset=utf-8' --header 'Content-Type:application/json; charset=utf-8' http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/live/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": "_defaultServer_",
   "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 (myStream in this example):

curl -X GET --header 'Accept:application/json; charset=utf-8' --header 'Content-Type:application/json; charset=utf-8' http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/live/instances/_definst_/incomingstreams/myStream/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": "_defaultServer_",
   "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": "_definst_",
   "name": "myStream"
}

Get historical statistics for an application


View historical details for an application (live in this example), including [what?]:

curl -X GET --header 'Accept:application/json; charset=utf-8' --header 'Content-Type:application/json; charset=utf-8' http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/live/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": "_defaultServer_",
  "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,
       bandwidth_outbound,
       rtmp,
       rtsp,
       hds,
       hls,
       smooth,
       webrtc,
       webm,
       dash
      ]

Get historical statistics for a server


View historical statistics for a server (_defaultServer in this example), including CPU, memory, and heap memory usage as well as connections to the server:

curl -X GET --header 'Accept:application/json; charset=utf-8' --header 'Content-Type:application/json; charset=utf-8' http://localhost:8087/v2/servers/_defaultServer_/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": "_defaultServer_",
  "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": [
      Percentage of CPU usage,
      MB of memory used,
      Total number of connections,
      MB of heap memory used
      ]

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