View provides examples alarms for the various checks in the system. They are presented as a template with parameters. Each of the parameters is documented with a type, name and description. There are quite a few different examples in the system.
| Verb | URI | Description | |||||
| GET | /alarm_examples | Return a list of alarm examples. | |||||
There are no parameters for this call.
Normal Response Code: 200
Error Response Codes: 401, 403, 500, 503
This list contains a complete picture of all the example alarms. There is extra information provided in the api such as the list of fields. Within the field is also a small description and type.
Example 4.102. List Alarm Examples Response: JSON
{
"values": [
{
"id": "remote.http_body_match_1",
"label": "Body match - string found",
"description": "Alarm which returns CRITICAL if the provided string is found in the body",
"check_type": "remote.http",
"criteria": "if (metric['body_match'] regex '${string}') {\n return new AlarmStatus(CRITICAL, '${string} found, returning CRITICAL.');\n}\n",
"fields": [
{
"name": "string",
"description": "String to check for in the body",
"type": "string"
}
]
},
{
"id": "remote.http_body_match_missing_string",
"label": "Body match - string not found",
"description": "Alarm which returns CRITICAL if the provided string is not found in the body",
"check_type": "remote.http",
"criteria": "if (metric['body_match'] == '') {\n return new AlarmStatus(CRITICAL, 'HTTP response did not contain the correct content.');\n}\n\nreturn new AlarmStatus(OK, 'HTTP response contains the correct content');\n",
"fields": []
},
{
"id": "remote.http_connection_time",
"label": "Connection time",
"description": "Alarm which returns WARNING or CRITICAL based on the connection time",
"check_type": "remote.http",
"criteria": "if (metric['duration'] > ${critical_threshold}) {\n return new AlarmStatus(CRITICAL, 'HTTP request took more than ${critical_threshold} milliseconds.');\n}\n\nif (metric['duration'] > ${warning_threshold}) {\n return new AlarmStatus(WARNING, 'HTTP request took more than ${warning_threshold} milliseconds.');\n}\n\nreturn new AlarmStatus(OK, 'HTTP connection time is normal');\n",
"fields": [
{
"name": "warning_threshold",
"description": "Warning threshold (in milliseconds) for the connection time",
"type": "integer"
},
{
"name": "critical_threshold",
"description": "Critical threshold (in milliseconds) for the connection time",
"type": "integer"
}
]
},
{
"id": "remote.http_status_code",
"label": "Status code",
"description": "Alarm which returns WARNING if the server responses with 4xx status code or CRITICAL if it responds with 5xx status code",
"check_type": "remote.http",
"criteria": "if (metric['code'] regex '4[0-9][0-9]') {\n return new AlarmStatus(CRITICAL, 'HTTP server responding with 4xx status');\n}\n\nif (metric['code'] regex '5[0-9][0-9]') {\n return new AlarmStatus(CRITICAL, 'HTTP server responding with 5xx status');\n}\n\nreturn new AlarmStatus(OK, 'HTTP server is functioning normally');\n",
"fields": []
},
{
"id": "remote.http_cert_expiration",
"label": "SSL certificate expiration time",
"description": "Alarm which returns WARNING or CRITICAL based on the certificate expiration date",
"check_type": "remote.http",
"criteria": "if (metric['cert_end_in'] < ${critical_threshold}) {\n return new AlarmStatus(CRITICAL, 'Cert expiring in less than ${critical_threshold} seconds.');\n}\n\nif (metric['cert_end_in'] < ${warning_threshold}) {\n return new AlarmStatus(WARNING, 'Cert expiring in less than ${warning_threshold} seconds.');\n}\n\nreturn new AlarmStatus(OK, 'HTTP certificate doesn\\'t expire soon.');\n",
"fields": [
{
"name": "warning_threshold",
"description": "Warning threshold (in seconds) for the certificate expiration",
"type": "integer"
},
{
"name": "critical_threshold",
"description": "Critical threshold (in seconds) for the certificate expiration",
"type": "integer"
}
]
},
{
"id": "remote.dns_address_match",
"label": "DNS record address match",
"description": "Alarm which returns CRITICAL if the DNS record is not resolved to the provided address",
"check_type": "remote.dns",
"criteria": "# Match if the 127... address was in the resolution\n# if it wasn't than default to CRITICAL\n\nif (metric['answer'] regex '.*${address}.*') {\n return new AlarmStatus(OK, 'Resolved the correct address!');\n}\nreturn new AlarmStatus(CRITICAL);\n",
"fields": [
{
"name": "address",
"description": "Address to which the DNS record must resolve to",
"type": "string"
}
]
},
{
"id": "remote.ssh_banner_match",
"label": "SSH banner match",
"description": "Alarm which returns CRITICAL if the service listening on SSH port doesn't return a valid banner",
"check_type": "remote.ssh",
"criteria": "/* Have the check match at the edge */\nif (metric['banner_matched'] != '') {\n return new AlarmStatus(OK);\n}\n\n/* Or use the regex parser in the\n language to build multiple matches\n in a single alarm. */\nif (metric['banner'] regex 'OpenSSH.*') {\n return new AlarmStatus(OK);\n}\n\nreturn new AlarmStatus(CRITICAL, 'Match not found.');\n",
"fields": []
},
{
"id": "remote.ssh_fingerprint_match",
"label": "SSH fingerprint match",
"description": "Alarm which returns CRITICAL if the SSH fingerprint doesn't match the provided one",
"check_type": "remote.ssh",
"criteria": "if (metric['fingerprint'] != '${fingerprint}') {\n return new AlarmStatus(CRITICAL, 'SSH fingerprint didn\\'t match the expected one ${fingerprint}');\n}\n\nreturn new AlarmStatus(OK, 'Got expected SSH fingerprint (${fingerprint})');\n",
"fields": [
{
"name": "fingerprint",
"description": "Expected SSH fingerprint",
"type": "string"
}
]
},
{
"id": "remote.ping_packet_loss",
"label": "Ping packet loss",
"description": "Alarm which returns WARNING if the packet loss is greater than 5% and CRITICAL if it's greater than 20%",
"check_type": "remote.ping",
"criteria": "if (metric['available'] < 80) {\n return new AlarmStatus(CRITICAL, 'Packet loss is greater than 20%');\n}\n\nif (metric['available'] < 95) {\n return new AlarmStatus(WARNING, 'Packet loss is greater than 5%');\n}\n\nreturn new AlarmStatus(OK, 'Packet loss is normal');\n",
"fields": []
},
{
"id": "remote.tcp_connection_time",
"label": "Connection time",
"description": "Alarm which returns WARNING or CRITICAL based on the connection time",
"check_type": "remote.tcp",
"criteria": "if (metric['duration'] > ${critical_threshold}) {\n return new AlarmStatus(CRITICAL, 'TCP Connection took more than ${critical_threshold} milliseconds.');\n}\n\nif (metric['duration'] > ${warning_threshold}) {\n return new AlarmStatus(WARNING, 'TCP Connection took more than ${warning_threshold} milliseconds.');\n}\n\nreturn new AlarmStatus(OK, 'TCP connection time is normal');\n",
"fields": [
{
"name": "warning_threshold",
"description": "Warning threshold (in seconds) for the connection time",
"type": "integer"
},
{
"name": "critical_threshold",
"description": "Critical threshold (in seconds) for the connection time",
"type": "integer"
}
]
},
{
"id": "remote.dns_spf_record_include_match",
"label": "SPF TXT record",
"description": "Alarm which returns CRITICAL if the SPF record doesn't contain an include clause with the provided domain.",
"check_type": "remote.dns",
"criteria": "if (metric['answer'] regex 'v=spf1.* include:${domain} .*[~|-]all') {\n return new AlarmStatus(OK, 'SPF record with include clause for domain ${domain} exists');\n}\n\nreturn new AlarmStatus(CRITICAL, 'SPF record doesn\\'t contain an include clause for domain ${domain}');\n",
"fields": [
{
"name": "domain",
"description": "Domain to check for",
"type": "string"
}
]
},
{
"id": "remote.dns_dkim_public_key_match",
"label": "DKIM TXT record",
"description": "Alarm which returns CRITICAL if the DKIM record doesn't contain or match the provided public key.",
"check_type": "remote.dns",
"criteria": "if (metric['answer'] regex '.*p=${public_key}$') {\n return new AlarmStatus(OK, 'DKIM record contains a provided public key');\n}\n\nreturn new AlarmStatus(CRITICAL, 'DKIM record doesn\\'t contain a provided public key');\n",
"fields": [
{
"name": "public_key",
"description": "Public key to check for. Note: Special characters must be escaped.",
"type": "string"
}
]
},
{
"id": "agent.cpu_usage_average",
"label": "CPU usage",
"description": "Alarm which returns CRITICAL, WARNING or OK based upon average CPU usage",
"check_type": "agent.cpu",
"criteria": "if (metric['usage_average'] > ${critical_threshold}) {\n return new AlarmStatus(CRITICAL, 'CPU usage is #{usage_average}%');\n}\n\nif (metric['usage_average'] > ${warning_threshold}) {\n return new AlarmStatus(WARNING, 'CPU usage is #{usage_average}%');\n}\n\nreturn new AlarmStatus(OK, 'CPU usage is #{usage_average}%');\n",
"fields": [
{
"name": "critical_threshold",
"description": "CPU usage percentage above which CRITICAL is returned",
"type": "whole number (may be zero padded)"
},
{
"name": "warning_threshold",
"description": "CPU usage percentage above which WARNING is returned",
"type": "whole number (may be zero padded)"
}
]
},
{
"id": "agent.memory_usage",
"label": "Memory usage",
"description": "Alarm which returns CRITICAL, WARNING or OK based upon memory usage",
"check_type": "agent.memory",
"criteria": "if (percentage(metric['actual_used'], metric['total']) > ${critical_threshold}) {\n return new AlarmStatus(CRITICAL, 'Memory usage is above ${critical_threshold}%');\n}\n\nif (percentage(metric['actual_used'], metric['total']) > ${warning_threshold}) {\n return new AlarmStatus(WARNING, 'Memory usage is above ${warning_threshold}%');\n}\n\nreturn new AlarmStatus(OK, 'Memory usage is below ${warning_threshold}%');\n",
"fields": [
{
"name": "critical_threshold",
"description": "Memory usage percentage above which CRITICAL is returned",
"type": "whole number (may be zero padded)"
},
{
"name": "warning_threshold",
"description": "Memory usage percentage above which WARNING is returned",
"type": "whole number (may be zero padded)"
}
]
},
{
"id": "agent.filesystem_usage",
"label": "Filesystem usage",
"description": "Alarm which returns CRITICAL, WARNING or OK based upon filesystem usage",
"check_type": "agent.filesystem",
"criteria": "if (percentage(metric['used'], metric['total']) > ${critical_threshold}) {\n return new AlarmStatus(CRITICAL, 'Disk usage is above ${critical_threshold}%');\n}\n\nif (percentage(metric['used'], metric['total']) > ${warning_threshold}) {\n return new AlarmStatus(WARNING, 'Disk usage is above ${warning_threshold}%');\n}\n\nreturn new AlarmStatus(OK, 'Disk usage is below ${warning_threshold}%');\n",
"fields": [
{
"name": "mount_point",
"description": "The mount point of the filesystem to alert on",
"type": "string"
},
{
"name": "critical_threshold",
"description": "Filesystem usage percentage above which CRITICAL is returned",
"type": "whole number (may be zero padded)"
},
{
"name": "warning_threshold",
"description": "Filesystem usage percentage above which WARNING is returned",
"type": "whole number (may be zero padded)"
}
]
},
{
"id": "agent.network_transmit_rate",
"label": "Network transmit rate",
"description": "Alarm which returns CRITICAL, WARNING or OK based upon network transmit rate",
"check_type": "agent.network",
"criteria": "if (rate(metric['tx_bytes']) > ${critical_threshold}) {\n return new AlarmStatus(CRITICAL, 'Network receive rate on ${interface} has exceeded ${critical_threshold} bytes/second');\n}\n\nif (rate(metric['tx_bytes']) > ${warning_threshold}) {\n return new AlarmStatus(WARNING, 'Network receive rate on ${interface} has exceeded ${warning_threshold} bytes/second');\n}\n\nreturn new AlarmStatus(OK, 'Network transmit rate on ${interface} is less than ${warning_threshold} bytes/second');\n",
"fields": [
{
"name": "interface",
"description": "The network interface to alert on",
"type": "string"
},
{
"name": "critical_threshold",
"description": "Network transmit rate, in bytes per second, above which CRITICAL is returned",
"type": "whole number (may be zero padded)"
},
{
"name": "warning_threshold",
"description": "Network transmit rate, in bytes per second, above which WARNING is returned",
"type": "whole number (may be zero padded)"
}
]
},
{
"id": "agent.network_receive_rate",
"label": "Network receive",
"description": "Alarm which returns CRITICAL, WARNING or OK based upon network receive rate",
"check_type": "agent.network",
"criteria": "if (rate(metric['rx_bytes']) > ${critical_threshold}) {\n return new AlarmStatus(CRITICAL, 'Network receive rate on ${interface} has exceeded ${critical_threshold} bytes/second');\n}\n\nif (rate(metric['rx_bytes']) > ${warning_threshold}) {\n return new AlarmStatus(WARNING, 'Network receive rate on ${interface} has exceeded ${warning_threshold} bytes/second');\n}\n\nreturn new AlarmStatus(OK, 'Network receive rate on ${interface} is less than ${warning_threshold} bytes/second');\n",
"fields": [
{
"name": "interface",
"description": "The network interface to alert on",
"type": "string"
},
{
"name": "critical_threshold",
"description": "Network receive rate, in bytes per second, above which CRITICAL is returned",
"type": "whole number (may be zero padded)"
},
{
"name": "warning_threshold",
"description": "Network receive rate, in bytes per second, above which WARNING is returned",
"type": "whole number (may be zero padded)"
}
]
}
],
"metadata": {
"count": 17,
"limit": null,
"marker": null,
"next_marker": null,
"next_href": null
}
}
Example 4.103. List Alarm Examples Response: XML
<?xml version="1.0" encoding="utf-8"?>
<container>
<values>
<alarm_template id="remote.http_body_match_1">
<label>Body match - string found</label>
<description>Alarm which returns CRITICAL if the provided string is found in the body</description>
<check_type>remote.http</check_type>
<criteria>if (metric['body_match'] regex '${string}') {
return new AlarmStatus(CRITICAL, '${string} found, returning CRITICAL.');
}
</criteria>
<fields>
<field>
<name>string</name>
<description>String to check for in the body</description>
<type>string</type>
</field>
</fields>
</alarm_template>
<alarm_template id="remote.http_body_match_missing_string">
<label>Body match - string not found</label>
<description>Alarm which returns CRITICAL if the provided string is not found in the body</description>
<check_type>remote.http</check_type>
<criteria>if (metric['body_match'] == '') {
return new AlarmStatus(CRITICAL, 'HTTP response did not contain the correct content.');
}
return new AlarmStatus(OK, 'HTTP response contains the correct content');
</criteria>
<fields/>
</alarm_template>
<alarm_template id="remote.http_connection_time">
<label>Connection time</label>
<description>Alarm which returns WARNING or CRITICAL based on the connection time</description>
<check_type>remote.http</check_type>
<criteria>if (metric['duration'] > ${critical_threshold}) {
return new AlarmStatus(CRITICAL, 'HTTP request took more than ${critical_threshold} milliseconds.');
}
if (metric['duration'] > ${warning_threshold}) {
return new AlarmStatus(WARNING, 'HTTP request took more than ${warning_threshold} milliseconds.');
}
return new AlarmStatus(OK, 'HTTP connection time is normal');
</criteria>
<fields>
<field>
<name>warning_threshold</name>
<description>Warning threshold (in milliseconds) for the connection time</description>
<type>integer</type>
</field>
<field>
<name>critical_threshold</name>
<description>Critical threshold (in milliseconds) for the connection time</description>
<type>integer</type>
</field>
</fields>
</alarm_template>
<alarm_template id="remote.http_status_code">
<label>Status code</label>
<description>Alarm which returns WARNING if the server responses with 4xx status code or CRITICAL if it responds with 5xx status code</description>
<check_type>remote.http</check_type>
<criteria>if (metric['code'] regex '4[0-9][0-9]') {
return new AlarmStatus(CRITICAL, 'HTTP server responding with 4xx status');
}
if (metric['code'] regex '5[0-9][0-9]') {
return new AlarmStatus(CRITICAL, 'HTTP server responding with 5xx status');
}
return new AlarmStatus(OK, 'HTTP server is functioning normally');
</criteria>
<fields/>
</alarm_template>
<alarm_template id="remote.http_cert_expiration">
<label>SSL certificate expiration time</label>
<description>Alarm which returns WARNING or CRITICAL based on the certificate expiration date</description>
<check_type>remote.http</check_type>
<criteria>if (metric['cert_end_in'] < ${critical_threshold}) {
return new AlarmStatus(CRITICAL, 'Cert expiring in less than ${critical_threshold} seconds.');
}
if (metric['cert_end_in'] < ${warning_threshold}) {
return new AlarmStatus(WARNING, 'Cert expiring in less than ${warning_threshold} seconds.');
}
return new AlarmStatus(OK, 'HTTP certificate doesn\'t expire soon.');
</criteria>
<fields>
<field>
<name>warning_threshold</name>
<description>Warning threshold (in seconds) for the certificate expiration</description>
<type>integer</type>
</field>
<field>
<name>critical_threshold</name>
<description>Critical threshold (in seconds) for the certificate expiration</description>
<type>integer</type>
</field>
</fields>
</alarm_template>
<alarm_template id="remote.dns_address_match">
<label>DNS record address match</label>
<description>Alarm which returns CRITICAL if the DNS record is not resolved to the provided address</description>
<check_type>remote.dns</check_type>
<criteria># Match if the 127... address was in the resolution
# if it wasn't than default to CRITICAL
if (metric['answer'] regex '.*${address}.*') {
return new AlarmStatus(OK, 'Resolved the correct address!');
}
return new AlarmStatus(CRITICAL);
</criteria>
<fields>
<field>
<name>address</name>
<description>Address to which the DNS record must resolve to</description>
<type>string</type>
</field>
</fields>
</alarm_template>
<alarm_template id="remote.ssh_banner_match">
<label>SSH banner match</label>
<description>Alarm which returns CRITICAL if the service listening on SSH port doesn't return a valid banner</description>
<check_type>remote.ssh</check_type>
<criteria>/* Have the check match at the edge */
if (metric['banner_matched'] != '') {
return new AlarmStatus(OK);
}
/* Or use the regex parser in the
language to build multiple matches
in a single alarm. */
if (metric['banner'] regex 'OpenSSH.*') {
return new AlarmStatus(OK);
}
return new AlarmStatus(CRITICAL, 'Match not found.');
</criteria>
<fields/>
</alarm_template>
<alarm_template id="remote.ssh_fingerprint_match">
<label>SSH fingerprint match</label>
<description>Alarm which returns CRITICAL if the SSH fingerprint doesn't match the provided one</description>
<check_type>remote.ssh</check_type>
<criteria>if (metric['fingerprint'] != '${fingerprint}') {
return new AlarmStatus(CRITICAL, 'SSH fingerprint didn\'t match the expected one ${fingerprint}');
}
return new AlarmStatus(OK, 'Got expected SSH fingerprint (${fingerprint})');
</criteria>
<fields>
<field>
<name>fingerprint</name>
<description>Expected SSH fingerprint</description>
<type>string</type>
</field>
</fields>
</alarm_template>
<alarm_template id="remote.ping_packet_loss">
<label>Ping packet loss</label>
<description>Alarm which returns WARNING if the packet loss is greater than 5% and CRITICAL if it's greater than 20%</description>
<check_type>remote.ping</check_type>
<criteria>if (metric['available'] < 80) {
return new AlarmStatus(CRITICAL, 'Packet loss is greater than 20%');
}
if (metric['available'] < 95) {
return new AlarmStatus(WARNING, 'Packet loss is greater than 5%');
}
return new AlarmStatus(OK, 'Packet loss is normal');
</criteria>
<fields/>
</alarm_template>
<alarm_template id="remote.tcp_connection_time">
<label>Connection time</label>
<description>Alarm which returns WARNING or CRITICAL based on the connection time</description>
<check_type>remote.tcp</check_type>
<criteria>if (metric['duration'] > ${critical_threshold}) {
return new AlarmStatus(CRITICAL, 'TCP Connection took more than ${critical_threshold} milliseconds.');
}
if (metric['duration'] > ${warning_threshold}) {
return new AlarmStatus(WARNING, 'TCP Connection took more than ${warning_threshold} milliseconds.');
}
return new AlarmStatus(OK, 'TCP connection time is normal');
</criteria>
<fields>
<field>
<name>warning_threshold</name>
<description>Warning threshold (in seconds) for the connection time</description>
<type>integer</type>
</field>
<field>
<name>critical_threshold</name>
<description>Critical threshold (in seconds) for the connection time</description>
<type>integer</type>
</field>
</fields>
</alarm_template>
<alarm_template id="remote.dns_spf_record_include_match">
<label>SPF TXT record</label>
<description>Alarm which returns CRITICAL if the SPF record doesn't contain an include clause with the provided domain.</description>
<check_type>remote.dns</check_type>
<criteria>if (metric['answer'] regex 'v=spf1.* include:${domain} .*[~|-]all') {
return new AlarmStatus(OK, 'SPF record with include clause for domain ${domain} exists');
}
return new AlarmStatus(CRITICAL, 'SPF record doesn\'t contain an include clause for domain ${domain}');
</criteria>
<fields>
<field>
<name>domain</name>
<description>Domain to check for</description>
<type>string</type>
</field>
</fields>
</alarm_template>
<alarm_template id="remote.dns_dkim_public_key_match">
<label>DKIM TXT record</label>
<description>Alarm which returns CRITICAL if the DKIM record doesn't contain or match the provided public key.</description>
<check_type>remote.dns</check_type>
<criteria>if (metric['answer'] regex '.*p=${public_key}$') {
return new AlarmStatus(OK, 'DKIM record contains a provided public key');
}
return new AlarmStatus(CRITICAL, 'DKIM record doesn\'t contain a provided public key');
</criteria>
<fields>
<field>
<name>public_key</name>
<description>Public key to check for. Note: Special characters must be escaped.</description>
<type>string</type>
</field>
</fields>
</alarm_template>
<alarm_template id="agent.cpu_usage_average">
<label>CPU usage</label>
<description>Alarm which returns CRITICAL, WARNING or OK based upon average CPU usage</description>
<check_type>agent.cpu</check_type>
<criteria>if (metric['usage_average'] > ${critical_threshold}) {
return new AlarmStatus(CRITICAL, 'CPU usage is #{usage_average}%');
}
if (metric['usage_average'] > ${warning_threshold}) {
return new AlarmStatus(WARNING, 'CPU usage is #{usage_average}%');
}
return new AlarmStatus(OK, 'CPU usage is #{usage_average}%');
</criteria>
<fields>
<field>
<name>critical_threshold</name>
<description>CPU usage percentage above which CRITICAL is returned</description>
<type>whole number (may be zero padded)</type>
</field>
<field>
<name>warning_threshold</name>
<description>CPU usage percentage above which WARNING is returned</description>
<type>whole number (may be zero padded)</type>
</field>
</fields>
</alarm_template>
<alarm_template id="agent.memory_usage">
<label>Memory usage</label>
<description>Alarm which returns CRITICAL, WARNING or OK based upon memory usage</description>
<check_type>agent.memory</check_type>
<criteria>if (percentage(metric['actual_used'], metric['total']) > ${critical_threshold}) {
return new AlarmStatus(CRITICAL, 'Memory usage is above ${critical_threshold}%');
}
if (percentage(metric['actual_used'], metric['total']) > ${warning_threshold}) {
return new AlarmStatus(WARNING, 'Memory usage is above ${warning_threshold}%');
}
return new AlarmStatus(OK, 'Memory usage is below ${warning_threshold}%');
</criteria>
<fields>
<field>
<name>critical_threshold</name>
<description>Memory usage percentage above which CRITICAL is returned</description>
<type>whole number (may be zero padded)</type>
</field>
<field>
<name>warning_threshold</name>
<description>Memory usage percentage above which WARNING is returned</description>
<type>whole number (may be zero padded)</type>
</field>
</fields>
</alarm_template>
<alarm_template id="agent.filesystem_usage">
<label>Filesystem usage</label>
<description>Alarm which returns CRITICAL, WARNING or OK based upon filesystem usage</description>
<check_type>agent.filesystem</check_type>
<criteria>if (percentage(metric['used'], metric['total']) > ${critical_threshold}) {
return new AlarmStatus(CRITICAL, 'Disk usage is above ${critical_threshold}%');
}
if (percentage(metric['used'], metric['total']) > ${warning_threshold}) {
return new AlarmStatus(WARNING, 'Disk usage is above ${warning_threshold}%');
}
return new AlarmStatus(OK, 'Disk usage is below ${warning_threshold}%');
</criteria>
<fields>
<field>
<name>mount_point</name>
<description>The mount point of the filesystem to alert on</description>
<type>string</type>
</field>
<field>
<name>critical_threshold</name>
<description>Filesystem usage percentage above which CRITICAL is returned</description>
<type>whole number (may be zero padded)</type>
</field>
<field>
<name>warning_threshold</name>
<description>Filesystem usage percentage above which WARNING is returned</description>
<type>whole number (may be zero padded)</type>
</field>
</fields>
</alarm_template>
<alarm_template id="agent.network_transmit_rate">
<label>Network transmit rate</label>
<description>Alarm which returns CRITICAL, WARNING or OK based upon network transmit rate</description>
<check_type>agent.network</check_type>
<criteria>if (rate(metric['tx_bytes']) > ${critical_threshold}) {
return new AlarmStatus(CRITICAL, 'Network receive rate on ${interface} has exceeded ${critical_threshold} bytes/second');
}
if (rate(metric['tx_bytes']) > ${warning_threshold}) {
return new AlarmStatus(WARNING, 'Network receive rate on ${interface} has exceeded ${warning_threshold} bytes/second');
}
return new AlarmStatus(OK, 'Network transmit rate on ${interface} is less than ${warning_threshold} bytes/second');
</criteria>
<fields>
<field>
<name>interface</name>
<description>The network interface to alert on</description>
<type>string</type>
</field>
<field>
<name>critical_threshold</name>
<description>Network transmit rate, in bytes per second, above which CRITICAL is returned</description>
<type>whole number (may be zero padded)</type>
</field>
<field>
<name>warning_threshold</name>
<description>Network transmit rate, in bytes per second, above which WARNING is returned</description>
<type>whole number (may be zero padded)</type>
</field>
</fields>
</alarm_template>
<alarm_template id="agent.network_receive_rate">
<label>Network receive</label>
<description>Alarm which returns CRITICAL, WARNING or OK based upon network receive rate</description>
<check_type>agent.network</check_type>
<criteria>if (rate(metric['rx_bytes']) > ${critical_threshold}) {
return new AlarmStatus(CRITICAL, 'Network receive rate on ${interface} has exceeded ${critical_threshold} bytes/second');
}
if (rate(metric['rx_bytes']) > ${warning_threshold}) {
return new AlarmStatus(WARNING, 'Network receive rate on ${interface} has exceeded ${warning_threshold} bytes/second');
}
return new AlarmStatus(OK, 'Network receive rate on ${interface} is less than ${warning_threshold} bytes/second');
</criteria>
<fields>
<field>
<name>interface</name>
<description>The network interface to alert on</description>
<type>string</type>
</field>
<field>
<name>critical_threshold</name>
<description>Network receive rate, in bytes per second, above which CRITICAL is returned</description>
<type>whole number (may be zero padded)</type>
</field>
<field>
<name>warning_threshold</name>
<description>Network receive rate, in bytes per second, above which WARNING is returned</description>
<type>whole number (may be zero padded)</type>
</field>
</fields>
</alarm_template>
</values>
<metadata>
<count>17</count>
<limit/>
<marker/>
<next_marker/>
<next_href/>
</metadata>
</container>
| Verb | URI | Description | |||||
| GET | /alarm_examples/alarmExampleId |
Get a specific alarm example. | |||||
There are no parameters for this call.
Normal Response Code: 200
Error Response Codes: 401, 403, 500, 503
This call returns a single alarm example.
Example 4.104. Get Alarm Examples Response: JSON
{
"id": "remote.http_body_match_1",
"label": "Body match - string found",
"description": "Alarm which returns CRITICAL if the provided string is found in the body",
"check_type": "remote.http",
"criteria": "if (metric['body_match'] regex '${string}') {\n return new AlarmStatus(CRITICAL, '${string} found, returning CRITICAL.');\n}\n",
"fields": [
{
"name": "string",
"description": "String to check for in the body",
"type": "string"
}
]
}
Example 4.105. Get Alarm Examples Response: XML
<?xml version="1.0" encoding="utf-8"?>
<alarm_template id="remote.http_body_match_1">
<label>Body match - string found</label>
<description>Alarm which returns CRITICAL if the provided string is found in the body</description>
<check_type>remote.http</check_type>
<criteria>if (metric['body_match'] regex '${string}') {
return new AlarmStatus(CRITICAL, '${string} found, returning CRITICAL.');
}
</criteria>
<fields>
<field>
<name>string</name>
<description>String to check for in the body</description>
<type>string</type>
</field>
</fields>
</alarm_template>
| Verb | URI | Description | |||||
| POST | /alarm_examples/alarmExampleId |
Evaluate a specific alarm example. | |||||
The parameters are specific to the alarm example.
Normal Response Code: 200
Error Response Codes: 401, 403, 500, 503
This call evaluates the template of a single alarm example. It takes arbitrary key/value pairs as specified by the fields section of the list call of the API. You then can evaluate the alarm example with a POST to the specific endpoint.
Example evaluating of a remote.http body match against '12345'. POST to https://monitoring.api.rackspacecloud.com/v1.0/tenantId/alarm_examples/remote.http_body_match_1
Example 4.107. Evaluate Alarm Example Response: JSON
{
"bound_criteria": "if (metric['body_match'] regex '12345') {\n return new AlarmStatus(CRITICAL, '12345 found, returning CRITICAL.');\n}\n"
}

