Compare commits
3 commits
524edd90ed
...
290f541c5f
Author | SHA1 | Date | |
---|---|---|---|
290f541c5f | |||
1142f10c18 | |||
9454d21bbd |
3 changed files with 57 additions and 5 deletions
|
@ -44,7 +44,28 @@ in {
|
||||||
check_for_updates = false;
|
check_for_updates = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
# users.allow_signup = false;
|
users.allow_signup = false;
|
||||||
|
};
|
||||||
|
provision = {
|
||||||
|
enable = true;
|
||||||
|
datasources.settings = {
|
||||||
|
datasources = [
|
||||||
|
(mkIf config.modules.system.services.database.postgresql.enable {
|
||||||
|
name = "Prometheus";
|
||||||
|
type = "prometheus";
|
||||||
|
access = "proxy";
|
||||||
|
url = "http://127.0.0.1:4024";
|
||||||
|
isDefault = true;
|
||||||
|
})
|
||||||
|
|
||||||
|
(mkIf config.modules.system.services.prometheus.enable {
|
||||||
|
name = "PostgreSQL";
|
||||||
|
type = "postgres";
|
||||||
|
access = "proxy";
|
||||||
|
url = "http://127.0.0.1:${toString config.services.prometheus.port}";
|
||||||
|
})
|
||||||
|
];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
services.nginx = {
|
services.nginx = {
|
||||||
|
|
26
modules/services/monitoring/loki/module.nix
Normal file
26
modules/services/monitoring/loki/module.nix
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.modules) mkIf;
|
||||||
|
inherit (lib.options) mkEnableOption;
|
||||||
|
|
||||||
|
cfg = config.modules.system.services.loki;
|
||||||
|
port = 4026;
|
||||||
|
dataDir = "/srv/data/loki";
|
||||||
|
in {
|
||||||
|
options.modules.system.services.loki.enable = mkEnableOption "Grafana, a graphing service";
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
services.loki = {
|
||||||
|
enable = true;
|
||||||
|
package = pkgs.loki;
|
||||||
|
|
||||||
|
configuration = {
|
||||||
|
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -13,10 +13,6 @@ in {
|
||||||
options.modules.system.services.prometheus.enable = mkEnableOption "Grafana, a graphing service";
|
options.modules.system.services.prometheus.enable = mkEnableOption "Grafana, a graphing service";
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
networking.firewall.allowedTCPPorts = [config.services.grafana.settings.server.http_port];
|
|
||||||
|
|
||||||
modules.system.services.database.postgresql.enable = true;
|
|
||||||
|
|
||||||
services.prometheus = {
|
services.prometheus = {
|
||||||
enable = true;
|
enable = true;
|
||||||
package = pkgs.prometheus;
|
package = pkgs.prometheus;
|
||||||
|
@ -34,6 +30,10 @@ in {
|
||||||
port = 4024;
|
port = 4024;
|
||||||
user = "postgres";
|
user = "postgres";
|
||||||
};
|
};
|
||||||
|
nginx = {
|
||||||
|
enable = true;
|
||||||
|
port = 4025;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
scrapeConfigs = [
|
scrapeConfigs = [
|
||||||
{
|
{
|
||||||
|
@ -51,6 +51,11 @@ in {
|
||||||
scrape_interval = "30s";
|
scrape_interval = "30s";
|
||||||
static_configs = [{targets = ["localhost:${toString config.services.prometheus.exporters.postgres.port}"];}];
|
static_configs = [{targets = ["localhost:${toString config.services.prometheus.exporters.postgres.port}"];}];
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
job_name = "nginx";
|
||||||
|
scrape_interval = "30s";
|
||||||
|
static_configs = [{targets = ["localhost:${toString config.services.prometheus.exporters.nginx.port}"];}];
|
||||||
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue