mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-08-01 05:43:44 +00:00
Whitespace cleanup
* remove trailing whitespace * remove empty lines at the end of files
This commit is contained in:
parent
ef851f0c34
commit
17f784270a
604 changed files with 2927 additions and 2945 deletions
|
@ -1,72 +1,72 @@
|
|||
#!/usr/bin/perl -w
|
||||
#
|
||||
# Munin plugin for MegaRAID
|
||||
# Munin plugin for MegaRAID
|
||||
# This plugin can graph:- Currently Drive Temperature and Error Count
|
||||
#
|
||||
#
|
||||
#---------------------
|
||||
# Examples
|
||||
# Create a symbolic link to MegaRaid_<AdapterNumber>_<temp|error|other|predictive>
|
||||
# ln -s /usr/share/munin/plugins/MegaRaid_ /etc/munin/plugins/MegaRaid_0_temp
|
||||
# graph temperature on adapter 0
|
||||
#
|
||||
#
|
||||
# ln -s /usr/share/munin/plugins/MegaRaid_ /etc/munin/plugins/MegaRaid_0_error
|
||||
# graph media errors on adapter 0
|
||||
#
|
||||
#
|
||||
# ln -s /usr/share/munin/plugins/MegaRaid_ /etc/munin/plugins/MegaRaid_1_temp
|
||||
# graph temperature on adapter 1
|
||||
#
|
||||
#
|
||||
#---------------------
|
||||
# Log
|
||||
# Revision 0.1 2011/04/16 idobson
|
||||
# -First version only basic support of the MegaRaid controller
|
||||
#
|
||||
#
|
||||
# Revision 0.2 2011/04/17 fkatzenb
|
||||
# -Added bash statement to remove the log file created each time MegaCli64 is ran
|
||||
# -Added a few comments and visual changes
|
||||
#
|
||||
#
|
||||
# Revision 1.0 2011/04/17 fkatzenb
|
||||
# -Revamped Code to symbolic link for sensor type and future growth
|
||||
#
|
||||
#
|
||||
# Revision 1.1 2011/04/17 fkatzenb
|
||||
# -Revised scalling
|
||||
#
|
||||
#
|
||||
# Revision 1.2 2011/04/28 fkatzenb
|
||||
# -Added support for graph_info support
|
||||
# -Added warning & critical alerts support
|
||||
# -Added data info
|
||||
#
|
||||
#
|
||||
# Revision 2.0 2011/04/29 fkatzenb
|
||||
# -Added remaining support for SMART Errors
|
||||
#
|
||||
#
|
||||
# Revision 2.1 2011/04/29 fkatzenb
|
||||
# -Added version information for in the graph description
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
#---------------------
|
||||
#
|
||||
#
|
||||
# Add the following to your /etc/munin/plugin-conf.d/munin-node:
|
||||
#
|
||||
#
|
||||
# [MegaRaid_*]
|
||||
# user root
|
||||
#
|
||||
#
|
||||
#---------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
# Magic markers (optional - used by munin-config and installation scripts):
|
||||
#
|
||||
#
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
#
|
||||
#
|
||||
my $DisplayVer=2.1;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $DevID=0; #Device Number found
|
||||
my $DevData=0; #Device Data found
|
||||
my $DevData=0; #Device Data found
|
||||
|
||||
# Parse out Adapter number and parameter desired from file name and remove whitespace
|
||||
my $Parameters=`basename $0 | sed 's/^MegaRaid_//g' | tr '_' '-'` ;
|
||||
my $Parameters=`basename $0 | sed 's/^MegaRaid_//g' | tr '_' '-'` ;
|
||||
chomp $Parameters;
|
||||
my ($Adapter,$Type)=split(/-/,$Parameters);
|
||||
|
||||
|
@ -128,13 +128,13 @@ if ($ARGV[0] and $ARGV[0] eq "autoconf" ) {
|
|||
print "yes\n";
|
||||
exit 0;
|
||||
} else {
|
||||
print "no\n";
|
||||
print "no\n";
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
#Read Output of MegaRaid command
|
||||
$Command.=" -PDList -a".$Adapter;
|
||||
$Command.=" -PDList -a".$Adapter;
|
||||
my @Output=qx($Command);
|
||||
|
||||
#Munin Config Options
|
||||
|
@ -145,14 +145,14 @@ if ($ARGV[0] and $ARGV[0] eq "config"){
|
|||
print "graph_scale yes\n";
|
||||
print "graph_category disk\n";
|
||||
print "graph_info $config{$Type}->{description} <br />Generated by MegaRaid_, Version $DisplayVer<br />\n";
|
||||
|
||||
|
||||
foreach my $Line (@Output) {
|
||||
$Line=~ s/\r//g;
|
||||
$Line=~ s/\n//g;
|
||||
|
||||
|
||||
#Find the device ID
|
||||
if ( $Line=~ m/Slot Number: /i ) {
|
||||
$DevID=$Line;
|
||||
if ( $Line=~ m/Slot Number: /i ) {
|
||||
$DevID=$Line;
|
||||
$DevID=~ s/Slot Number: //;
|
||||
print "A".$Adapter."_D".$DevID."_$Type.label A$Adapter:D$DevID $config{$Type}->{label}\n";
|
||||
print "A".$Adapter."_D".$DevID."_$Type.info Adapter: $Adapter / Drive: $DevID - $config{$Type}->{info_tag}\n";
|
||||
|
@ -161,9 +161,9 @@ if ($ARGV[0] and $ARGV[0] eq "config"){
|
|||
}
|
||||
if ($config{$Type}->{critical} ne '') {
|
||||
print "A".$Adapter."_D".$DevID."_$Type.critical $config{$Type}->{critical}\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
exit 0;
|
||||
}
|
||||
|
||||
|
@ -176,7 +176,7 @@ foreach my $Line (@Output) {
|
|||
if ( $Line=~ m/Slot Number: /i ) { $DevID=$Line; $DevID=~ s/Slot Number: //; chomp $DevID; }
|
||||
|
||||
#Find the data and print it out
|
||||
if ( $Line=~ m/$config{$Type}->{lookfor}/i ) {
|
||||
if ( $Line=~ m/$config{$Type}->{lookfor}/i ) {
|
||||
$DevData=$Line;
|
||||
$DevData=~s/$config{$Type}->{lookfor}//;
|
||||
$DevData=~s/C.*//;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue