Skip to content

Instantly share code, notes, and snippets.

@cleverca22
Created March 24, 2017 20:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cleverca22/b2e79bcbc7e733e4f3b9cf471f230b84 to your computer and use it in GitHub Desktop.
Save cleverca22/b2e79bcbc7e733e4f3b9cf471f230b84 to your computer and use it in GitHub Desktop.
snmp example
{ pkgs, ... }:
let
passwords = import ./passwords.nix;
in
{
systemd.services.snmpd = let
snmpconfig = pkgs.writeTextFile {
name = "snmpd.conf";
text = ''
rocommunity ${passwords.snmp}
disk / 10000
extend cputemp ${pkgs.stdenv.shell} -c "${pkgs.acpi}/bin/acpi -t|egrep -o '[0-9\.]{3,}'"
'';
};
in {
description = "net-snmp daemon";
wantedBy = [ "multi-user.target" ];
serviceConfig = {
ExecStart = "${pkgs.net_snmp}/bin/snmpd -f -c ${snmpconfig}";
KillMode = "process";
Restart = "always";
};
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment