Uptime Robot Monitors

Monitors

The monitors endpoint of the Uptime Robot API lets you get information about and also manage the monitors of a given account. The Skybrud.Social implementation does however currently sort reading.

Get a list of monitors

By requesting a list of monitors, you can information about each monitor such as their name, their status and current uptime in percent. The example below shows how you can print out this information in a Razor view:

@using Skybrud.Social.UptimeRobot
@using Skybrud.Social.UptimeRobot.Models.Monitors
@using Skybrud.Social.UptimeRobot.Responses.Monitors
@inherits WebViewPage<UptimeRobotService>

@{

    // Make the request to the API (with default options)
    UptimeRobotGetMonitorsResponse response = Model.Monitors.GetMonitors();

    // Get the list of monitors from the response body
    UptimeRobotMonitorsList body = response.Body;

    // Iterate through the monitors
    foreach (UptimeRobotMonitor monitor in body.Monitors) {

        <p>@monitor.FriendlyName: @monitor.Status</p>

    }

}

The response is paginated, and will return a maximum of 50 monitors per page. You can explore the UptimeRobotGetMonitorsOptions class for further options - including pagination:

@using Skybrud.Social.UptimeRobot
@using Skybrud.Social.UptimeRobot.Models.Monitors
@using Skybrud.Social.UptimeRobot.Options
@using Skybrud.Social.UptimeRobot.Responses.Monitors
@inherits WebViewPage<UptimeRobotService>

@{

    // Declare the options for the request
    UptimeRobotGetMonitorsOptions options = new UptimeRobotGetMonitorsOptions {
        Offset = 25,
        Limit = 25,
        Logs = true
    };

    // Make the request to the API
    UptimeRobotGetMonitorsResponse response = Model.Monitors.GetMonitors(options);

    // Get the list of monitors from the response body
    UptimeRobotMonitorsList body = response.Body;

    // Iterate through the monitors
    foreach (UptimeRobotMonitor monitor in body.Monitors) {

        <p>@monitor.FriendlyName: @monitor.Status</p>

    }

}

Notice that the Uptime Robot API currently has more options than available in this implementation.