apiVersion: 1 # List of alert rule UIDs that should be deleted deleteRules: {{ if not (env "ALERT_NODE_DISK_SPACE_LEFT") }} - orgId: 1 uid: coopcloud_node_disk_space_left {{ end }} {{ if not (env "ALERT_NODE_MEMORY_USAGE") }} - orgId: 1 uid: coopcloud_node_memory_usage {{ end }} groups: - orgId: 1 name: node folder: node interval: 5m rules: {{ if (env "ALERT_NODE_DISK_SPACE_LEFT") }} - uid: coopcloud_node_disk_space_left title: Node Disk Space condition: C data: - refId: A relativeTimeRange: from: 600 to: 0 datasourceUid: PBFA97CFB590B2093 model: editorMode: code expr: (node_filesystem_free_bytes{fstype=~"ext4|xfs"} / node_filesystem_size_bytes{fstype=~"ext4|xfs"}) * 100 instant: true intervalMs: 1000 legendFormat: __auto maxDataPoints: 43200 range: false refId: A - refId: C relativeTimeRange: from: 600 to: 0 datasourceUid: __expr__ model: conditions: - evaluator: params: - {{ env "ALERT_NODE_DISK_SPACE_LEFT" }} type: lt operator: type: and query: params: - C reducer: params: [] type: last type: query datasource: type: __expr__ uid: __expr__ expression: A intervalMs: 1000 maxDataPoints: 43200 refId: C type: threshold noDataState: NoData execErrState: Error for: 5m annotations: description: "" runbook_url: "" summary: Less than {{ env "ALERT_NODE_DISK_SPACE_LEFT" }}% disk space left on {{`{{ $labels.instance }}`}} ({{`{{ (index $values "A").Value }}`}}% left) labels: "": "" isPaused: false {{ end }} {{ if (env "ALERT_NODE_MEMORY_USAGE") }} - uid: coopcloud_node_memory_usage title: Node Memory Usage condition: C data: - refId: A relativeTimeRange: from: 600 to: 0 datasourceUid: PBFA97CFB590B2093 model: editorMode: code expr: (node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes) * 100 instant: true intervalMs: 1000 legendFormat: __auto maxDataPoints: 43200 range: false refId: A - refId: C relativeTimeRange: from: 600 to: 0 datasourceUid: __expr__ model: conditions: - evaluator: params: - {{ env "ALERT_NODE_MEMORY_USAGE" }} type: gt operator: type: and query: params: - C reducer: params: [] type: last type: query datasource: type: __expr__ uid: __expr__ expression: A intervalMs: 1000 maxDataPoints: 43200 refId: C type: threshold noDataState: NoData execErrState: Error for: 5m annotations: summary: Memory usage is above {{ env "ALERT_NODE_MEMORY_USAGE" }}% on {{`{{ $labels.instance }}`}} ({{`{{ printf "%.2f" (index $values "A").Value }}`}}% usage) isPaused: false {{ end }}