nixos/librenms: enableLocalBilling + memory limit for cronjobs (#361153)

authored by Alexander Sieg and committed by GitHub 75763a2f c6400fbd

+24 -5
+24 -5
nixos/modules/services/monitoring/librenms.nix
··· 14 14 log_errors = on 15 15 post_max_size = 100M 16 16 upload_max_filesize = 100M 17 + memory_limit = ${toString cfg.settings.php_memory_limit}M 17 18 date.timezone = "${config.time.timeZone}" 18 19 ''; 19 20 phpIni = pkgs.runCommand "php.ini" ··· 101 102 ''; 102 103 }; 103 104 105 + enableLocalBilling = mkOption { 106 + type = types.bool; 107 + default = true; 108 + description = '' 109 + Enable billing Cron-Jobs on the local instance. Enabled by default, but you may disable it 110 + on some nodes within a distributed poller setup. See [the docs](https://docs.librenms.org/Extensions/Distributed-Poller/#discovery) 111 + for more informations about billing with distributed pollers. 112 + ''; 113 + }; 114 + 104 115 useDistributedPollers = mkOption { 105 116 type = types.bool; 106 117 default = false; 107 118 description = '' 108 - Enables (distributed pollers)[https://docs.librenms.org/Extensions/Distributed-Poller/] 119 + Enables [distributed pollers](https://docs.librenms.org/Extensions/Distributed-Poller/) 109 120 for this LibreNMS instance. This will enable a local `rrdcached` and `memcached` server. 110 121 111 122 To use this feature, make sure to configure your firewall that the distributed pollers ··· 118 129 type = types.bool; 119 130 default = false; 120 131 description = '' 121 - Configure this LibreNMS instance as a (distributed poller)[https://docs.librenms.org/Extensions/Distributed-Poller/]. 132 + Configure this LibreNMS instance as a [distributed poller](https://docs.librenms.org/Extensions/Distributed-Poller/). 122 133 This will disable all web features and just configure the poller features. 123 134 Use the `mysql` database of your main LibreNMS instance in the database settings. 124 135 ''; ··· 146 157 default = false; 147 158 description = '' 148 159 Enable distributed billing on this poller. 160 + 161 + Note: according to [the docs](https://docs.librenms.org/Extensions/Distributed-Poller/#discovery), 162 + billing should only be calculated on a single node per poller group. You can disable billing on 163 + some nodes with the `services.librenms.enableLocalBilling` option. 149 164 ''; 150 165 }; 151 166 ··· 375 390 376 391 # enable fast ping by default 377 392 "ping_rrd_step" = 60; 393 + 394 + # set default memory limit to 1G 395 + "php_memory_limit" = lib.mkDefault 1024; 378 396 379 397 # one minute polling 380 398 "rrd.step" = if cfg.enableOneMinutePolling then 60 else 300; ··· 609 627 "${if cfg.enableOneMinutePolling then "*" else "*/5"} * * * * ${cfg.user} ${env} ${package}/cronic ${package}/poller-wrapper.py ${toString cfg.pollerThreads}" 610 628 "* * * * * ${cfg.user} ${env} ${package}/alerts.php >> /dev/null 2>&1" 611 629 612 - "*/5 * * * * ${cfg.user} ${env} ${package}/poll-billing.php >> /dev/null 2>&1" 613 - "01 * * * * ${cfg.user} ${env} ${package}/billing-calculate.php >> /dev/null 2>&1" 614 630 "*/5 * * * * ${cfg.user} ${env} ${package}/check-services.php >> /dev/null 2>&1" 615 631 616 632 # extra: fast ping ··· 621 637 "19 0 * * * ${cfg.user} ${env} ${package}/daily.sh notifications >> /dev/null 2>&1" 622 638 "19 0 * * * ${cfg.user} ${env} ${package}/daily.sh peeringdb >> /dev/null 2>&1" 623 639 "19 0 * * * ${cfg.user} ${env} ${package}/daily.sh mac_oui >> /dev/null 2>&1" 640 + ] ++ lib.optionals cfg.enableLocalBilling [ 641 + "*/5 * * * * ${cfg.user} ${env} ${package}/poll-billing.php >> /dev/null 2>&1" 642 + "01 * * * * ${cfg.user} ${env} ${package}/billing-calculate.php >> /dev/null 2>&1" 624 643 ]; 625 644 }; 626 645 ··· 659 678 660 679 }; 661 680 662 - meta.maintainers = lib.teams.wdz.members; 681 + meta.maintainers = with lib.maintainers; [ netali ] ++ lib.teams.wdz.members; 663 682 }