mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 21:50:33 +03:00
nixos/pgscv: init
This commit is contained in:
parent
7cc85f9cf8
commit
80b437dfa7
2 changed files with 76 additions and 0 deletions
|
@ -962,6 +962,7 @@
|
||||||
./services/monitoring/opentelemetry-collector.nix
|
./services/monitoring/opentelemetry-collector.nix
|
||||||
./services/monitoring/osquery.nix
|
./services/monitoring/osquery.nix
|
||||||
./services/monitoring/parsedmarc.nix
|
./services/monitoring/parsedmarc.nix
|
||||||
|
./services/monitoring/pgscv.nix
|
||||||
./services/monitoring/prometheus/alertmanager-gotify-bridge.nix
|
./services/monitoring/prometheus/alertmanager-gotify-bridge.nix
|
||||||
./services/monitoring/prometheus/alertmanager-irc-relay.nix
|
./services/monitoring/prometheus/alertmanager-irc-relay.nix
|
||||||
./services/monitoring/prometheus/alertmanager-webhook-logger.nix
|
./services/monitoring/prometheus/alertmanager-webhook-logger.nix
|
||||||
|
|
75
nixos/modules/services/monitoring/pgscv.nix
Normal file
75
nixos/modules/services/monitoring/pgscv.nix
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
utils,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
inherit (lib)
|
||||||
|
mkEnableOption
|
||||||
|
mkIf
|
||||||
|
mkOption
|
||||||
|
mkPackageOption
|
||||||
|
types
|
||||||
|
;
|
||||||
|
|
||||||
|
cfg = config.services.pgscv;
|
||||||
|
|
||||||
|
settingsFormat = pkgs.formats.yaml { };
|
||||||
|
configFile = settingsFormat.generate "config.yaml" cfg.settings;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.services.pgscv = {
|
||||||
|
enable = mkEnableOption "pgSCV, a PostgreSQL ecosystem metrics collector";
|
||||||
|
|
||||||
|
package = mkPackageOption pkgs "pgscv" { };
|
||||||
|
|
||||||
|
logLevel = mkOption {
|
||||||
|
type = types.enum [
|
||||||
|
"debug"
|
||||||
|
"info"
|
||||||
|
"warn"
|
||||||
|
"error"
|
||||||
|
];
|
||||||
|
default = "info";
|
||||||
|
description = "Log level for pgSCV.";
|
||||||
|
};
|
||||||
|
|
||||||
|
settings = mkOption {
|
||||||
|
type = settingsFormat.type;
|
||||||
|
default = { };
|
||||||
|
description = ''
|
||||||
|
Configuration for pgSCV, in YAML format.
|
||||||
|
|
||||||
|
See [configuration reference](https://github.com/cherts/pgscv/wiki/Configuration-settings-reference).
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
systemd.services.pgscv = {
|
||||||
|
description = "pgSCV - PostgreSQL ecosystem metrics collector";
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
requires = [ "network-online.target" ];
|
||||||
|
after = [ "network-online.target" ];
|
||||||
|
path = [ pkgs.glibc ]; # shells out to getconf
|
||||||
|
|
||||||
|
serviceConfig = {
|
||||||
|
User = "postgres";
|
||||||
|
Group = "postgres";
|
||||||
|
ExecStart = utils.escapeSystemdExecArgs [
|
||||||
|
(lib.getExe cfg.package)
|
||||||
|
"--log-level=${cfg.logLevel}"
|
||||||
|
"--config-file=${configFile}"
|
||||||
|
];
|
||||||
|
KillMode = "control-group";
|
||||||
|
TimeoutSec = 5;
|
||||||
|
Restart = "on-failure";
|
||||||
|
RestartSec = 10;
|
||||||
|
OOMScoreAdjust = 1000;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue