Skip to content

Commit

Permalink
nixos/sensu: sensu module
Browse files Browse the repository at this point in the history
  • Loading branch information
peterhoeg committed Sep 25, 2019
1 parent 248a3d8 commit 5fe1abf
Show file tree
Hide file tree
Showing 10 changed files with 1,243 additions and 0 deletions.
1 change: 1 addition & 0 deletions nixos/modules/module-list.nix
Expand Up @@ -486,6 +486,7 @@
./services/monitoring/riemann-dash.nix
./services/monitoring/riemann-tools.nix
./services/monitoring/scollector.nix
./services/monitoring/sensu/default.nix
./services/monitoring/smartd.nix
./services/monitoring/sysstat.nix
./services/monitoring/systemhealth.nix
Expand Down
82 changes: 82 additions & 0 deletions nixos/modules/services/monitoring/sensu/checks.nix
@@ -0,0 +1,82 @@
{ lib }:

{
options = with lib; with types; {
type = mkOption {
type = enum [ "standard" "metric" ];
default = "standard";
description = "Type of check.";
};

standalone = mkOption {
type = bool;
default = false;
description = "Scheduled by the client instead of the server.";
};

command = mkOption {
type = str;
description = "Command to run.";
};

subscribers = mkOption {
type = listOf str;
default = [];
description = "Subscribers";
};

handlers = mkOption {
default = [];
description = "Handlers.";
type = listOf str;
};

dependencies = mkOption {
default = [];
description = "Dependencies.";
type = listOf str;
};

interval = mkOption {
type = int;
default = 60;
description = "Check interval.";
};

timeout = mkOption {
type = int;
default = 30;
description = "Check timeout.";
};

ttl = mkOption {
type = int;
default = 120;
description = "Check TTL.";
};

source = mkOption {
type = str;
default = "";
description = "Custom source for JIT checks.";
};

occurrences = mkOption {
type = int;
default = 1;
description = "The number of occurrences before triggering an alert.";
};

subdue = mkOption {
type = attrs;
default = {};
description = "Subdue check during certain windows.";
};

vars = mkOption {
type = attrs;
default = {};
description = "Custom variables sent with the check.";
};
};
}
60 changes: 60 additions & 0 deletions nixos/modules/services/monitoring/sensu/client.nix
@@ -0,0 +1,60 @@
{ lib }:

{
options = with lib; with types; {
name = mkOption {
type = str;
default = "";
description = "Name of the client.";
};

address = mkOption {
type = str;
default = "";
description = "IP address";
};

subscriptions = mkOption {
type = listOf str;
default = [ ];
description = "Subscriptions";
};

socket = mkOption {
description = "The socket configuration.";
default = {};
type = submodule {
options = {
bind = mkOption {
type = str;
default = "127.0.0.1";
description = "The IP address on which the client listens.";
};

port = mkOption {
type = int;
default = 3030;
description = "The port on which the client listens.";
};
};
};
};

vars = mkOption {
type = attrs;
default = {};
description = "Custom attributes/variables.";
};

execEnv = mkOption {
type = package;
description = "The execution environment for all checks.";
};

wrapper = mkOption {
type = nullOr path;
description = "The wrapper script used for executing all the checks.";
default = null;
};
};
}
112 changes: 112 additions & 0 deletions nixos/modules/services/monitoring/sensu/dashboard.nix
@@ -0,0 +1,112 @@
{ config, lib, cfg }:

{
options = with lib; with types; {
enable = mkOption {
type = bool;
default = (cfg.role == "server");
description = "Enable the dashboard";
};

host = mkOption {
type = str;
default = "127.0.0.1";
description = "The IP address on which Uchiwa will listen.";
};

port = mkOption {
type = int;
default = 3000;
description = "The port on which Uchiwa will listen.";
};

refresh = mkOption {
type = int;
default = 5;
description = "UI refresh interval.";
};

proxy = mkOption {
description = "Proxy traffic to/from the sensu dashboard.";
default = {};
type = submodule {
options = {
enable = mkOption {
type = bool;
default = false;
description = "Enable proxy.";
};

path = mkOption {
type = str;
default = "/";
description = "The path to the dashboard if behind a proxy.";
};

name = mkOption {
type = str;
default = config.networking.hostName;
description = "Hostname on which to repond.";
};

enableSSL = mkOption {
type = bool;
default = false;
description = "Force SSL.";
};
};
};
};

users = mkOption {
description = "Users";
default = {};
type = listOf(submodule {
options = {
username = mkOption {
description = "User name.";
type = str;
};

password = mkOption {
description = "Password.";
type = str;
};

accessToken = mkOption {
default = "";
description = "Access token.";
type = str;
};

readonly = mkOption {
default = false;
description = "Read only.";
type = bool;
};
};
});
};

usersOptions = mkOption {
description = "Options relevant to all users";
default = {};
type = submodule {
options = {

defaultTheme = mkOption {
type = enum [ "uchiwa-default" "uchiwa-dark" ];
default = "uchiwa-dark";
description = "The theme to use.";
};

logoUrl = mkOption {
type = str;
default = "";
description = "The logo to use.";
};
};
};
};
};
}

0 comments on commit 5fe1abf

Please sign in to comment.