dwef
This commit is contained in:
parent
768196e2bb
commit
2936f9b197
29 changed files with 496 additions and 82 deletions
|
@ -1,3 +1,4 @@
|
|||
{
|
||||
|
||||
transmission-exporter = import ./transmission-exporter.nix;
|
||||
plex-exporter = import ./plex-exporter.nix;
|
||||
}
|
||||
|
|
34
modules/nixos/plex-exporter.nix
Normal file
34
modules/nixos/plex-exporter.nix
Normal file
|
@ -0,0 +1,34 @@
|
|||
{ config, pkgs, lib, ... }: let
|
||||
cfg = config.services.plex-exporter;
|
||||
in {
|
||||
options.services.plex-exporter = {
|
||||
enable = lib.mkEnableOption "enables plex exporter";
|
||||
|
||||
configFile = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
default = "http://localhost:32400";
|
||||
};
|
||||
|
||||
listenAddress = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = ":9594";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
systemd.services.plex-exporter = {
|
||||
enable = true;
|
||||
after = [ "network.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
description = "Plex exporter for Prometheus";
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
User = "nobody";
|
||||
Group = "nobody";
|
||||
Restart = "always";
|
||||
ExecStart = "${pkgs.local-pkgs.plex-exporter}/bin/plex_exporter --listen-address ${cfg.listenAddress} --config-path ${cfg.configFile}";
|
||||
RuntimeDirectory = "plex-exporter";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
61
modules/nixos/transmission-exporter.nix
Normal file
61
modules/nixos/transmission-exporter.nix
Normal file
|
@ -0,0 +1,61 @@
|
|||
{ config, pkgs, lib, ... }: let
|
||||
cfg = config.services.transmission-exporter;
|
||||
in {
|
||||
options.services.transmission-exporter = {
|
||||
enable = lib.mkEnableOption "enables transmission exporter";
|
||||
|
||||
web_path = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "/metrics";
|
||||
description = "Path for metrics";
|
||||
};
|
||||
|
||||
web_addr = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = ":19091";
|
||||
description = "Address for this exporter to run";
|
||||
};
|
||||
|
||||
transmission_addr = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "http://localhost:9091";
|
||||
description = "Transmission address to connect with";
|
||||
};
|
||||
|
||||
transmission_username = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "";
|
||||
description = "Transmission username";
|
||||
};
|
||||
|
||||
transmission_password = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "";
|
||||
description = "Transmission password";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
systemd.services.transmission-exporter = {
|
||||
enable = true;
|
||||
after = [ "network.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
description = "Transmission exporter for Prometheus";
|
||||
environment = {
|
||||
WEB_PATH = cfg.web_path;
|
||||
WEB_ADDR = cfg.web_addr;
|
||||
TRANSMISSION_ADDR = cfg.transmission_addr;
|
||||
TRANSMISSION_USERNAME = cfg.transmission_username;
|
||||
TRANSMISSION_PASSWORD = cfg.transmission_password;
|
||||
};
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
User = "nobody";
|
||||
Group = "nobody";
|
||||
Restart = "always";
|
||||
ExecStart = "${pkgs.local-pkgs.transmission-exporter}/bin/transmission-exporter";
|
||||
RuntimeDirectory = "transmission-exporter";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue