nixos/hosts/vm/victoriametrics/rules/switch.nix

82 lines
1.8 KiB
Nix

{ critical, warning, ... }:
{
alerts.SwitchPromiscuousChange = {
expr = ''
changes(last_over_time(ifPromiscuousMode[1h])[5m]) > 0
'';
for = "0m";
labels = warning;
annotations = {
Interface = "{{ $labels.ifName }}";
Alias = "{{ $labels.ifAlias }}";
};
};
alerts.SwitchInErrors = {
expr = ''
rate(ifInErrors[15m]) / (
rate(ifInUcastPkts[15m])
+ rate(ifInNUcastPkts[15m])
+ rate(ifInErrors[15m])
) > 0.0001
'';
for = "15m";
labels = warning;
annotations = {
ErrorRate = "{{ $value | humanizePercentage }}";
Interface = "{{ $labels.ifName }}";
Alias = "{{ $labels.ifAlias }}";
};
};
alerts.SwitchOutErrors = {
expr = ''
rate(ifOutErrors[15m]) / (
rate(ifOutUcastPkts[15m])
+ rate(ifOutNUcastPkts[15m])
+ rate(ifOutErrors[15m])
) > 0.0001
'';
for = "15m";
labels = warning;
annotations = {
ErrorRate = "{{ $value | humanizePercentage }}";
Interface = "{{ $labels.ifName }}";
Alias = "{{ $labels.ifAlias }}";
};
};
alerts.SwitchInLinkUsage = {
expr = ''
rate(ifHCInOctets[5m]) / (
(ifHighSpeed > 0) * 1000000 / 8
) > 0.8
'';
for = "5m";
keep_firing_for = "10m";
labels = warning;
annotations = {
Usage = "{{ $value | humanizePercentage }}";
Interface = "{{ $labels.ifName }}";
Alias = "{{ $labels.ifAlias }}";
};
};
alerts.SwitchOutLinkUsage = {
expr = ''
rate(ifHCOutOctets[5m]) / (
(ifHighSpeed > 0) * 1000000 / 8
) > 0.8
'';
for = "5m";
keep_firing_for = "10m";
labels = warning;
annotations = {
Usage = "{{ $value | humanizePercentage }}";
Interface = "{{ $labels.ifName }}";
Alias = "{{ $labels.ifAlias }}";
};
};
}