Rackspace Cloud Monitoring Integration

Rackspace Cloud Monitoring a flexible and highly scalable solution that empowers customers to track the health of their infrastructure  - including websites, ports and protocols. The service provides real time alerts allowing customers to react quickly and help prevent downtime.  With Rackspace Cloud Monitoring, customers can easily monitor their infrastructure whether it’s hosted on-premise, off-premise, with any cloud provider or any location across the globe.

By sending Rackspace Cloud Monitoring alerts to OpsGenie, you can leverage the full support of OpsGenie notification functionality. With OpsGenie you can receive your notifications through email, SMS, phone call, iPhone and Android push notifications, populate your alerts with extra information using attachment files and keep track of the whole alert cycle.

Rackspace supports email and web hook notification types. Although you can send your alerts via email, OpsGenie provides a web hook API for Rackspace Cloud Monitoring to create alerts directly in OpsGenie servers. The steps below describes how to integrate Rackspace and OpsGenie using web hook notifications:

  • Create an OpsGenie API Integration, copy the integration apiKey, and update your Rackspace account's "webhook_token" property.
    curl -i -X PUT \
    -d '{ "webhook_token" : "your_api_integration_key" }' \
    -H 'X-Auth-Token: rackspace_auth_token' \
    -H 'Content-Type: application/json' \
    'https://monitoring.api.rackspacecloud.com/v1.0/1234/account'
  • Create a web hook notification in Rackspace Cloud Monitoring using "https://api.opsgenie.com/v1/json/rackspace" URL provided by OpsGenie API, and use this notification in your notification plans. You can specify the users and/or group of users (comma separated) who will be notified by OpsGenie using the "recipients" url parameter. If not provided all users will be notified.
    curl -i -X POST \
    -d '{ "details" : { "url" : "https://api.opsgenie.com/v1/json/rackspace?    recipients=john.smith@mycompany.com,operationsgroup" },
      "label" : "opsgenie web hook",
      "type" : "webhook"
    }' \
    -H 'X-Auth-Token: rackspace_auth_token' \
    -H 'Content-Type: application/json' \
    'https://monitoring.api.rackspacecloud.com/v1.0/1234/notifications'

That's all. Now you can receive your Rackspace alerts as SMS, phone calls, iPhone or Android push notifications thanks to OpsGenie's powerful alerting system.

Let's demonstrate our integration with the following simple scenario:

  • I will create an entity in Rackspace Cloud Monitoring for my web server running on port 8080.
    curl -i -X POST \
    -d '{ "ip_addresses" : { "default" : "78.187.83.242" },
      "label" : "My Web Server"
    }' \
    -H 'X-Auth-Token: rackspace_auth_token' \
    -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    'https://monitoring.api.rackspacecloud.com/v1.0/1234/entities/'
  • Then create an http check
    curl -i -X POST \
    -d' { "details" : {"method" : "GET",
      "url" : "http://78.187.83.242:8080/"
    },
      "label" : "web server status check",
      "monitoring_zones_poll" : [ "mzlon" ],
      "period" : "60",
      "target_alias" : "default",
      "type" : "remote.http"
    }' \
    -H 'X-Auth-Token: rackspace_auth_token' \
    -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    'https://monitoring.api.rackspacecloud.com/v1.0/1234/entities/en41F9wnvg/checks'
  • Create OpsGenie web hook notification
    curl -i -X POST \
    -d '{ "details" : { "url" : "https://api.opsgenie.com/v1/json/rackspace?recipients=all" },
      "label" : "opsgenie web hook",
      "type" : "webhook"
    }' \
    -H 'X-Auth-Token: rackspace_auth_token' \
    -H 'Content-Type: application/json' \
    'https://monitoring.api.rackspacecloud.com/v1.0/1234/notifications'
  • Create a notification plan using OpsGenie web hook notification
    curl -i -X POST \
    -d '{
      "label": "Notification Plan 1",
      "warning_state": [
        "ntWArqzcoK"
      ],
      "critical_state": [
        "ntWArqzcoK"
      ],
      "ok_state": [
        "ntWArqzcoK"
      ]
    }' \
    -H 'X-Auth-Token: rackspace_auth_token' \
    -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    'https://monitoring.api.rackspacecloud.com/v1.0/1234/notification_plans'
  • and finally create an alarm with my notification plan, for HTTP error codes coming from my web server.
    curl -i -X POST \
    -d '{ "check_id" : "chTfxuO8lm",
      "criteria" : "if (metric[\"code\"] regex \"^[23]..$\") { return OK } return WARNING",
      "notification_plan_id" : "npMuW2B1YL"
    }' \
    -H 'X-Auth-Token: rackspace_auth_token' \
    -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    'https://monitoring.api.rackspacecloud.com/v1.0/1234/entities/en41F9wnvg/alarms'

When I shut down my web server, Rackspace Cloud Monitoring detects the failure and creates an OpsGenie alert like the following: