Trigger http requests a set delay after an edge in a prometheus query
  • Rust 65.3%
  • Nix 32.8%
  • Dockerfile 1.9%
Find a file
2020-01-25 15:29:43 +01:00
src move delay option into trigger root 2020-01-25 14:55:53 +01:00
.dockerignore add Dockerfile 2020-01-25 15:29:43 +01:00
.gitignore init repo 2020-01-11 15:01:28 +01:00
Cargo.lock mdns from upstream 2020-01-25 15:27:10 +01:00
Cargo.toml mdns from upstream 2020-01-25 15:27:10 +01:00
config.toml move delay option into trigger root 2020-01-25 14:55:53 +01:00
Dockerfile add Dockerfile 2020-01-25 15:29:43 +01:00
README.md add basic readme 2020-01-25 14:56:01 +01:00

Prometheus edge trigger

Trigger http requests a set delay after an edge in a prometheus query.

Example

Given 2 wifi enabled switches that have their state logged into prometheus, automatically turn off switch2 5 minutes switch1 is turned off.

[prometheus]
url = "http://prometheus"

[[trigger]]
name = "Delay swtich"

[trigger.condition]
query = "switch_state{instance=\"$instance\"}"
from = 1
to = 0
params.instance = { type = "mdns", service = "_switch-http._tcp.local", host = "switch1" }

[trigger.action]
method = "PUT"
params.host = { type = "mdns", service = "_switch-http._tcp.local", host = "switch2" }
url = "http://$host/off"
delay = 300