tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
0
fork
atom
lol
0
fork
atom
overview
issues
pulls
pipelines
longview nixos module: init
Rodney Lorrimar
10 years ago
bc3fb796
96f81e3b
+78
2 changed files
expand all
collapse all
unified
split
nixos
modules
module-list.nix
services
monitoring
longview.nix
+1
nixos/modules/module-list.nix
···
240
240
./services/monitoring/grafana.nix
241
241
./services/monitoring/graphite.nix
242
242
./services/monitoring/heapster.nix
243
243
+
./services/monitoring/longview.nix
243
244
./services/monitoring/monit.nix
244
245
./services/monitoring/munin.nix
245
246
./services/monitoring/nagios.nix
+77
nixos/modules/services/monitoring/longview.nix
···
1
1
+
{ config, lib, pkgs, ... }:
2
2
+
3
3
+
with lib;
4
4
+
5
5
+
let
6
6
+
cfg = config.services.longview;
7
7
+
8
8
+
pidFile = "/run/longview.pid";
9
9
+
10
10
+
apacheConf = ''
11
11
+
#location http://127.0.0.1/server-status?auto
12
12
+
'';
13
13
+
mysqlConf = ''
14
14
+
#username root
15
15
+
#password example_password
16
16
+
'';
17
17
+
nginxConf = ''
18
18
+
#location http://127.0.0.1/nginx_status
19
19
+
'';
20
20
+
21
21
+
in
22
22
+
23
23
+
{
24
24
+
options = {
25
25
+
26
26
+
services.longview = {
27
27
+
28
28
+
enable = mkOption {
29
29
+
type = types.bool;
30
30
+
default = false;
31
31
+
description = ''
32
32
+
If enabled, system metrics will be sent to Linode LongView.
33
33
+
'';
34
34
+
};
35
35
+
36
36
+
apiKey = mkOption {
37
37
+
type = types.str;
38
38
+
description = ''
39
39
+
Longview API key. To get this, look in Longview settings which
40
40
+
are found at https://manager.linode.com/longview/.
41
41
+
'';
42
42
+
};
43
43
+
44
44
+
};
45
45
+
46
46
+
};
47
47
+
48
48
+
config = mkIf cfg.enable {
49
49
+
systemd.services.longview =
50
50
+
{ description = "Longview Metrics Collection";
51
51
+
after = [ "network.target" ];
52
52
+
wantedBy = [ "multi-user.target" ];
53
53
+
serviceConfig.Type = "forking";
54
54
+
serviceConfig.ExecStop = "-${pkgs.coreutils}/bin/kill -TERM $MAINPID";
55
55
+
serviceConfig.ExecReload = "-${pkgs.coreutils}/bin/kill -HUP $MAINPID";
56
56
+
serviceConfig.PIDFile = pidFile;
57
57
+
serviceConfig.ExecStart = "${pkgs.longview}/bin/longview";
58
58
+
};
59
59
+
60
60
+
environment.etc."linode/longview.key" = {
61
61
+
mode = "0400";
62
62
+
text = cfg.apiKey;
63
63
+
};
64
64
+
environment.etc."linode/longview.d/Apache.conf" = {
65
65
+
mode = "0400";
66
66
+
text = apacheConf;
67
67
+
};
68
68
+
environment.etc."linode/longview.d/MySQL.conf" = {
69
69
+
mode = "0400";
70
70
+
text = mysqlConf;
71
71
+
};
72
72
+
environment.etc."linode/longview.d/Nginx.conf" = {
73
73
+
mode = "0400";
74
74
+
text = nginxConf;
75
75
+
};
76
76
+
};
77
77
+
}