* Configuration for distributed builds, Nagios.
svn path=/configurations/trunk/tud/; revision=9786
Eelco Dolstra committed
Nov 23, 2007 at 17:13 UTC
710442363dd1ed6f6c4aa89f1de1219d301a6081
4 files changed
+217
-11
machines.nix
new
+64
@@ -0,0 +1,64 @@
1
+{
2
+ cartman = {
3
+ ipAddress = "192.168.1.5";
4
+ system = "i686-linux";
5
+ aliases = ["main"];
6
+ maxJobs = 2;
7
+ };
8
+ garrison = {
9
+ ipAddress = "192.168.1.11";
10
+ ethernetAddress = "00:19:d1:10:37:54";
11
+ system = "i686-cygwin";
12
+ aliases = ["winxp32-1" "winxp32" "winxp"];
13
+ maxJobs = 2;
14
+ buildUser = "nix";
15
+ };
16
+ terrance = {
17
+ ipAddress = "192.168.1.12";
18
+ ethernetAddress = "00:19:d1:10:37:49";
19
+ system = "x86_64-linux";
20
+ aliases = ["linux64-1" "linux64"];
21
+ maxJobs = 2;
22
+ #buildUser = "buildfarm";
23
+ };
24
+ phillip = {
25
+ ipAddress = "192.168.1.13";
26
+ ethernetAddress = "00:19:d1:19:2a:31";
27
+ system = "x86_64-linux";
28
+ aliases = ["linux64-2"];
29
+ maxJobs = 2;
30
+ buildUser = "buildfarm";
31
+ };
32
+ jimmy = {
33
+ ipAddress = "192.168.1.14";
34
+ ethernetAddress = "00:16:76:9a:32:1d";
35
+ system = "i686-linux";
36
+ aliases = ["linux32-1" "linux32" "linux"];
37
+ maxJobs = 2;
38
+ buildUser = "buildfarm";
39
+ };
40
+ timmy = {
41
+ ipAddress = "192.168.1.15";
42
+ ethernetAddress = "00:19:d1:1d:c4:9a";
43
+ system = "i686-linux";
44
+ aliases = ["linux32-2"];
45
+ maxJobs = 2;
46
+ #buildUser = "buildfarm";
47
+ };
48
+ token = {
49
+ ipAddress = "192.168.1.16";
50
+ ethernetAddress = "00:16:cb:a6:13:28";
51
+ system = "i686-darwin";
52
+ aliases = ["mac86-1" "mac"];
53
+ maxJobs = 2;
54
+ buildUser = "nix";
55
+ };
56
+ black = {
57
+ ipAddress = "192.168.1.17";
58
+ ethernetAddress = "00:16:cb:a6:13:d7";
59
+ system = "i686-darwin";
60
+ aliases = ["mac86-2"];
61
+ maxJobs = 2;
62
+ buildUser = "nix";
63
+ };
64
+}
main.nix
+76
-6
@@ -1,10 +1,30 @@
1
+let
2
+
3
+ pkgs = import /etc/nixos/nixpkgs {};
4
+
5
+ machines = import ./machines.nix;
6
+
7
+ machineList = map (name: {hostName = name;} // builtins.getAttr name machines)
8
+ (builtins.attrNames machines);
9
+
10
+ # Produce the list of Nix build machines in the format expected by
11
+ # the Nix daemon Upstart job.
12
+ buildMachines =
13
+ let addKey = machine: machine //
14
+ { sshKey = "/root/.ssh/id_buildfarm";
15
+ sshUser = machine.buildUser;
16
+ };
17
+ in map addKey (pkgs.lib.filter (machine: machine ? buildUser) machineList);
18
+
19
+in
20
+
21
rec {
22
boot = {
23
grubDevice = "/dev/sda";
24
initrd = {
25
extraKernelModules = ["arcmsr"];
26
};
7
- extraKernelModules = ["kvm-intel"];
27
+ kernelModules = ["kvm-intel"];
28
};
29
30
fileSystems = [
@@ -19,10 +39,13 @@ rec {
39
40
nix = {
41
maxJobs = 2;
42
+ distributedBuilds = true;
43
+ inherit buildMachines;
44
};
45
46
networking = {
25
- hostName = "buildfarm";
47
+ hostName = "cartman";
48
+ domain = "buildfarm";
49
50
interfaces = [
51
{ name = "eth1";
@@ -30,7 +53,7 @@ rec {
53
subnetMask = "255.255.254.0";
54
}
55
{ name = "eth0";
33
- ipAddress = "192.168.1.5";
56
+ ipAddress = machines.cartman.ipAddress;
57
}
58
];
59
@@ -38,11 +61,14 @@ rec {
61
62
nameservers = ["130.161.158.4" "130.161.33.17" "130.161.180.1"];
63
64
+ extraHosts =
65
+ let toHosts = m: "${m.ipAddress} ${m.hostName} ${pkgs.lib.concatStringsSep " " m.aliases}\n"; in
66
+ pkgs.lib.concatStrings (map toHosts machineList);
67
+
68
localCommands =
69
# Provide NATting for the build machines on 192.168.1.*.
70
# Obviously, this should be something that NixOS provides.
44
- let pkgs = import ../../nixpkgs/pkgs/top-level/all-packages.nix {};
45
- in "
71
+ "
72
export PATH=${pkgs.iptables}/sbin:$PATH
73
74
modprobe ip_tables
@@ -58,6 +84,12 @@ rec {
84
85
echo 1 > /proc/sys/net/ipv4/ip_forward
86
";
87
+
88
+ defaultMailServer = {
89
+ directDelivery = true;
90
+ hostName = "smtp.st.ewi.tudelft.nl";
91
+ domain = "st.ewi.tudelft.nl";
92
+ };
93
};
94
95
services = {
@@ -71,6 +103,44 @@ rec {
103
interfaces = ["eth0"];
104
};
105
106
+ nagios = {
107
+ enable = true;
108
+ enableWebInterface = true;
109
+ objectDefs = [
110
+ ./nagios-base.cfg
111
+ (pkgs.writeText "nagios-machines.cfg" (
112
+ map (machine:
113
+ let hostName = machine.hostName; in
114
+ "
115
+ define host {
116
+ host_name ${hostName}
117
+ use generic-server
118
+ alias Build machine ${hostName} (${machine.system})
119
+ address ${hostName}
120
+ hostgroups tud-buildfarm
121
+ }
122
+
123
+ define service {
124
+ service_description SSH on ${hostName}
125
+ use local-service
126
+ host_name ${hostName}
127
+ servicegroups ssh
128
+ check_command check_ssh
129
+ }
130
+
131
+ #define service {
132
+ # service_description /nix on ${hostName}
133
+ # use local-service
134
+ # host_name ${hostName}
135
+ # servicegroups diskspace
136
+ # check_command check_remote_disk!nagios!/var/lib/nagios/id_nagios!75%!10%!/nix
137
+ #}
138
+ "
139
+ ) machineList
140
+ ))
141
+ ];
142
+ };
143
+
144
httpd = {
145
enable = true;
146
adminAddr = "eelco@cs.uu.nl";
@@ -106,7 +176,7 @@ rec {
176
directories = ./dist-manager/directories.conf;
177
};
178
109
- distManager = webServer : pkgs : { distDir, distPrefix, distConfDir, directories} :
179
+ distManager = webServer : pkgs : {distDir, distPrefix, distConfDir, directories} :
180
import ../../services/dist-manager {
181
inherit (pkgs) stdenv perl;
182
saxon8 = pkgs.saxonb;
nagios-base.cfg
new
+77
@@ -0,0 +1,77 @@
1
+### Contacts.
2
+
3
+define contact {
4
+ contact_name eelco
5
+ alias Eelco Dolstra
6
+ service_notification_period 24x7
7
+ host_notification_period 24x7
8
+ service_notification_options w,u,c,r
9
+ host_notification_options d,r
10
+ service_notification_commands notify-by-email
11
+ host_notification_commands host-notify-by-email
12
+ email eelco@cs.uu.nl
13
+}
14
+
15
+
16
+define contactgroup {
17
+ contactgroup_name admins
18
+ alias Administrators
19
+ members eelco
20
+}
21
+
22
+
23
+### Hosts.
24
+
25
+define host {
26
+ host_name localhost
27
+ use generic-server
28
+ alias Nagios monitor
29
+ address 127.0.0.1
30
+}
31
+
32
+
33
+define hostgroup {
34
+ hostgroup_name tud-buildfarm
35
+ alias TUD Build Farm
36
+ members localhost
37
+}
38
+
39
+
40
+### Services.
41
+
42
+define service {
43
+ service_description Root Partition on localhost
44
+ use local-service
45
+ host_name localhost
46
+ servicegroups diskspace
47
+ check_command check_local_disk!20%!10%!/
48
+}
49
+
50
+
51
+define service {
52
+ service_description Nix Partition on localhost
53
+ use local-service
54
+ host_name localhost
55
+ servicegroups diskspace
56
+ check_command check_local_disk!2%!1%!/nix
57
+}
58
+
59
+
60
+define servicegroup {
61
+ servicegroup_name diskspace
62
+ alias Disk space
63
+}
64
+
65
+
66
+define servicegroup {
67
+ servicegroup_name ssh
68
+ alias SSH
69
+}
70
+
71
+
72
+### Commands.
73
+
74
+define command {
75
+ command_name check_remote_disk
76
+ command_line check_by_ssh -l $ARG1$ -i $ARG2$ -H $HOSTADDRESS$ -C '/nix/var/nix/profiles/default/libexec/check_disk -w $ARG3$ -c $ARG4$ -p $ARG5$'
77
+}
supervisor/machines
deleted
-5
@@ -1,5 +0,0 @@
1
-buildfarm@192.168.1.13 x86_64-linux /home/buildfarm/.ssh/id_buildfarm 2
2
-buildfarm@192.168.1.14 i686-linux /home/buildfarm/.ssh/id_buildfarm 2
3
-nix@192.168.1.11 i686-cygwin /home/buildfarm/.ssh/id_buildfarm 2
4
-nix@192.168.1.16 i686-darwin /home/buildfarm/.ssh/id_buildfarm 2
5
-nix@192.168.1.17 i686-darwin /home/buildfarm/.ssh/id_buildfarm 2