@cryptotaxi247 / infra / commits / 746fa4c1

Add megacli module

Eelco Dolstra committed Oct 16, 2013 at 10:15 UTC 746fa4c1280e9017d4d28ac5f9cff7dee7297c89
3 files changed +18 -4
delft/build-machines-dell-r815.nix
+2 -3
@@ -2,7 +2,7 @@
2
3 {
4 boot.loader.grub.version = 2;
5 - require = [ ./build-machines-common.nix ];
5 + require = [ ./build-machines-common.nix ./megacli.nix ];
6 nixpkgs.system = "x86_64-linux";
7
8 boot.initrd.kernelModules = [ "megaraid_sas" "ext4" ];
@@ -10,9 +10,8 @@
10
11 nix.maxJobs = 48;
12
13 - environment.systemPackages = [ pkgs.megacli ];
14 -
13 fileSystems =
14 [ { device = "none"; fsType = "tmpfs"; mountPoint = "/tmp"; options = "size=50%"; neededForBoot = true; }
15 ];
16 +
17 }
delft/lucifer.nix
+1 -1
@@ -1,7 +1,7 @@
1 { config, pkgs, ... }:
2
3 {
4 - require = [ ./common.nix ./hydra-module.nix ];
4 + require = [ ./common.nix ./hydra-module.nix ./megacli.nix ];
5
6 nixpkgs.system = "x86_64-linux";
7
delft/megacli.nix new
+15
@@ -0,0 +1,15 @@
1 +{ config, pkgs, ...}:
2 +{
3 + environment.systemPackages = [ pkgs.megacli ];
4 +
5 + security.sudo.configFile =
6 + ''
7 + zabbix ALL=(ALL) NOPASSWD: ${pkgs.megacli}/bin/MegaCli64
8 + '';
9 +
10 + services.zabbixAgent.extraConfig =
11 + ''
12 + UserParameter=megaraid[*],/var/setuid-wrappers/sudo ${pkgs.megacli}/bin/MegaCli64 -pdInfo -PhysDrv[$2:$3] -a$1 | grep '$4' | cut -f2 -d':' | cut -b2-
13 + UserParameter=megaraid.degraded,/var/setuid-wrappers/sudo ${pkgs.megacli}/bin/MegaCli64 -AdpAllInfo -aAll -NoLog | grep -A 2 'Virtual Drives' | grep Degraded | ${pkgs.gawk}/bin/awk '/Degraded/ {TOTAL += $3} END {print TOTAL}'
14 + '';
15 +}