Skip to content

Commit

Permalink
librenms: add agent
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcelCoding committed Oct 8, 2024
1 parent 5242f04 commit c9c94ad
Show file tree
Hide file tree
Showing 2 changed files with 681 additions and 3 deletions.
25 changes: 22 additions & 3 deletions modules/dd-ix/monitoring.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ pkgs, config, lib, ... }:
{ self, pkgs, config, lib, ... }:
let
cfg = config.dd-ix.monitoring;
in
Expand Down Expand Up @@ -47,15 +47,34 @@ in
};
};

networking.firewall.allowedTCPPorts = [ 9100 ] ++ (if cfg.smart.enable then [ 9101 ] else [ ]);
# 6556: checkmk librenms agent
networking.firewall.allowedTCPPorts = [ 9100 6556 ] ++ (if cfg.smart.enable then [ 9101 ] else [ ]);

# checkmk monitoring
users.users.root.openssh.authorizedKeys.keys =
let
checkMkAgent = pkgs.writeShellScriptBin "check_mk_agent.linux" (builtins.readFile ../../resources/check_mk_agent.linux);
checkMkAgent = pkgs.writeShellScriptBin "check_mk_agent.linux" (builtins.readFile (self + /resources/check_mk_agent.linux));
in
[
"restrict,pty,command=\"${lib.getExe checkMkAgent}\",from=\"2a01:7700:80b0:7002::6\",no-port-forwarding,no-X11-forwarding,no-agent-forwarding ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIL1qKvfDAIuNbMrQ37HHs8Dfo7nn/WKw1zcxv71o55w4 DD-IX Monitoring"
];

services.xinetd = {
enable = true;
services = [{
name = "check_mk_agent.librenms";
unlisted = true;
port = 6556;
protocol = "tcp";
user = "root";
server = self + /resources/check_mk_agent.librenms;
extraConfig = ''
socket_type = stream
bind = ::
wait = no
log_on_success =
'';
}];
};
};
}
Loading

0 comments on commit c9c94ad

Please sign in to comment.