MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / make_alert

Function make_alert

nodedb/src/event/alert/executor.rs:277–299  ·  view source on GitHub ↗
(name: &str)

Source from the content-addressed store, hash-verified

275 use crate::event::alert::types::{AlertCondition, CompareOp};
276
277 fn make_alert(name: &str) -> AlertDef {
278 AlertDef {
279 tenant_id: 1,
280 name: name.into(),
281 collection: "sensor_data".into(),
282 where_filter: Some("device_type = 'compressor'".into()),
283 condition: AlertCondition {
284 agg_func: "avg".into(),
285 column: "temperature".into(),
286 op: CompareOp::Gt,
287 threshold: 90.0,
288 },
289 group_by: vec!["device_id".into()],
290 window_ms: 300_000,
291 fire_after: 3,
292 recover_after: 2,
293 severity: "critical".into(),
294 notify_targets: Vec::new(),
295 enabled: true,
296 owner: "admin".into(),
297 created_at: 0,
298 }
299 }
300
301 #[test]
302 fn next_interval_uses_shortest() {

Callers 2

next_interval_minimum_1sFunction · 0.70

Calls

no outgoing calls

Tested by 2

next_interval_minimum_1sFunction · 0.56