Skip to content

Instantly share code, notes, and snippets.

@joeashcraft
Created July 6, 2016 18:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joeashcraft/28269589c179649ae740664156cd5696 to your computer and use it in GitHub Desktop.
Save joeashcraft/28269589c179649ae740664156cd5696 to your computer and use it in GitHub Desktop.
type : remote.http
label : HTTP WAN-IP example.com
disabled : false
period : 60
timeout : 30
target_alias : access_ip1_v4
monitoring_zones_poll : [ mzdfw, mziad, mzord, mzlon ]
details :
url : "http://example.com"
alarms :
alarm1 :
label : Connection Time
notification_plan_id : npManaged
criteria : |
if (metric['duration'] > 25000) {
return new AlarmStatus(CRITICAL, 'HTTP request took more than 25 seconds: #{duration} milliseconds');
}
if (metric['duration'] > 20000) {
return new AlarmStatus(WARNING, 'HTTP request took more than 20 seconds: #{duration} milliseconds');
}
return new AlarmStatus(OK, 'HTTP connection time is normal: #{duration} milliseconds');
alarm2 :
label : Status Code
notification_plan_id : npManaged
criteria : |
if (metric['code'] regex '[45][0-9][0-9]') {
return new AlarmStatus(CRITICAL, 'HTTP server responding with status code #{code}');
}
return new AlarmStatus(OK, 'HTTP server is functioning normally, returned #{code} status');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment