diff options
author | Franz Pletz <fpletz@fnordicwalking.de> | 2017-01-04 21:56:12 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-04 21:56:12 +0100 |
commit | cdbffaa86eb10e62a345960ba8cfe090dfca430f (patch) | |
tree | a9772726b816106889e4e374103273874e5d8537 /nixos | |
parent | 0779fdb3e48c22c2fafb360591d344af2ddeec91 (diff) | |
parent | f808502aba1efe6e2e40ed10955ca6f974da9b17 (diff) |
Merge pull request #21625 from mayflower/smokeping
smokeping: Allow customization of cgiurl and imgurl
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/services/networking/smokeping.nix | 201 |
1 files changed, 104 insertions, 97 deletions
diff --git a/nixos/modules/services/networking/smokeping.nix b/nixos/modules/services/networking/smokeping.nix index 005655f111a1f..04312c39062f4 100644 --- a/nixos/modules/services/networking/smokeping.nix +++ b/nixos/modules/services/networking/smokeping.nix @@ -11,17 +11,17 @@ let then '' *** General *** - owner = ${cfg.owner} + cgiurl = ${cfg.cgiUrl} contact = ${cfg.ownerEmail} - ${lib.optionalString (cfg.mailHost != "") "mailhost = ${cfg.mailHost}"} - ${lib.optionalString (cfg.sendmail != null) "sendmail = ${cfg.sendmail}"} - imgcache = ${smokepingHome}/cache - imgurl = http://${cfg.hostName}:${builtins.toString cfg.port}/cache datadir = ${smokepingHome}/data + imgcache = ${smokepingHome}/cache + imgurl = ${cfg.imgUrl} + linkstyle = ${cfg.linkStyle} + ${lib.optionalString (cfg.mailHost != "") "mailhost = ${cfg.mailHost}"} + owner = ${cfg.owner} pagedir = ${smokepingHome}/cache piddir = ${smokepingPidDir} - cgiurl = http://${cfg.hostName}:${builtins.toString cfg.port}/smokeping.cgi - linkstyle = ${cfg.linkStyle} + ${lib.optionalString (cfg.sendmail != null) "sendmail = ${cfg.sendmail}"} smokemail = ${cfg.smokeMailTemplate} *** Presentation *** template = ${cfg.presentationTemplate} @@ -54,72 +54,36 @@ in default = false; description = "Enable the smokeping service"; }; - webService = mkOption { - type = types.bool; - default = true; - description = "Enable a smokeping web interface"; - }; - - user = mkOption { - type = types.string; - default = "smokeping"; - description = "User that runs smokeping and (optionally) thttpd"; - }; - mailHost = mkOption { - type = types.string; - default = ""; - example = "localhost"; - description = "Use this SMTP server to send alerts"; - }; - sendmail = mkOption { - type = types.nullOr types.path; - default = null; - example = "/var/setuid-wrappers/sendmail"; - description = "Use this sendmail compatible script to deliver alerts"; - }; - smokeMailTemplate = mkOption { + alertConfig = mkOption { type = types.string; - default = "${cfg.package}/etc/smokemail.dist"; - description = "Specify the smokemail template for alerts."; - }; + default = '' + to = root@localhost + from = smokeping@localhost + ''; + example = literalExample '' + to = alertee@address.somewhere + from = smokealert@company.xy - package = mkOption { - type = types.package; - default = pkgs.smokeping; - defaultText = "pkgs.smokeping"; - description = "Specify a custom smokeping package"; - }; - owner = mkOption { - type = types.string; - default = "nobody"; - example = "Joe Admin"; - description = "Real name of the owner of the instance"; + +someloss + type = loss + # in percent + pattern = >0%,*12*,>0%,*12*,>0% + comment = loss 3 times in a row; + ''; + description = "Configuration for alerts."; }; - hostName = mkOption { + cgiUrl = mkOption { type = types.string; - default = config.networking.hostName; - example = "somewhere.example.com"; - description = "DNS name for the urls generated in the cgi."; + default = "http://${cfg.hostName}:${builtins.toString cfg.port}/smokeping.cgi"; + example = "https://somewhere.example.com/smokeping.cgi"; + description = "URL to the smokeping cgi."; }; - linkStyle = mkOption { - type = types.enum ["original" "absolute" "relative"]; - default = "relative"; - example = "absolute"; - description = "DNS name for the urls generated in the cgi."; - }; - port = mkOption { - type = types.int; - default = 8081; - example = 8081; - description = "TCP port to use for the web server."; - }; - ownerEmail = mkOption { - type = types.string; - default = "no-reply@${cfg.hostName}"; - example = "no-reply@yourdomain.com"; - description = "Email contact for owner"; + config = mkOption { + type = types.nullOr types.string; + default = null; + description = "Full smokeping config supplied by the user. Overrides " + + "and replaces any other configuration supplied."; }; - databaseConfig = mkOption { type = types.string; default = '' @@ -152,30 +116,59 @@ in Once set, changing the interval will require deletion or migration of all the collected data.''; }; - alertConfig = mkOption { + extraConfig = mkOption { + type = types.lines; + default = ""; + description = "Any additional customization not already included."; + }; + hostName = mkOption { type = types.string; - default = '' - to = root@localhost - from = smokeping@localhost - ''; - example = literalExample '' - to = alertee@address.somewhere - from = smokealert@company.xy - - +someloss - type = loss - # in percent - pattern = >0%,*12*,>0%,*12*,>0% - comment = loss 3 times in a row; - ''; - description = "Configuration for alerts."; + default = config.networking.hostName; + example = "somewhere.example.com"; + description = "DNS name for the urls generated in the cgi."; }; - presentationTemplate = mkOption { + imgUrl = mkOption { type = types.string; - default = "${pkgs.smokeping}/etc/basepage.html.dist"; - description = "Default page layout for the web UI."; + default = "http://${cfg.hostName}:${builtins.toString cfg.port}/cache"; + example = "https://somewhere.example.com/cache"; + description = "Base url for images generated in the cgi."; + }; + linkStyle = mkOption { + type = types.enum ["original" "absolute" "relative"]; + default = "relative"; + example = "absolute"; + description = "DNS name for the urls generated in the cgi."; + }; + mailHost = mkOption { + type = types.string; + default = ""; + example = "localhost"; + description = "Use this SMTP server to send alerts"; + }; + owner = mkOption { + type = types.string; + default = "nobody"; + example = "Joe Admin"; + description = "Real name of the owner of the instance"; + }; + ownerEmail = mkOption { + type = types.string; + default = "no-reply@${cfg.hostName}"; + example = "no-reply@yourdomain.com"; + description = "Email contact for owner"; + }; + package = mkOption { + type = types.package; + default = pkgs.smokeping; + defaultText = "pkgs.smokeping"; + description = "Specify a custom smokeping package"; + }; + port = mkOption { + type = types.int; + default = 8081; + example = 8081; + description = "TCP port to use for the web server."; }; - presentationConfig = mkOption { type = types.string; default = '' @@ -217,6 +210,11 @@ in ''; description = "presentation graph style"; }; + presentationTemplate = mkOption { + type = types.string; + default = "${pkgs.smokeping}/etc/basepage.html.dist"; + description = "Default page layout for the web UI."; + }; probeConfig = mkOption { type = types.string; default = '' @@ -225,6 +223,17 @@ in ''; description = "Probe configuration"; }; + sendmail = mkOption { + type = types.nullOr types.path; + default = null; + example = "/var/setuid-wrappers/sendmail"; + description = "Use this sendmail compatible script to deliver alerts"; + }; + smokeMailTemplate = mkOption { + type = types.string; + default = "${cfg.package}/etc/smokemail.dist"; + description = "Specify the smokemail template for alerts."; + }; targetConfig = mkOption { type = types.string; default = '' @@ -243,18 +252,16 @@ in ''; description = "Target configuration"; }; - extraConfig = mkOption { - type = types.lines; - default = ""; - description = "Any additional customization not already included."; + user = mkOption { + type = types.string; + default = "smokeping"; + description = "User that runs smokeping and (optionally) thttpd"; }; - config = mkOption { - type = types.nullOr types.string; - default = null; - description = "Full smokeping config supplied by the user. Overrides " + - "and replaces any other configuration supplied."; + webService = mkOption { + type = types.bool; + default = true; + description = "Enable a smokeping web interface"; }; - }; }; |