Projet

Général

Profil

Révision 17f78427

ID17f784270ae966ee9a13e9f5104a5b8f925b639e
Parent ef851f0c
Enfant d4320aea, 5b2396a9

Ajouté par Lars Kruse il y a plus de 7 ans

Whitespace cleanup

  • remove trailing whitespace
  • remove empty lines at the end of files

Voir les différences:

plugins/disk/megaraid-controller-information
1 1
#!/usr/bin/perl -w
2 2
#
3
# Munin plugin for MegaRAID 
3
# Munin plugin for MegaRAID
4 4
# This plugin can graph:- Currently Drive Temperature and Error Count
5
# 
5
#
6 6
#---------------------
7 7
# Examples
8 8
# Create a symbolic link to MegaRaid_<AdapterNumber>_<temp|error|other|predictive>
9 9
#       ln -s /usr/share/munin/plugins/MegaRaid_ /etc/munin/plugins/MegaRaid_0_temp
10 10
#           graph temperature on adapter 0
11
# 
11
#
12 12
#       ln -s /usr/share/munin/plugins/MegaRaid_ /etc/munin/plugins/MegaRaid_0_error
13 13
#           graph media errors on adapter 0
14
# 
14
#
15 15
#       ln -s /usr/share/munin/plugins/MegaRaid_ /etc/munin/plugins/MegaRaid_1_temp
16 16
#           graph temperature on adapter 1
17
# 
17
#
18 18
#---------------------
19 19
# Log
20 20
# Revision 0.1  2011/04/16  idobson
21 21
# -First version only basic support of the MegaRaid controller
22
# 
22
#
23 23
# Revision 0.2  2011/04/17 fkatzenb
24 24
# -Added bash statement to remove the log file created each time MegaCli64 is ran
25 25
# -Added a few comments and visual changes
26
# 
26
#
27 27
# Revision 1.0 2011/04/17 fkatzenb
28 28
# -Revamped Code to symbolic link for sensor type and future growth
29
# 
29
#
30 30
# Revision 1.1 2011/04/17 fkatzenb
31 31
# -Revised scalling
32
# 
32
#
33 33
# Revision 1.2 2011/04/28 fkatzenb
34 34
# -Added support for graph_info support
35 35
# -Added warning & critical alerts support
36 36
# -Added data info
37
# 
37
#
38 38
# Revision 2.0 2011/04/29 fkatzenb
39 39
# -Added remaining support for SMART Errors
40
# 
40
#
41 41
# Revision 2.1 2011/04/29 fkatzenb
42 42
# -Added version information for in the graph description
43
# 
44
# 
43
#
44
#
45 45
#---------------------
46
# 
46
#
47 47
# Add the following to your /etc/munin/plugin-conf.d/munin-node:
48
# 
48
#
49 49
#       [MegaRaid_*]
50 50
#       user root
51
# 
51
#
52 52
#---------------------
53
# 
54
# 
53
#
54
#
55 55
# Magic markers (optional - used by munin-config and installation scripts):
56
# 
56
#
57 57
#%# family=auto
58 58
#%# capabilities=autoconf
59
# 
59
#
60 60
my $DisplayVer=2.1;
61 61

  
62 62
use strict;
63 63
use warnings;
64 64

  
65 65
my $DevID=0; 		#Device Number found
66
my $DevData=0; 		#Device Data found 
66
my $DevData=0; 		#Device Data found
67 67

  
68 68
# Parse out Adapter number and parameter desired from file name and remove whitespace
69
my $Parameters=`basename $0 | sed 's/^MegaRaid_//g' | tr '_' '-'` ;	
69
my $Parameters=`basename $0 | sed 's/^MegaRaid_//g' | tr '_' '-'` ;
70 70
chomp $Parameters;
71 71
my ($Adapter,$Type)=split(/-/,$Parameters);
72 72

  
......
128 128
      print "yes\n";
129 129
      exit 0;
130 130
      } else {
131
      print "no\n";     
131
      print "no\n";
132 132
      exit 1
133 133
     }
134 134
}
135 135

  
136 136
#Read Output of MegaRaid command
137
$Command.=" -PDList -a".$Adapter; 
137
$Command.=" -PDList -a".$Adapter;
138 138
my @Output=qx($Command);
139 139

  
140 140
#Munin Config Options
......
145 145
   print "graph_scale yes\n";
146 146
   print "graph_category disk\n";
147 147
   print "graph_info $config{$Type}->{description} <br />Generated by MegaRaid_, Version $DisplayVer<br />\n";
148
    
148

  
149 149
   foreach my $Line (@Output) {
150 150
      $Line=~ s/\r//g;
151 151
      $Line=~ s/\n//g;
152
      
152

  
153 153
      #Find the device ID
154
      if ( $Line=~ m/Slot Number: /i ) { 
155
         $DevID=$Line; 
154
      if ( $Line=~ m/Slot Number: /i ) {
155
         $DevID=$Line;
156 156
         $DevID=~ s/Slot Number: //;
157 157
         print "A".$Adapter."_D".$DevID."_$Type.label A$Adapter:D$DevID $config{$Type}->{label}\n";
158 158
         print "A".$Adapter."_D".$DevID."_$Type.info Adapter: $Adapter / Drive: $DevID - $config{$Type}->{info_tag}\n";
......
161 161
            }
162 162
         if ($config{$Type}->{critical} ne '') {
163 163
            print "A".$Adapter."_D".$DevID."_$Type.critical $config{$Type}->{critical}\n";
164
            }   
164
            }
165 165
      }
166
   } 
166
   }
167 167
   exit 0;
168 168
}
169 169

  
......
176 176
   if ( $Line=~ m/Slot Number: /i ) { $DevID=$Line; $DevID=~ s/Slot Number: //; chomp $DevID; }
177 177

  
178 178
   #Find the data and print it out
179
   if ( $Line=~ m/$config{$Type}->{lookfor}/i ) { 
179
   if ( $Line=~ m/$config{$Type}->{lookfor}/i ) {
180 180
      $DevData=$Line;
181 181
      $DevData=~s/$config{$Type}->{lookfor}//;
182 182
      $DevData=~s/C.*//;

Formats disponibles : Unified diff