39 lines
1.3 KiB
Nix
39 lines
1.3 KiB
Nix
{ config, pkgs, lib, ... }:
|
|
{
|
|
imports = [
|
|
./rules/cpu_usage.nix
|
|
./rules/disk_usage.nix
|
|
./rules/host_down.nix
|
|
./rules/inode_usage.nix
|
|
./rules/ram_usage.nix
|
|
];
|
|
|
|
# Standard vmalert service configuration
|
|
services.vmalert = {
|
|
enable = true;
|
|
settings = {
|
|
"datasource.url" = "http://localhost:8428"; # VictoriaMetrics address
|
|
"notifier.url" = [ "http://localhost:3001/api/alertmanager/grafana/api/v2/alerts" ]; # Must be a list of strings
|
|
};
|
|
# 'rules' is now set by the mkMerge block above.
|
|
};
|
|
|
|
# Override the User and Group for the systemd service managed by the official vmalert module.
|
|
systemd.services.vmalert = {
|
|
serviceConfig = {
|
|
User = "victoriametrics";
|
|
Group = "victoriametrics";
|
|
};
|
|
};
|
|
|
|
# Ensure the user/group itself exists on the system.
|
|
users.users.victoriametrics = lib.mkIf (config.services.victoriametrics.enable || config.services.vmalert.enable) {
|
|
isSystemUser = true;
|
|
group = "victoriametrics"; # Primary group for the user
|
|
home = "/var/lib/victoriametrics"; # Standard home for VictoriaMetrics components
|
|
};
|
|
users.groups.victoriametrics = lib.mkIf (config.services.victoriametrics.enable || config.services.vmalert.enable) {
|
|
# Ensures the group exists.
|
|
};
|
|
}
|