Skip to content

Instantly share code, notes, and snippets.

@zshamrock
Last active December 16, 2016 16:18
Show Gist options
  • Save zshamrock/6cd9427db5e9f8b803988a0c8c4fa327 to your computer and use it in GitHub Desktop.
Save zshamrock/6cd9427db5e9f8b803988a0c8c4fa327 to your computer and use it in GitHub Desktop.
CPU Alert TICK script
stream
// Select just the cpu measurement from our example database.
|from()
.measurement('cpu')
|alert()
.message('{{ .Level }}: CPU idle usage is above 80% threshold @ {{ index .Tags "host" }}')
.crit(lambda: "usage_idle" > 80)
// Whenever we get an alert write it to a file.
.log('/var/log/alerts.log')
// And send a notification to Slack
.slack()
.channel('#influx-alerts')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment