Merge pull request #62061 from aanderse/nagios

nixos/nagios: module updates
This commit is contained in:
Aaron Andersen 2019-07-03 06:19:35 -04:00 committed by GitHub
commit ec80ffc621
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -36,7 +36,7 @@ let
# Uid/gid that the daemon runs under. # Uid/gid that the daemon runs under.
nagios_user=nagios nagios_user=nagios
nagios_group=nogroup nagios_group=nagios
# Misc. options. # Misc. options.
illegal_macro_output_chars=`~$&|'"<> illegal_macro_output_chars=`~$&|'"<>
@ -58,9 +58,7 @@ let
<Directory "${pkgs.nagios}/sbin"> <Directory "${pkgs.nagios}/sbin">
Options ExecCGI Options ExecCGI
AllowOverride None Require all granted
Order allow,deny
Allow from all
SetEnv NAGIOS_CGI_CONFIG ${cfg.cgiConfigFile} SetEnv NAGIOS_CGI_CONFIG ${cfg.cgiConfigFile}
</Directory> </Directory>
@ -68,9 +66,7 @@ let
<Directory "${pkgs.nagios}/share"> <Directory "${pkgs.nagios}/share">
Options None Options None
AllowOverride None Require all granted
Order allow,deny
Allow from all
</Directory> </Directory>
''; '';
@ -149,9 +145,11 @@ in
description = "Nagios user "; description = "Nagios user ";
uid = config.ids.uids.nagios; uid = config.ids.uids.nagios;
home = nagiosState; home = nagiosState;
createHome = true; group = "nagios";
}; };
users.groups.nagios = { };
# This isn't needed, it's just so that the user can type "nagiostats # This isn't needed, it's just so that the user can type "nagiostats
# -c /etc/nagios.cfg". # -c /etc/nagios.cfg".
environment.etc = [ environment.etc = [
@ -169,16 +167,13 @@ in
serviceConfig = { serviceConfig = {
User = "nagios"; User = "nagios";
Group = "nagios";
Restart = "always"; Restart = "always";
RestartSec = 2; RestartSec = 2;
PermissionsStartOnly = true; LogsDirectory = "nagios";
StateDirectory = "nagios";
}; };
preStart = ''
mkdir -m 0755 -p ${nagiosState} ${nagiosLogDir}
chown nagios ${nagiosState} ${nagiosLogDir}
'';
script = '' script = ''
for i in ${toString cfg.plugins}; do for i in ${toString cfg.plugins}; do
export PATH=$i/bin:$i/sbin:$i/libexec:$PATH export PATH=$i/bin:$i/sbin:$i/libexec:$PATH