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

New HP ssa package changes output slightly causing logical drive regex fail #175

Open
ghost opened this issue Sep 28, 2017 · 3 comments
Open

Comments

@ghost
Copy link

ghost commented Sep 28, 2017

HP have replaced hpssacli with ssacli (dropping the hp prefix). The command behaves almost identically as far as I can tell. They have also renamed the binary to ssacli.

Binary renaming aside, the output of some of the logical drive check have changed causing the regex to fail.

Output of check_raid -d:

[root@localhost ~]# ./check_raid.pl -d
check_raid 4.0.8
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.pl line 484.
DEBUG EXEC: /proc/mdstat at ./check_raid.pl line 484.
DEBUG EXEC: /sbin/hpssacli controller all show status at ./check_raid.pl line 484.
DEBUG EXEC: /sbin/hpssacli controller slot=0 logicaldrive all show at ./check_raid.pl line 484.
Unhandled: [   Array A]
Index out of bounds at ./check_raid.pl line 3045, <$fh> line 6.
Modification of non-creatable array value attempted, subscript -1 at ./check_raid.pl line 3054, <$fh> line 6.
[root@localhost ~]#

The output change is minor in that they changed "array" to "Array".

New ssacli:

[root@localhost ~]# ssacli controller slot=0 logicaldrive all show

Smart Array P400i in Slot 0 (Embedded)

   Array A

      logicaldrive 1 (136.7 GB, RAID 1, OK)

[root@localhost ~]#

Old hpssacli:

[root@localhost ~]# hpssacli controller slot=0 logicaldrive all show

Smart Array P400i in Slot 0 (Embedded)

   array A

      logicaldrive 1 (136.7 GB, RAID 1, OK)

[root@localhost ~]#

Updating the regex on line 3033 fixes the issue:

if (my($a, $s) = /^\s+array (\S+)(?:\s*\((\S+)\))?$/) {

to

if (my($a, $s) = /^\s+Array (\S+)(?:\s*\((\S+)\))?$/) {

But you probably want a more suitable solution to deal with backwards compatibility and also perhaps the new binary name.

@glensc
Copy link
Owner

glensc commented Sep 28, 2017

Please include output of ALL commands in bugreport, i.e the commands related to ssacli it executes.

@ghost
Copy link
Author

ghost commented Oct 2, 2017

ssacli package info:

[root@localhost ~]# rpm -qa ssacli
ssacli-3.10-3.0.x86_64
[root@localhost ~]# rpm -q --filesbypkg ssacli
ssacli                    /opt/smartstorageadmin/ssacli
ssacli                    /opt/smartstorageadmin/ssacli/bin
ssacli                    /opt/smartstorageadmin/ssacli/bin/mklocks.sh
ssacli                    /opt/smartstorageadmin/ssacli/bin/rmstr
ssacli                    /opt/smartstorageadmin/ssacli/bin/ssacli
ssacli                    /opt/smartstorageadmin/ssacli/bin/ssacli-3.10-3.0.x86_64.txt
ssacli                    /opt/smartstorageadmin/ssacli/bin/ssacli.license
ssacli                    /opt/smartstorageadmin/ssacli/bin/ssascripting
ssacli                    /usr/man/man8/ssacli.8.gz
ssacli                    /usr/sbin/ssacli
ssacli                    /usr/sbin/ssascripting
ssacli                    /usr/share/smartupdate/ssacli/component.xml
[root@localhost ~]#

I've symlinked /usr/sbin/hpssacli to /usr/sbin/ssacli to enable check_raid to work.

[root@localhost ~]# ls -l /usr/sbin/hpssacli
lrwxrwxrwx. 1 root root 16 Sep 28 11:14 /usr/sbin/hpssacli -> /usr/sbin/ssacli

The script execution:

[root@localhost ~]# /root/check_raid.pl -d
check_raid 4.0.8
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 /root/check_raid.pl line 484.
DEBUG EXEC: /proc/mdstat at /root/check_raid.pl line 484.
DEBUG EXEC: /sbin/hpssacli controller all show status at /root/check_raid.pl line 484.
DEBUG EXEC: /sbin/hpssacli controller slot=0 logicaldrive all show at /root/check_raid.pl line 484.
Unhandled: [   Array A]
Index out of bounds at /root/check_raid.pl line 3045, <$fh> line 6.
Modification of non-creatable array value attempted, subscript -1 at /root/check_raid.pl line 3054, <$fh> line 6.
[root@localhost ~]#

Command outputs:

[root@localhost ~]# /sbin/dmsetup status --noflush
cl-swap: 0 24772608 linear
cl-root: 0 104857600 linear
cl-home: 0 154935296 linear
[root@localhost ~]#
[root@localhost ~]# cat /proc/mdstat
Personalities :
unused devices: <none>
[root@localhost ~]#
[root@localhost ~]# /sbin/hpssacli controller all show status

Smart Array P400i in Slot 0 (Embedded)
   Controller Status: OK
   Cache Status: Temporarily Disabled
   Battery/Capacitor Status: Failed (Replace Batteries/Capacitors)


[root@localhost ~]#
[root@localhost ~]# /sbin/hpssacli controller slot=0 logicaldrive all show

Smart Array P400i in Slot 0 (Embedded)

   Array A

      logicaldrive 1 (136.7 GB, RAID 1, OK)

[root@localhost ~]#

@gtallan
Copy link

gtallan commented Nov 10, 2017

I just noticed this change from HP myself. This seems to be a suitable change to the regex on line 3033:

if (my($a, $s) = /^\s+[Aa]rray (\S+)(?:\s*\((\S+)\))?$/) {

Then adding a new "stub" plugin module ssacli.pm, to extend the hpacucli plugin similarly to hpssacli.pm, lets it function without needing to symlink the binary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants