blob: 31871cd9fe847de5c1a97baffd3d340e40b419da (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
{
config,
pkgs,
lib,
...
}: let
cfg = config.vhack.monitoring.scrutiny;
in {
options.vhack.monitoring.scrutiny = {
enable = lib.mkEnableOption "scrutiny service";
fqdn = lib.mkOption {
type = lib.types.nullOr lib.types.str;
description = ''
If a string, this will be the domain under which the scrutiny web interface will be servced.
If null, the web interface will not be served and only the prometheus metrics will be accessible.
'';
};
};
config = {
vhack.monitoring = {
prometheus.sources = [
{
name = "scrutiny";
extra.metrics_path = "/api/metrics";
target = "127.0.0.1:${toString config.services.scrutiny.settings.web.listen.port}";
}
];
grafana.dashboards = [
../dashboards/Health.json
];
};
services = {
scrutiny = {
enable = true;
openFirewall = false;
# This src includes Prometheus metrics exporter.
package = pkgs.scrutiny.overrideAttrs {
src = pkgs.fetchFromGitHub {
owner = "ibizaman";
repo = "scrutiny";
rev = "74faf06f77df83f29e7e1806cd88b2fafc0bbb82";
hash = "sha256-r0AVWL+E046xHxitwMPfRNTOpjuOk+W6tB41YgmLTPg=";
};
vendorHash = "sha256-kAlnlWnBMFCdgdak5L5hRquRtyLi5MTmDa/kxwqPs4E=";
};
settings = {
web = {
metrics.enabled = true; # Enables Prometheus exporter
listenHost = "127.0.0.1";
};
};
collector = {
enable = true;
};
};
# nginx.statusPage = lib.mkDefault config.services.nginx.enable;
nginx = lib.mkIf (cfg.fqdn != null) {
virtualHosts."${cfg.fqdn}" = {
locations."/".proxyPass = "http://127.0.0.1:${toString config.services.scrutiny.settings.web.listen.port}";
enableACME = true;
forceSSL = true;
};
};
netdata = {
enable = true;
config = {
# web.mode = "none";
# web."bind to" = "127.0.0.1:19999";
global = {
"debug log" = "syslog";
"access log" = "syslog";
"error log" = "syslog";
};
};
};
};
# nixpkgs.overlays = [
# (final: prev: {
# prometheus-systemd-exporter = prev.prometheus-systemd-exporter.overrideAttrs {
# src = final.fetchFromGitHub {
# owner = "ibizaman";
# repo = prev.prometheus-systemd-exporter.pname;
# # rev = "v${prev.prometheus-systemd-exporter.version}";
# rev = "next_timer";
# sha256 = "sha256-jzkh/616tsJbNxFtZ0xbdBQc16TMIYr9QOkPaeQw8xA=";
# };
#
# vendorHash = "sha256-4hsQ1417jLNOAqGkfCkzrmEtYR4YLLW2j0CiJtPg6GI=";
# };
# })
# ];
};
}
|