Any entity that you create can have many checks, each monitoring a different aspect of the entity. You create several new checks in this exercise.
First, create a PING check to verify the web server is responding. Use the following attributes:
labelAssigns a meaningful name to the check. In the examples below, we've named the check "Website check 1". You can choose a different name or use the same one.
typeSpecifies the type of check you're creating.
monitoring_zones_pollSpecifies the monitoring zones that will launch the check. In this example we'll use "mzdfw".
timeoutSpecifies the timeout in seconds for the check. This has to be less than the period.
periodSpecifies the period in seconds for the check. This specifies how often Cloud Monitoring collectors run this check.
target_aliasResolves the check to an IP address.
Example 3.11. Create a PING Check Request: cURL
curl -i \
--data-binary \
'{ "details" : { },
"label" : "Website check 1",
"monitoring_zones_poll" : [ "mzdfw" ],
"period" : "60",
"target_alias" : "default",
"timeout" : 30,
"type" : "remote.ping"
}' \
-H "X-Auth-Token: auth_token" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
'https://monitoring.api.rackspacecloud.com/v1.0/010101/entities/enn14Ch5mc/checks' Example 3.12. Create Ping Check Response: cURL
HTTP/1.1 201 Created Date: Fri, 24 Feb 2012 06:28:51 GMT Location: https://monitoring.api.rackspacecloud.com/v1.0/010101/entities/enn14Ch5mc/checks/chyYWNw59I X-RateLimit-Limit: 50000 X-RateLimit-Remaining: 49969 X-RateLimit-Window: 24 hours X-RateLimit-Type: global X-Response-Id: .rh-9pAY.h-lon3-maas-prod-api1.r-2ruPuxLu.c-99739.ts-1330064931513.v-c576983 X-LB: lon3-maas-prod-api1 Content-Length: 0 Content-Type: text/plain
If the check is successfully created, the endpoint
returns a response code of 201
and a Location: Header containing the URL of
the check. In this example, the check id is chyYWNw59I, but
yours will be different.
If an error message is returned, the monitoring system was unable to create the check. For information about errors, see the Rackspace Cloud Monitoring Developers Guide.
![]() | Note |
|---|---|
Checks always have a parent entity associated with them. Therefore all check URLs are contained underneath the entity URL. For example, if the ID of the entity we created earlier is enn14Ch5mc, the check URLs would be underneath https://monitoring.api.rackspacecloud.com/v1.0/010101/entities/enn14Ch5mc/. |
Example 3.13. Create a PING Check Request: raxmon
raxmon-checks-create --entity-id=enn14Ch5mc --type=remote.ping --label="Website check 1" --monitoring-zones=mzdfw --timeout=30 --period=60 --target-alias=default
NEXT UP: Test the new check to make sure it works.
Testing the check runs the check once and lists the check's metrics. This is an easy way to verify and view your metrics. Later, you can use the test check output to help you build alarms.
Example 3.15. Create Test Check Request: cURL
curl -i \
--data-binary \
'{ "details" : { },
"label" : "Website check 1",
"monitoring_zones_poll" : [ "mzdfw" ],
"period" : "60",
"target_alias" : "default",
"timeout" : 30,
"type" : "remote.ping"
}' \
-H 'X-Auth-Token: auth_code' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
'https://monitoring.api.rackspacecloud.com/v1.0/010101/entities/enn14Ch5mc/test-check/' Example 3.16. Create Test Check Response: cURL
HTTP/1.1 200 OK
X-Ratelimit-Remaining: 497
X-Response-Id: .rh-VE2m.h-lon3-maas-prod-api0.r-pm6oiwjm.c-37726.ts-1329263604920.v-3aec925
Transfer-Encoding: chunked
Vary: Accept-Encoding
X-Lb: lon3-maas-prod-api1
X-Ratelimit-Type: test_check
X-Ratelimit-Limit: 500
Date: Tue, 14 Feb 2012 23:53:24 GMT
X-Ratelimit-Window: 24 hours
Content-Type: application/json; charset=UTF-8
[
{
"timestamp": 1329263613579,
"monitoring_zone_id": "mzdfw",
"available": true,
"status": "cnt=5,avail=100,min=0.0018,max=0.0020,avg=0.0019",
"metrics": {
"minimum": {
"type": "n",
"data": "1.808000029996e-03"
},
"available": {
"type": "n",
"data": "1.000000000000e+02"
},
"maximum": {
"type": "n",
"data": "1.990000018850e-03"
},
"count": {
"type": "i",
"data": "5"
},
"average": {
"type": "n",
"data": "1.866600010544e-03"
}
}
}
]Example 3.17. Test Check Request: raxmon
raxmon-checks-test --entity-id=enn14Ch5mc --type=remote.ping --monitoring-zones=mzdfw --timeout=30 --period=60 --target-alias=default
Example 3.18. Test Check Response: raxmon
[{u'available': True, u'timestamp': 1329334696399,
u'monitoring_zone_id': u'mzdfw',
u'status': u'cnt=5,avail=100,min=0.0018,max=0.0020,avg=0.0019',
u'metrics': {u'count': {u'data': u'5', u'type': u'i'},
u'available': {u'data': u'1.000000000000e+02', u'type': u'n'},
u'average': {u'data': u'1.874800003134e-03', u'type': u'n'},
u'minimum': {u'data': u'1.803999999538e-03', u'type': u'n'},
u'maximum': {u'data': u'2.022000029683e-03', u'type': u'n'}}}]NEXT UP: A PING check doesn't tell you if your web server is running, it only tells you that the server is up. So, let's create an HTTP check to monitor the website directly.
The HTTP check attempts to retrieve the given URL from the server's IP address. Since an HTTP server might host pages for multiple, different domain names on a single IP address, the check needs a full URL to know which server name and which URL to examine. Likewise, a heavy traffic site might have multiple HTTP servers for the same domain name. The HTTP check lets you monitor each individual web server.
Example 3.19. Create HTTP Check Request: cURL
curl -i -X POST \
--data-binary \
'{ "details" : { "body" : "foo",
"method" : "GET",
"url" : "www.examples.org"
},
"label" : "Website check 1",
"monitoring_zones_poll" : [ "mzdfw" ],
"period" : "60",
"target_alias" : "default",
"type" : "remote.http"
}' \
-H 'X-Auth-Token: auth_token' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
'https://monitoring.api.rackspacecloud.com/v1.0/010101/entities/enn14Ch5mc/checks'
Example 3.20. Create HTTP Check Response cURL
HTTP/1.1 201 Created X-Ratelimit-Remaining: 49960 X-Response-Id: .rh-vgB4.h-ord1-maas-prod-api1.r-W0REfAoy.c-2650.ts-1329337042872.v-b9d7626 Content-Length: 0 X-Lb: ord1-maas-prod-api0 X-Ratelimit-Type: global X-Ratelimit-Limit: 50000 Location: https://monitoring.api.rackspacecloud.com/v1.0/010101/entities/enn14Ch5mc/checks/chTTslRf7v Date: Wed, 15 Feb 2012 20:17:22 GMT X-Ratelimit-Window: 24 hours Content-Type: text/plain
Example 3.21. Create HTTP Check Request: raxmon
raxmon-checks-create --entity-id=enn14Ch5mc --type=remote.http --label="Website check 1" --monitoring-zones=mzdfw --details=url=www.examples.org,body=foo,method=GET timeout=30 --period=60 --target-alias=default
NEXT UP: Now let's configure a second HTTP check to monitor a different page on the web server.
Example 3.23. Create a Second HTTP Check Request: cURL
curl -i -X POST \
--data-binary \
'{ "details" : { "body" : "foo",
"method" : "GET",
"url" : "www.examples.org/test/"
},
"label" : "RemoteHTTP for Test page",
"monitoring_zones_poll" : [ "mzdfw" ],
"period" : "60",
"target_alias" : "default",
"timeout" : "30",
"type" : "remote.http"
}' \
-H 'X-Auth-Token: auth_token' \
-H "Content-Type: application/json" \
-H 'Accept: application/json' \
'https://monitoring.api.rackspacecloud.com/v1.0/010101/entities/enn14Ch5mc/checksExample 3.24. Create a Second HTTP Check Response: cURL
HTTP/1.1 201 Created X-Ratelimit-Remaining: 49957 X-Response-Id: .rh-pBYi.h-lon3-maas-prod-api0.r-5VLDWtbw.c-4363.ts-1329346442692.v-b9d7626 Content-Length: 0 X-Lb: lon3-maas-prod-api0 X-Ratelimit-Type: global X-Ratelimit-Limit: 50000 Location: https://monitoring.api.rackspacecloud.com/v1.0/010101/entities/enn14Ch5mc/checks/ch4ccHWyyI Date: Wed, 15 Feb 2012 22:54:02 GMT X-Ratelimit-Window: 24 hours Content-Type: text/plain
Example 3.25. Create a Second HTTP Check Request: raxmon
raxmon-checks-create --entity-id=enn14Ch5mc --type=remote.http --label="RemoteHTTP for Test page" --monitoring-zones=mzdfw --details=url=www.examples.org/test/,body=foo,method=GET --timeout=30 --period=60 --target-alias=default
NEXT UP: Get a list of the checks you've created for your entity.

![[Note]](/cm-v1.0-cm-getting-started/common/images/admon/note.png)
