]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/hardware/recipes/default.rb
Make disk monitoring more robust
[chef.git] / cookbooks / hardware / recipes / default.rb
index 936d0d0db61fe484705b986cfacd4a23bfcfabb1..1a9549d7cd663bcaacbe4f09a74169038df5ca83 100644 (file)
@@ -72,7 +72,7 @@ when "TYAN Computer Corporation"
   units << "0"
 when "Supermicro"
   case product
   units << "0"
 when "Supermicro"
   case product
-  when "H8DGU", "X9SCD", "X7DBU", "X7DW3", "X9DR7/E-(J)LN4F", "X9DR3-F", "X9DRW", "SYS-2028U-TN24R4T+", "Super Server"
+  when "H8DGU", "X9SCD", "X7DBU", "X7DW3", "X9DR7/E-(J)LN4F", "X9DR3-F", "X9DRW", "SYS-1028U-TN10RT+", "SYS-2028U-TN24R4T+", "Super Server"
     units << "1"
   else
     units << "0"
     units << "1"
   else
     units << "0"
@@ -277,7 +277,7 @@ if tools_packages.include?("areca")
 
   git "/opt/areca" do
     action :sync
 
   git "/opt/areca" do
     action :sync
-    repository "https://chef.openstreetmap.org/areca.git"
+    repository "https://git.openstreetmap.org/private/areca.git"
     user "root"
     group "root"
   end
     user "root"
     group "root"
   end
@@ -358,16 +358,19 @@ disks = disks.map do |disk|
 
   if disk[:smart_device]
     controller = node[:hardware][:disk][:controllers][disk[:controller]]
 
   if disk[:smart_device]
     controller = node[:hardware][:disk][:controllers][disk[:controller]]
-    device = controller[:device].sub("/dev/", "")
-    smart = disk[:smart_device]
-
-    if device.start_with?("cciss/") && smart =~ /^cciss,(\d+)$/
-      array = node[:hardware][:disk][:arrays][disk[:arrays].first]
-      munin = "cciss-3#{array[:wwn]}-#{Regexp.last_match(1)}"
-    elsif smart =~ /^.*,(\d+)$/
-      munin = "#{device}-#{Regexp.last_match(1)}"
-    elsif smart =~ %r{^.*,(\d+)/(\d+)$}
-      munin = "#{device}-#{Regexp.last_match(1)}:#{Regexp.last_match(2)}"
+
+    if controller && controller[:device]
+      device = controller[:device].sub("/dev/", "")
+      smart = disk[:smart_device]
+
+      if device.start_with?("cciss/") && smart =~ /^cciss,(\d+)$/
+        array = node[:hardware][:disk][:arrays][disk[:arrays].first]
+        munin = "cciss-3#{array[:wwn]}-#{Regexp.last_match(1)}"
+      elsif smart =~ /^.*,(\d+)$/
+        munin = "#{device}-#{Regexp.last_match(1)}"
+      elsif smart =~ %r{^.*,(\d+)/(\d+)$}
+        munin = "#{device}-#{Regexp.last_match(1)}:#{Regexp.last_match(2)}"
+      end
     end
   elsif disk[:device]
     device = disk[:device].sub("/dev/", "")
     end
   elsif disk[:device]
     device = disk[:device].sub("/dev/", "")