October 21, 2014

Server offline notification API

WMSPanel gets data about each of the servers being registered in customer account via periodical sync-up which happens each 30 seconds. So when the sync-ups stop, this means that a server is inaccessible and an administrator needs to take some actions. So we've added servers offline notifications to cover that case and to send email alerts when the server goes offline from our panel point of view.

Now we introduce push API for offline notifications. You may now get calls to your handler application from our service when any of your streams are unavailable.

Here's how it works.

1. Create a handler


A handler is a publicly available web application which can get HTTP POST requests. This might be implemented using any programming technology. Check this example from our streams un-publish notifications for Wowza for to see how this can be done via PHP with PECL packages installed.



2. Set up handler URL in WMSPanel


Now log into WMSPanel and choose Control / API set up menu. Then select Notifications API tab.

Server offline notifications push API setup page.
Here you need to enter the URL of your handler and check Send server offline events checkbox. Clicking on Save button you will initiate the monitoring notifications process.

If you'd like to authenticate WMSPanel alerts, you need to get a generated token to use it on step 3.

3. Process status notifications


When any of the servers becomes unavailable, WMSPanel will call your handler and post a JSON data containing time of event, a digest (signature), server name and the status.

Here's an example:

{"time":"2014-10-16 03:13:31 UTC","digest":"d93053a1875c034384bb4fb06b20792f","server":"edge1.example.com","status":"offline"}
A status may be "offline" only for now.

A digest is a signature which you may compare on your side by calculating it as "MD5(time + token)", where "time" is the time of receiving the message and "token" is the string which you see in API setup page. It can be used to check the credibility of incoming request.

This will work for any of the server types supported by WMSPanel reporting.

That's it. You may now create your events' handler to take actions on servers behavior, to notify your users or just collect your own statistics for internal usage. Let us know is you have any ideas or questions about this feature usage.

Please also check full WMSPanel API reference.

Related documentation


Dispersa streams monitoring, WMSPanel API referenceServers downtime email notificationsNotifying on RTMP stream (un)publishEnd user reporting for media servers

No comments:

Post a Comment