Skip to content

Commit 818a694

Browse files
authored
Merge pull request #205 from knorrie/cciss_vol_status_1_12a
Fixes for cciss_vol_status 1.12a
2 parents ecd8632 + 13acd51 commit 818a694

File tree

6 files changed

+165
-4
lines changed

6 files changed

+165
-4
lines changed

Diff for: lib/App/Monitoring/Plugin/CheckRaid/Plugins/cciss.pm

+8-3
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ sub cciss_vol_status_version {
172172
close $fh;
173173
return 0 unless $line;
174174

175-
if (my($v) = $line =~ /^cciss_vol_status version ([\d.]+)$/) {
175+
if (my($v) = $line =~ /^cciss_vol_status version ([\d.]+)[a-z]?$/) {
176176
return 0 + $v;
177177
}
178178
return 0;
@@ -263,10 +263,11 @@ sub parse {
263263
# /dev/cciss/c0d0: (Smart Array P400i) RAID 1 Volume 0 status: OK
264264
# /dev/sda: (Smart Array P410i) RAID 1 Volume 0 status: OK.
265265
# /dev/sda: (Smart Array P410i) RAID 5 Volume 0 status: OK. At least one spare drive designated. At least one spare drive has failed.
266+
# /dev/sda: (Smart Array P420i) RAID 1(1+0) Volume 0 status: OK.
266267
if (my($file, $board_name, $raid_level, $volume_number, $certain, $status, $spare_drive_status) = m{
267268
^(/dev/[^:]+):\s # File
268269
\(([^)]+)\)\s # Board Name
269-
(RAID\s\d+|\([^)]+\))\s # RAID level
270+
(RAID\s\d+(?:\(\d\+\d\))?|\([^)]+\))\s # RAID level with optional '(X+Y)')
270271
Volume\s(\d+) # Volume number
271272
(\(\?\))?\s # certain?
272273
status:\s(.*?)\. # status (without a dot)
@@ -299,7 +300,7 @@ sub parse {
299300
if (my ($phys1, $phys2, $box, $bay, $model, $serial_no, $fw_rev, $status) = m{
300301
\sconnector\s(.)(.)\s # Phys connector 1&2
301302
box\s(\d+)\s # phys_box_on_bus
302-
bay\s(\d+)\s # phys_bay_in_box
303+
bay\s(\d+)\s{1,2} # phys_bay_in_box
303304
(.{40})\s # model
304305
(.{40})\s # serial no
305306
(.{8})\s # fw rev
@@ -340,6 +341,8 @@ sub parse {
340341
my $cache = $c{$cdev}{cache};
341342
my %map = (
342343
configured => qr/Cache configured: (.+)/,
344+
total_cache_memory => qr/Total cache memory: (.+)/,
345+
cache_ratio => qr/Cache Ratio: (.+)/,
343346
read_cache_memory => qr/Read cache memory: (.+)/,
344347
write_cache_memory => qr/Write cache memory: (.+)/,
345348
write_cache_enabled => qr/Write cache enabled: (.+)/,
@@ -464,6 +467,8 @@ sub check {
464467
}
465468

466469
push(@cstatus, "FlashCache") if $cache->{flash_cache};
470+
push(@cstatus, "TotalMem:$cache->{total_cache_memory}") if $cache->{total_cache_memory};
471+
push(@cstatus, "Ratio:'$cache->{cache_ratio}'") if $cache->{cache_ratio};
467472
push(@cstatus, "ReadMem:$cache->{read_cache_memory}") if $cache->{read_cache_memory};
468473
push(@cstatus, "WriteMem:$cache->{write_cache_memory}") if $cache->{write_cache_memory};
469474

Diff for: t/check_cciss.t

+13-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ BEGIN {
66

77
use strict;
88
use warnings;
9-
use constant TESTS => 13;
9+
use constant TESTS => 14;
1010
use Test::More tests => 1 + TESTS * 6;
1111
use test;
1212

@@ -167,6 +167,18 @@ my @tests = (
167167
message => '/dev/sda(Smart Array): Volume 0 (RAID 5): OK, Drives(4): 1I-1-1,1I-1-2,1I-1-3,1I-1-4=OK, Cache: WriteCache FlashCache ReadMem:182 MiB WriteMem:1634 MiB',
168168
c => 'issue149',
169169
},
170+
{
171+
status => OK,
172+
lsscsi => 'cciss/issue205/lsscsi-g',
173+
detect_hpsa => '',
174+
detect_cciss => '',
175+
version => 'cciss-1.12a',
176+
controller => 'issue205/cciss_vol_status-V_dev_sg0',
177+
cciss_proc => '',
178+
smartctl => '',
179+
message => '/dev/sda(Smart Array P420i): Volume 0 (RAID 1(1+0)): OK, Drives(8): 1I-1-1,1I-1-2,1I-1-3,1I-1-4,2I-1-5,2I-1-6,2I-1-7,2I-1-8=OK, Cache: WriteCache FlashCache TotalMem:816 MiB Ratio:\'10% Read / 90% Write\' ReadMem:81 MiB WriteMem:735 MiB',
180+
c => 'issue205',
181+
},
170182
);
171183

172184
# test that plugin can be created

Diff for: t/data/cciss/cciss-1.12a

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
cciss_vol_status version 1.12a

Diff for: t/data/cciss/issue205/cciss_vol_status-V_dev_sg0

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Controller: Smart Array P420i
2+
Board ID: 0x3354103c
3+
Logical drives: 1
4+
Running firmware: 8.32
5+
ROM firmware: 8.32
6+
/dev/sda: (Smart Array P420i) RAID 1(1+0) Volume 0 status: OK.
7+
Physical drives: 8
8+
connector 1I box 1 bay 1 HP EG0900FCVBL S0N2BEHX0000K50648RD HPD9 OK
9+
connector 1I box 1 bay 2 HP EG0900FCVBL S0N2C5810000K50663MY HPD9 OK
10+
connector 1I box 1 bay 3 HP EG0900FCSPN 3410A0IPFTM11409 HPD0 OK
11+
connector 1I box 1 bay 4 HP EG0900FCVBL S0N18Z0Q0000B429BNNF HPD9 OK
12+
connector 2I box 1 bay 5 HP EG0900FCSPN 24R0A0AGFTM11409 HPD0 OK
13+
connector 2I box 1 bay 6 HP EG0900FBVFQ KVK7YKBJ HPDE OK
14+
connector 2I box 1 bay 7 HP EG0900FCVBL S0N25NCW0000M501EUAH HPD9 OK
15+
connector 2I box 1 bay 8 HP EG0900FCSPN 93K0A0HFFTM11338 HPD0 OK
16+
/dev/sg0(Smart Array P420i:0): Non-Volatile Cache status:
17+
Cache configured: Yes
18+
Total cache memory: 816 MiB
19+
Cache Ratio: 10% Read / 90% Write
20+
Read cache memory: 81 MiB
21+
Write cache memory: 735 MiB
22+
Write cache enabled: Yes
23+
Flash backed cache present

Diff for: t/data/cciss/issue205/lsscsi-g

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[0:0:0:0] storage HP P420i 8.32 - /dev/sg0
2+
[0:1:0:0] disk HP LOGICAL VOLUME 8.32 /dev/sda /dev/sg1

Diff for: t/dump/cciss/issue205

+118
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
$VAR1 = {
2+
'/dev/sda' => {
3+
'board_name' => 'Smart Array P420i',
4+
'cache' => {
5+
'board' => 'Smart Array P420i',
6+
'cache_ratio' => '10% Read / 90% Write',
7+
'configured' => 'Yes',
8+
'file' => '/dev/sg0',
9+
'flash_cache' => 1,
10+
'instance' => 0,
11+
'read_cache_memory' => '81 MiB',
12+
'total_cache_memory' => '816 MiB',
13+
'write_cache_enabled' => 'Yes',
14+
'write_cache_memory' => '735 MiB'
15+
},
16+
'drives' => {
17+
'1I-1-1' => {
18+
'bay' => 1,
19+
'box' => 1,
20+
'fw' => 'HPD9',
21+
'model' => 'HP EG0900FCVBL',
22+
'phys1' => '1',
23+
'phys2' => 'I',
24+
'serial' => 'S0N2BEHX0000K50648RD',
25+
'slot' => '1I-1-1',
26+
'status' => 'OK'
27+
},
28+
'1I-1-2' => {
29+
'bay' => 2,
30+
'box' => 1,
31+
'fw' => 'HPD9',
32+
'model' => 'HP EG0900FCVBL',
33+
'phys1' => '1',
34+
'phys2' => 'I',
35+
'serial' => 'S0N2C5810000K50663MY',
36+
'slot' => '1I-1-2',
37+
'status' => 'OK'
38+
},
39+
'1I-1-3' => {
40+
'bay' => 3,
41+
'box' => 1,
42+
'fw' => 'HPD0',
43+
'model' => 'HP EG0900FCSPN',
44+
'phys1' => '1',
45+
'phys2' => 'I',
46+
'serial' => '3410A0IPFTM11409',
47+
'slot' => '1I-1-3',
48+
'status' => 'OK'
49+
},
50+
'1I-1-4' => {
51+
'bay' => 4,
52+
'box' => 1,
53+
'fw' => 'HPD9',
54+
'model' => 'HP EG0900FCVBL',
55+
'phys1' => '1',
56+
'phys2' => 'I',
57+
'serial' => 'S0N18Z0Q0000B429BNNF',
58+
'slot' => '1I-1-4',
59+
'status' => 'OK'
60+
},
61+
'2I-1-5' => {
62+
'bay' => 5,
63+
'box' => 1,
64+
'fw' => 'HPD0',
65+
'model' => 'HP EG0900FCSPN',
66+
'phys1' => '2',
67+
'phys2' => 'I',
68+
'serial' => '24R0A0AGFTM11409',
69+
'slot' => '2I-1-5',
70+
'status' => 'OK'
71+
},
72+
'2I-1-6' => {
73+
'bay' => 6,
74+
'box' => 1,
75+
'fw' => 'HPDE',
76+
'model' => 'HP EG0900FBVFQ',
77+
'phys1' => '2',
78+
'phys2' => 'I',
79+
'serial' => 'KVK7YKBJ',
80+
'slot' => '2I-1-6',
81+
'status' => 'OK'
82+
},
83+
'2I-1-7' => {
84+
'bay' => 7,
85+
'box' => 1,
86+
'fw' => 'HPD9',
87+
'model' => 'HP EG0900FCVBL',
88+
'phys1' => '2',
89+
'phys2' => 'I',
90+
'serial' => 'S0N25NCW0000M501EUAH',
91+
'slot' => '2I-1-7',
92+
'status' => 'OK'
93+
},
94+
'2I-1-8' => {
95+
'bay' => 8,
96+
'box' => 1,
97+
'fw' => 'HPD0',
98+
'model' => 'HP EG0900FCSPN',
99+
'phys1' => '2',
100+
'phys2' => 'I',
101+
'serial' => '93K0A0HFFTM11338',
102+
'slot' => '2I-1-8',
103+
'status' => 'OK'
104+
}
105+
},
106+
'pd count' => '8',
107+
'volumes' => {
108+
'0' => {
109+
'board_name' => 'Smart Array P420i',
110+
'certain' => 1,
111+
'raid_level' => 'RAID 1(1+0)',
112+
'spare_drive_status' => '',
113+
'status' => 'OK',
114+
'volume_number' => '0'
115+
}
116+
}
117+
}
118+
};

0 commit comments

Comments
 (0)