mirror of
https://codeberg.org/icewind/prometheus-edge-trigger.git
synced 2026-06-03 18:24:10 +02:00
move delay option into trigger root
This commit is contained in:
parent
fe92c27bc6
commit
8a7f023631
4 changed files with 4 additions and 4 deletions
0
README.md
Normal file
0
README.md
Normal file
|
|
@ -3,6 +3,7 @@ url = "http://astoria:9291"
|
|||
|
||||
[[trigger]]
|
||||
name = "VR Charging"
|
||||
delay = 300
|
||||
|
||||
[trigger.condition]
|
||||
query = "switch_state{instance=\"$instance\"}"
|
||||
|
|
@ -13,5 +14,4 @@ params.instance = { type = "mdns", service = "_switch-http._tcp.local", host = "
|
|||
[trigger.action]
|
||||
method = "PUT"
|
||||
params.host = { type = "mdns", service = "_switch-http._tcp.local", host = "vr_switch" }
|
||||
url = "http://$host/off"
|
||||
delay = 300
|
||||
url = "http://$host/off"
|
||||
|
|
@ -54,7 +54,6 @@ pub struct Action {
|
|||
pub method: Method,
|
||||
pub params: HashMap<String, Parameter>,
|
||||
pub url: String,
|
||||
pub delay: u64,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize)]
|
||||
|
|
@ -72,6 +71,7 @@ pub struct PrometheusConfig {
|
|||
#[derive(Debug, Clone, Deserialize)]
|
||||
pub struct Trigger {
|
||||
pub name: String,
|
||||
pub delay: u64,
|
||||
pub condition: Condition,
|
||||
pub action: Action,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ impl TriggerManager {
|
|||
}
|
||||
|
||||
async fn run_trigger(&self, trigger: &Trigger) -> Result<(), MainError> {
|
||||
let delay = trigger.action.delay;
|
||||
let delay = trigger.delay;
|
||||
let delay_duration = Duration::from_secs(delay);
|
||||
let error_delay = Duration::from_secs(15);
|
||||
loop {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue