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