You are here: Home > Help > Alert Channels > HTTP / RPC Alert Channel

HTTP / RPC Alert Channel

The HTTP / RPC channel makes an HTTP POST request to the specified URL, encapsulating the alert data in an XML string, JSON object, or Serialized-PHP array.

This enables you to invoke a Remote Procedure Call (RPC) within your system, allowing applications to automatically take action when Wormly alerts are triggered.

Bear in mind that your URL should point to a different webserver than the one being monitored, since sending HTTP alerts to a crashed server will obviously fail. The HTTP timeout for sending alerts is 5 seconds

What's in the HTTP request?

Wormly will make a single HTTP POST request to the specified URL, containing one POST variable: wormlyalert.

Depending on the data format you have specified, this variable will contain either an XML string, a JSON object, or a serialized PHP array.

What information is provided with the alert?

All three data formats include the following components:

hostid (integer)
A unique ID identifying the Wormly host from which the alert has been triggered.

isrecovery (integer)
0 if this alert indicates a failure, 1 if the alert indicates that the host has recovered from a prior failure.

downtime (integer)
The amount of time (in seconds) for which the host has been down.

alertlevel (integer)
A unique ID identifying the current alert escalation level.

alertlevel_name (string)
The textual name describing the current alert escalation level.

failedsensors (array)
An array of the hosts' sensors which have failed their tests.

Contents of "failedsensors" array elements

type (string)
The sensor type, e.g. HTTP, POP3, etc.

sensorid (integer)
A globally unique ID identifying this sensor.

message (string)
The error message indicating why this sensor failed the test.

XML Data Format

An example of this data in XML format is shown below:

<?xml version="1.0" encoding="UTF-8"?>
<wormlyalert>
    <hostid>5112</hostid>
    <isrecovery>0</isrecovery>
    <downtime>300</downtime>
    <alertlevel>2</alertlevel>
    <alertlevel_name>Continued Error</alertlevel_name>
    <failedsensors>
        <sensor>
            <type>HTTP</type>
            <sensorid>501</sensorid>
            <message>Failed to connect to TCP port 80.</message>
        </sensor>
    </failedsensors>
</wormlyalert>

Serialized PHP Array Format

To receive alerts with a PHP script, you simply need to unserialize the alert data as follows:

<?php
    $alertdata = unserialize($_POST["wormlyalert"]);
?>

JSON Object Format

There are libraries available for most platforms to parse JSON objects into native data structures. See JSON.org for more details.

Within PHP (versions 5.2 and later), the task is trivial:

<?php
    $alertdata = json_decode($_POST["wormlyalert"]);
?>

Downtime Hurts. Start monitoring and stop worrying.

Our server monitoring service continually tests your website to keep you online and performing fast. Fully-featured plans start from just $19 / month.

But don't listen to our spiel - Grab a free trial and decide for yourself »

See Also

Solution Spotlight

SitePoint

Mark Harbottle from SitePoint said:

We chose Wormly because website uptime is crucial to our business … A slow or unreachable website translates directly into revenue lost.Read on »

What are other people saying?

About Wormly

Wormly monitors your website infrastructure to keep you online and performing fast.

Be Alert. Stay in the loop with SMS, ICQ, MSN and email failure alerts.

Be Proactive. Performance monitoring reveals problems before they cause downtime.

Exceptional Value. With feature packed plans from just $19 a month you can afford the peace of mind that a professional uptime monitoring solution delivers.