59 lines
1.5 KiB
Nix
59 lines
1.5 KiB
Nix
{ lib, pkgs, config, ... }:
|
|
{
|
|
grafanaAlertRuleDefinitions = [
|
|
{
|
|
uid = "amzebs-phpfpm-service-down-alert-uid";
|
|
title = "PHP-FPM Service Down on amzebs-01";
|
|
condition = "C";
|
|
data = [
|
|
{
|
|
refId = "A";
|
|
relativeTimeRange = {
|
|
from = 300;
|
|
to = 0;
|
|
};
|
|
datasourceUid = "vm-datasource-uid";
|
|
model = {
|
|
editorMode = "code";
|
|
expr = "node_systemd_unit_state{state=\"active\", name=~\"phpfpm-.*\\\\.service\", instance=\"amzebs-01:9100\"} OR on() vector(0)";
|
|
hide = false;
|
|
intervalMs = 1000;
|
|
legendFormat = "__auto";
|
|
maxDataPoints = 43200;
|
|
range = true;
|
|
refId = "A";
|
|
};
|
|
}
|
|
{
|
|
refId = "B";
|
|
datasourceUid = "__expr__";
|
|
model = {
|
|
type = "reduce";
|
|
expression = "A";
|
|
reducer = "min";
|
|
};
|
|
}
|
|
{
|
|
refId = "C";
|
|
datasourceUid = "__expr__";
|
|
model = {
|
|
type = "math";
|
|
expression = "$B < 1";
|
|
};
|
|
}
|
|
];
|
|
noDataState = "Alerting";
|
|
execErrState = "Alerting";
|
|
for = "5m";
|
|
annotations = {
|
|
description = "One or more PHP-FPM services are down on amzebs-01";
|
|
summary = "PHP-FPM Service Down on amzebs-01";
|
|
};
|
|
labels = {
|
|
severity = "critical";
|
|
host = "amzebs-01";
|
|
};
|
|
}
|
|
];
|
|
}
|