From: Rudy <cr...@mo...> - 2010-06-26 02:01:46
|
Got 4 disks in a RAID array using a megasas card? Use this script to get all the temps on one tidy graph.... one temp climbing faster than the others? Maybe that one is about to FAIL!!!! Hurry, put some ice on it! Rudy filnename: hddtemp_megasas #!/usr/bin/perl # # Plugin to monitor harddrive temperatures through megasasctl. # # # Revision 1.0 2010/03/10 19:04:37 rudy # New plugin: Rudy Rucker contributed "hddtemp_megasas". # # #%# family=contrib # mad7: a0 MegaRAID SAS 8708EM2 encl:1 ldrv:1 batt:FAULT, module missing, pack missing, charge failed #a0d0 556GiB RAID 10 2x2 optimal #a0e252s0 279GiB a0d0 online # temperature: current:42C threshold:68C #a0e252s1 279GiB a0d0 online # temperature: current:46C threshold:68C #a0e252s2 279GiB a0d0 online # temperature: current:44C threshold:68C #a0e252s3 279GiB a0d0 online # temperature: current:47C threshold:68C $Mega="/usr/local/bin/megasasctl"; $mode = shift; if ($mode eq "autoconf") { if (-x $Mega) { print "yes\n"; exit 0; } print "no\n"; exit 1; } open M, "/usr/bin/sudo $Mega -t |" or die "No $Mega. $!\n"; while (<M>) { /RAID/ and next; if (/^(\S+).*GiB/ ) { my $disk = $1; my $line = <M>; my $temp = 'U'; $line =~ /current:(\d+)C/ and ($temp = $1); $info{$disk} = $temp; } } close M; if ($mode eq "config") { print "graph_title HDD temperature\n"; print "graph_args --base 1000 -l 0\n"; print "graph_vlabel temp in �C\n"; print "graph_category sensors\n"; for $disk (sort keys %info) { print "$disk.label $disk\n"; } exit 0; } for $disk (sort keys %info) { print "$disk.value $info{$disk}\n"; } |