File: 237-hddtemp_smartctl-sata-detect.patch

package info (click to toggle)
munin 1.4.5-3+deb6u1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze-lts
  • size: 4,988 kB
  • ctags: 806
  • sloc: perl: 8,936; sh: 3,105; java: 1,754; makefile: 585; python: 143
file content (46 lines) | stat: -rw-r--r-- 1,718 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
Description: Add auto detection of SATA disks to hddtemp_smartctl
 Upstream wants to test this bug on older systems before including it in trunk
 as they want munin 1.4 compatible with older systems like RHEL4.
 .
 As we know that lenny, and onwards has smartmontools 5.38 or higher,
 that is needed for this patch to work, we can include it in the debian package
 even if its not included upstream.
Origin: other
Bug-Debian: http://bugs.debian.org/497400
Forwarded: no
Author: Thorsten Gunkel <tgunkel-lists@tgunkel.de>
Last-Update: 2009-11-26
Index: munin-1.4.0/plugins/node.d/hddtemp_smartctl.in
===================================================================
--- munin-1.4.0.orig/plugins/node.d/hddtemp_smartctl.in	2009-08-31 23:04:36.000000000 +0200
+++ munin-1.4.0/plugins/node.d/hddtemp_smartctl.in	2009-08-31 23:08:02.000000000 +0200
@@ -92,14 +92,25 @@
 
 # Try to get a default set of drives
 if ($^O eq 'linux') {
-  # On Linux, we know how to enumerate ide drives. SCSI is not as easy
+  # On Linux, we know how to enumerate ide drives.
+  my @drivesIDE;
   if (-d '/proc/ide') {
     opendir(IDE, '/proc/ide');
-    @drives = grep /hd[a-z]/, readdir IDE;
+    @drivesIDE = grep /hd[a-z]/, readdir IDE;
     closedir(IDE);
   }
-  # "SCSI disks" could be both SCSI or SATA - we can't know which
-  # without probing them.
+
+  # Look for SCSI / SATA drives in /sys
+  my @drivesSCSI;
+  if (-d '/sys/block/') {
+    opendir(SCSI, '/sys/block/');
+    @drivesSCSI = grep /sd[a-z]/, readdir SCSI;
+    closedir(SCSI);
+   }
+
+  # Get list of all drives we found
+  @drives=(@drivesIDE,@drivesSCSI);
+  
 } elsif ($^O eq 'freebsd') {
   opendir(DEV, '/dev');
   @drives = grep /^ad[0-9]+$/, readdir DEV;