Monitoring

Radio Mast can monitor online radio streams and send alerts when downtime or silence is detected.

The Radio Streams API allows you to monitor the status of individual streams, including getting the current status and uptime statistics, allowing you to integrate stream monitoring into your app or website.

The basics of the Radio Streams API are covered in our Quickstart Guide. This page will dive into more detail about the monitoring aspect of it.

Getting Stream Status and Uptime

A Radio Stream's status and uptime statistics can be obtained by making a GET request to these API endpoints, depending on whether your stream is hosted on our Streaming Network, or if it's externally-hosted: /v1/radiostreams/radiomast/<uuid> /v1/radiostreams/external/<uuid>

For example:

curl -H "Authorization: Token <your-token>" https://api.radiomast.io/v1/radiostreams/radiomast/355ab84d-d2b2-4dd5-90f2-372befc49547/

{
  "uuid": "355ab84d-d2b2-4dd5-90f2-372befc49547",
  "station": "b4f98161-6341-4f5e-a677-12a6455c3321",
  "name": "MP3 Stream",
  "username": "source",
  "password": "<snipped>",
  "mount": "355ab84d-d2b2-4dd5-90f2-372befc49547",
  "listening_url": "https://streams.radiomast.io/355ab84d-d2b2-4dd5-90f2-372befc49547",
  "streaming_plan": "100L-64",
  "audio_parameters": {
    "codec": "MP3",
    "bitrate": 128,
    "channels": 2,
    "samplerate": 44100
  },
  "monitoring": {
    "plan": 'silence_detection',
    "enabled": true,
    "silence_detection": true,
    "status": "OK",
    "uptime_24_hours": "100.00%",
    "uptime_7_days": "99.99%",
    "uptime_30_days": "99.95%",
    "last_tested_at": 1580941676,
    "silence_threshold_db": -60,
    "silence_duration": 15
  },
  "listener_count": 5
}

Monitoring Fields

The fields in the monitoring dictionary are:

  • plan - The monitoring billing plan slug. Possible values are here. Set this to enable or disable monitoring on this stream.
  • enabled - (Read-only) True if basic uptime monitoring is enabled, false otherwise.
  • silence_detection - (Read-only) True if silence detection is enabled (as determined by the plan), false otherwise. Set the plan to one that includes silence detection to enable this.
  • status - (Read-only) Overall health status of the stream. Possible values are:
    • OK - The stream is online. If silence detection is enabled, the stream is audible too.
    • Failed - The stream is down.
    • Pending - Monitoring is enabled but results have not yet been returned. Typically only in this state for the first 60 seconds.
    • Disabled - Stream monitoring is not enabled.
  • uptime_24_hours - (Read-only) The 24-hour uptime percentage.
  • uptime_7_days - (Read-only) The 7-day uptime percentage.
  • uptime_30_days - (Read-only) The 30-day uptime percentage.
  • last_tested_at - (Read-only) UNIX timestamp of when the stream was last checked.
  • silence_threshold_db - The RMS threshold (dB) under which audio is considered silent.
  • silence_duration - If silence is detected (ie. RMS under the threshold) for longer than this duration (in seconds), the stream will be considered silent and down.

All of these fields are present for both Radio Mast and External streams.

Alerting

Alerting is currently only configurable from the Radio Mast dashboard. If you require Alert Policies or Alert Contacts to be configurable via the API, please let us know!