aboutsummaryrefslogtreecommitdiffstats
path: root/modules/by-name/mo/monitoring/components/scrutiny.nix
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--modules/by-name/mo/monitoring/components/scrutiny.nix100
1 files changed, 100 insertions, 0 deletions
diff --git a/modules/by-name/mo/monitoring/components/scrutiny.nix b/modules/by-name/mo/monitoring/components/scrutiny.nix
new file mode 100644
index 0000000..adb515e
--- /dev/null
+++ b/modules/by-name/mo/monitoring/components/scrutiny.nix
@@ -0,0 +1,100 @@
+{
+ config,
+ pkgs,
+ lib,
+ ...
+}: let
+ cfg = config.vhack.monitoring.scrutiny;
+in {
+ options.vhack.monitoring.scrutiny = {
+ enable = lib.mkEnableOption "scrutiny service";
+ };
+
+ # We don't currently _care_ about the health of the hardware, because hetzner does
+ # this for us (nor can we care, because it's not exposed in the VPS)
+ config = lib.mkIf false {
+ vhack.monitoring = {
+ prometheus.sources = [
+ {
+ name = "scrutiny";
+ extra.metrics_path = "/api/metrics";
+ target = "127.0.0.1:${toString config.services.scrutiny.settings.web.listen.port}";
+ }
+ {
+ name = "smartctl";
+ target = "127.0.0.1:${toString config.services.prometheus.exporters.smartctl.port}";
+ }
+ ];
+ grafana.dashboards = [
+ ../dashboards/Health.json
+ ];
+ };
+
+ users = {
+ groups = {
+ smartctl-exporter-access.gid = config.vhack.constants.ids.gids.smartctl-exporter-access;
+ };
+ users = {
+ smartctl-exporter-access = {
+ isSystemUser = true;
+ group = "smartctl-exporter-access";
+ uid = config.vhack.constants.ids.uids.smartctl-exporter-access;
+ };
+ };
+ };
+
+ 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;
+ };
+ };
+ prometheus = {
+ exporters.smartctl = {
+ enable = true;
+ port = 9115;
+ listenAddress = "127.0.0.1";
+ };
+ };
+ };
+
+ # 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=";
+ # };
+ # })
+ # ];
+ };
+}