Skip to content

Commit

Permalink
init monitoring module
Browse files Browse the repository at this point in the history
  • Loading branch information
brainrake committed Sep 10, 2024
1 parent 3eb9384 commit 3be1fbf
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 0 deletions.
44 changes: 44 additions & 0 deletions modules/monitoring.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
config,
lib,
...
}: let
cfg = config.cardano.http;
inherit (lib) mkIf mkDefault mkEnableOption optional;
in {
options.cardano.http = {
enable = mkEnableOption ''
Monitoring via Prometheus and Grafana
'';
};
config = mkIf cfg.enable {
services.prometheus = {
enable = true;

# scrapeConfigs = { };

webExternalUrl = "https://prometheus.${config.networking.hostName}.${config.networking.domainName}";

alertmanager = {
enable = true;
webExternalUrl = "https://alerts.${config.networking.hostName}.${config.networking.domainName}";
};
};

services.grafana = {
enable = true;
settings = {
server = {
domain = "status.staging.mlabs.city";
http_addr = "127.0.0.1";
http_port = 2342;
root_url = "https://${config.services.grafana.settings.server.domain}:443/";
};
security = {
admin_user = "admin";
admin_password = "CHANGEME_uDZ2isTf";
};
};
};
};
}
1 change: 1 addition & 0 deletions tests/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
./ctl-8.nix
./blockfrost.nix
./oura.nix
./monitoring.nix
];
}
23 changes: 23 additions & 0 deletions tests/monitoring.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
perSystem.vmTests.tests.monitoring = {
impure = true;
module = {
nodes.machine = {pkgs, ...}: {
cardano = {
network = "preview";
node.enable = true;
monitoring.enable = true;
};

environment.systemPackages = with pkgs; [jq bc];
};

testScript = ''
machine.wait_for_unit("cardano-node")
# TODO
machine.succeed("false")
print('\nVM Test Succeeded.')
'';
};
};
}

0 comments on commit 3be1fbf

Please sign in to comment.