mirror of
https://codeberg.org/icewind/prometheus-edge-trigger.git
synced 2026-06-03 10:14:12 +02:00
add basic readme
This commit is contained in:
parent
8a7f023631
commit
c5043a6230
1 changed files with 28 additions and 0 deletions
28
README.md
28
README.md
|
|
@ -0,0 +1,28 @@
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[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
|
||||||
|
```
|
||||||
Loading…
Add table
Add a link
Reference in a new issue