Rancher alarms
138
Send notifications when something goes wrong in rancher
.json config setup for now)rancher-alarms:
image: ndelitski/rancher-alarms
environment:
ALARM_SLACK_WEBHOOK_URL=https://hooks.slack.com/services/:UUID
labels:
io.rancher.container.create_agent: true
io.rancher.container.agent.role: environment
How to create Slack Webhook URL
NOTE: Including rancher agent labels is crucial otherwise you need provide rancher credentials manually with RANCHER_* variables
docker rundocker run \
-d \
-e RANCHER_ADDRESS=rancher.yourdomain.com \
-e RANCHER_ACCESS_KEY=ACCESS-KEY \
-e RANCHER_SECRET_KEY=SECRET-KEY \
-e RANCHER_PROJECT_ID=1a8 \
-e ALARM_SLACK_WEBHOOK_URL=https://hooks.slack.com/services/YOUR_SLACK_UUID \
--name rancher-alarms \
ndelitski/rancher-alarms
On startup get a list of services and instantiate healthcheck monitor for each of them if service is in a running state. Removed, purged and etc services will be ignored
List of healthcheck monitors is updated with a pollServicesInterval interval. When service is removed it will be no longer monitored.
When a service transitions to a degraded state, all targets will be invoked to process notification(s).
rancher-alarms:
image: ndelitski/rancher-alarms
environment:
RANCHER_ADDRESS:your-rancher.com
ALARM_SLACK_WEBHOOK_URL:https://hooks.slack.com/services/...
More docker-compose examples see in examples
Could be ignored if you are running inside Rancher environment (service should be started as a rancher agent though)
RANCHER_ADDRESSRANCHER_PROJECT_IDRANCHER_ACCESS_KEYRANCHER_SECRET_KEYALARM_POLL_INTERVALALARM_MONITOR_INTERVALALARM_MONITOR_HEALTHY_THRESHOLDALARM_MONITOR_UNHEALTHY_THRESHOLDALARM_FILTERALARM_EMAIL_ADDRESSESALARM_EMAIL_USERALARM_EMAIL_PASSALARM_EMAIL_SSLALARM_EMAIL_SMTP_HOSTALARM_EMAIL_SMTP_PORTALARM_EMAIL_FROMALARM_EMAIL_SUBJECTALARM_EMAIL_TEMPLATEALARM_EMAIL_TEMPLATE_FILEALARM_SLACK_WEBHOOK_URLALARM_SLACK_CHANNELALARM_SLACK_BOTNAMEALARM_SLACK_TEMPLATEALARM_SLACK_TEMPLATE_FILESee examples using environment config in docker-compose files
{
"rancher": {
"address": "rancher-host:port",
"auth": {
"accessKey": "<ACCESS_KEY>",
"secretKey": "<KEEP_YOUR_SECRETS_SAFE>"
},
"projectId": "1a5"
},
"pollServicesInterval": 10000,
"filter": [
"app/*"
],
"notifications": {
"*": {
"targets": {
"email": {
"recipients": [
"[email protected]"
]
}
},
"healthcheck": {
"pollInterval": 5000,
"healthyThreshold": 2,
"unhealthyThreshold": 3
},
},
"frontend": {
"targets": {
"email": {
"recipients": [
"[email protected]"
]
}
}
}
},
"targets": {
"email": {
"smtp": {
"from": "<Alarm Service> [email protected]",
"auth": {
"user": "[email protected]",
"password": "Str0ngPa$$"
},
"host": "smtp.gmail.com",
"secureConnection": true,
"port": 465
}
},
"slack": {
"webhookUrl": "https://hooks.slack.com/services/YOUR_SLACK_UUID",
"botName": "rancher-alarm",
"channel": "#devops"
}
}
}
rancher Rancher API settings. requiredpollServicesInterval interval in ms of fetching list of services. required.filter whitelist filter for stack/services names in environment. List of string values. Every string is a RegExp expression so you can use something like this to match all stack services frontend/*. optionalnotifications per service notification settings. Wildcard means any service required
healtcheck monitoring state options. optional defaults are:{
pollInterval: 5000,
healthyThreshold: 2,
unhealthyThreshold: 3
}
targets what notification targets to use. Will override base target settings in a root targets section. Currently each target must be an Object value. If you have nothing to override from a base settings just place {} as a value. optionaltargets base settings for each notification target. requiredTODO: Add description
agent: true. No need to specify keys anymore!Content type
Image
Digest
Size
23 MB
Last updated
almost 10 years ago
docker pull digitallumberjack/rancher-alarms:v0.1.5