Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for cciss_vol_status 1.12a #221

Closed
wants to merge 6 commits into from

Conversation

sylvainfaivre
Copy link

New PR replacing #205

@glensc I don't really understand why you asked for a new PR, as @knorrie's commits can be merged on the current master without any conflict, but here is a new PR with same code anyway.

knorrie and others added 6 commits July 28, 2021 15:29
The latest version of cciss_vol_status is 1.12a. For the first time, an
extra letter was appended.

The version pattern would not match any more. The function will return
0, and later on, the code to detect if the version is >= 1.10 (for new
added functionality) would wrongly return false.

So, change it to also accept an optional letter at the end, but ignore
it. Adding it to the detected version string will result in errors like
"Argument "1.12a" isn't numeric" later on in the code, and because right
now, there is no need to be able to distinguish between 1.12 and 1.12a
in the plugin.
In version 1.12a of cciss_vol_status,
  RAID 1
is changed to
  RAID1(1+0)
which makes the pattern fail.

Accept the optional (X+Y).

Without this change, no array would be detected, and the program will
fail with:

  UNKNOWN: cciss:[Plugin error]
In version 1.12a, cciss_vol_status changes the output of physical location of drives:

    -       sprintf(tail, " connector %c%c box %d bay %d %40s %40s %8s",
    +       sprintf(tail, " connector %c%c box %d bay %-2d %40s %40s %8s",

This means that the bay number is now 2 posititions, left aligned.
So, e.g. '1 ', '6 ', or '12'.

Allow for an extra space to be present when the bay number is less than
10.

Without this change, the pattern will not match any more, and the
program complains about Unparsed lines.
Since v1.12, cciss_vol_status outputs these two new extra lines about
cache status:

        Total cache memory: 816 MiB
               Cache Ratio: 10% Read / 90% Write

Make sure we parse them and include them in cstatus, so that they also
end up in the test dump files which makes the tests pass again.
This adds a test case which contains all changes to cciss_vol_status
1.12 and 1.12a output.
@sylvainfaivre
Copy link
Author

This code works well and fixes our problems on 3 boxes with varying Debian and cciss_vol_status versions :

  • box 1 : Debian Stretch, cciss_vol_status version 1.11, RAID 5
$ > ./check_raid-fixed.pl  -d
check_raid 4.0.10-27-g84f14c5
Visit <https://github.com/glensc/nagios-plugin-check_raid#reporting-bugs> how to report bugs
Please include output of **ALL** commands in bugreport

DEBUG EXEC: /sbin/dmsetup status --noflush at ./check_raid-fixed.pl line 503.
DEBUG EXEC: /usr/bin/lsscsi -g at ./check_raid-fixed.pl line 503.
DEBUG EXEC: >&2 /usr/bin/cciss_vol_status -v at ./check_raid-fixed.pl line 499.
DEBUG EXEC: /usr/bin/cciss_vol_status -V /dev/sg0 at ./check_raid-fixed.pl line 503.
OK: cciss:[/dev/sda(Smart Array P410): Volume 0 (RAID 5): OK, Drives(3): 1I-1-1,1I-1-2,1I-1-3=OK, Cache: WriteCache ReadMem:36 MiB WriteMem:108 MiB]
  • box 2 : Debian Bullseye, cciss_vol_status version 1.12a, RAID 5
$ > ./check_raid-fixed.pl -d
check_raid 4.0.10-27-g84f14c5
Visit <https://github.com/glensc/nagios-plugin-check_raid#reporting-bugs> how to report bugs
Please include output of **ALL** commands in bugreport

DEBUG EXEC: /sbin/dmsetup status --noflush at ./check_raid-fixed.pl line 503.
DEBUG EXEC: /usr/bin/lsscsi -g at ./check_raid-fixed.pl line 503.
DEBUG EXEC: >&2 /usr/bin/cciss_vol_status -v at ./check_raid-fixed.pl line 499.
DEBUG EXEC: /usr/bin/cciss_vol_status -V /dev/sg0 at ./check_raid-fixed.pl line 503.
OK: cciss:[/dev/sda(Smart Array P420): Volume 0 (RAID 5): OK, Drives(3): 1I-1-1,1I-1-2,1I-1-3=OK, Cache: WriteCache FlashCache TotalMem:816 MiB Ratio:'10% Read / 90% Write' ReadMem:82 MiB WriteMem:734 MiB]
  • box 3 : Debian Bullseye, cciss_vol_status version 1.12a, RAID 1+0, cache disabled :
$ > ./check_raid-fixed.pl -d
check_raid 4.0.10-27-g84f14c5
Visit <https://github.com/glensc/nagios-plugin-check_raid#reporting-bugs> how to report bugs
Please include output of **ALL** commands in bugreport

DEBUG EXEC: /sbin/dmsetup status --noflush at ./check_raid-fixed.pl line 503.
DEBUG EXEC: /usr/bin/lsscsi -g at ./check_raid-fixed.pl line 503.
DEBUG EXEC: >&2 /usr/bin/cciss_vol_status -v at ./check_raid-fixed.pl line 499.
DEBUG EXEC: /usr/bin/cciss_vol_status -V /dev/sg0 at ./check_raid-fixed.pl line 503.
Unparsed[           Unknown cache disable code: 30] at ./check_raid-fixed.pl line 1898, <$fh> line 18.
WARNING: cciss:[/dev/sda(Smart Array P220i): Volume 0 (RAID 1(1+0)): OK, Drives(2): 1I-1-1,1I-1-2=OK, Cache: WriteCache:DISABLED FlashCache TotalMem:304 MiB Ratio:'25% Read / 75% Write' ReadMem:76 MiB WriteMem:228 MiB]

@glensc
Copy link
Owner

glensc commented Mar 4, 2024

merged #205 instead

@glensc glensc closed this Mar 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants