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

Use of StorCli instead of MegaCli #198

Open
mlg1 opened this issue Feb 3, 2020 · 5 comments
Open

Use of StorCli instead of MegaCli #198

mlg1 opened this issue Feb 3, 2020 · 5 comments

Comments

@mlg1
Copy link

mlg1 commented Feb 3, 2020

Hi,
Just giving an idea. Megacli is very old already.

@boomertsfx
Copy link

and it's so much easier to understand, and has JSON output as well!

@RacoonSN
Copy link

(this is my first post at github)
newer version of StorCli uses another syntax then megacli:

 /bin/megacli -PDList -aALL -NoLog
CLI Version = 007.1705.0000.0000 Mar 31, 2021
Operating system = Linux 4.19.0-16-amd64
Status = Failure
Description = Deprecated command. Please use the new syntax.
ls -l /bin/megacli
lrwxrwxrwx. 1 root root 31 Jun 16 14:55 /bin/megacli -> /opt/MegaRAID/storcli/storcli64

/opt/MegaRAID/storcli/storcli64 -v
      StorCli SAS Customization Utility Ver 007.1705.0000.0000 Mar 31, 2021
    (c)Copyright 2021, Broadcom Inc. All Rights Reserved.

I downloaded the deb package from
https://www.thomas-krenn.com/de/wiki/StorCLI

According to

https://www.broadcom.com/support/knowledgebase/1211161499760/lsi-command-line-interface-cross-reference-megacli-vs-twcli-vs-s
and
https://www.thomas-krenn.com/de/wiki/StorCLI

these should be equivalent commands

/bin/megacli -PDList -aALL -NoLog
/opt/MegaRAID/storcli/storcli64 /cx/eall/sall show all nolog

this syntax works for me

storcli64 /call /eall /sall show nolog
CLI Version = 007.1705.0000.0000 Mar 31, 2021
Operating system = Linux 4.19.0-16-amd64
Controller = 0
Status = Success
Description = Show Drive Information Succeeded.


Drive Information :
=================

------------------------------------------------------------------------------
EID:Slt DID State  DG      Size Intf Med SED PI SeSz Model            Sp Type
------------------------------------------------------------------------------
8:0      12 Onln    0 12.732 TB SAS  HDD N   N  512B ST14000NM0048    U  -
8:1       9 Failed  0 12.732 TB SAS  HDD N   N  512B ST14000NM0048    U  -
8:2      10 Onln    0 12.732 TB SAS  HDD N   N  512B ST14000NM0048    U  -
8:3      11 Onln    0 12.732 TB SAS  HDD N   N  512B ST14000NM0048    U  -
------------------------------------------------------------------------------

EID=Enclosure Device ID|Slt=Slot No|DID=Device ID|DG=DriveGroup
DHS=Dedicated Hot Spare|UGood=Unconfigured Good|GHS=Global Hotspare
UBad=Unconfigured Bad|Sntze=Sanitize|Onln=Online|Offln=Offline|Intf=Interface
Med=Media Type|SED=Self Encryptive Drive|PI=Protection Info
SeSz=Sector Size|Sp=Spun|U=Up|D=Down|T=Transition|F=Foreign
UGUnsp=UGood Unsupported|UGShld=UGood shielded|HSPShld=Hotspare shielded
CFShld=Configured shielded|Cpybck=CopyBack|CBShld=Copyback Shielded
UBUnsp=UBad Unsupported|Rbld=Rebuild
/bin/megacli -LdInfo -Lall -aALL -NoLog
/opt/MegaRAID/storcli/storcli64 /cx/vall show all nolog

this syntax works for me

storcli64  /call /vall show all nolog

CLI Version = 007.1705.0000.0000 Mar 31, 2021
Operating system = Linux 4.19.0-16-amd64
Controller = 0
Status = Success
Description = None


/c0/v0 :
======

--------------------------------------------------------------
DG/VD TYPE  State Access Consist Cache Cac sCC      Size Name
--------------------------------------------------------------
0/0   RAID5 Dgrd  RW     Yes     RWTD  -   OFF 38.198 TB
--------------------------------------------------------------

VD=Virtual Drive| DG=Drive Group|Rec=Recovery
Cac=CacheCade|OfLn=OffLine|Pdgd=Partially Degraded|Dgrd=Degraded
Optl=Optimal|dflt=Default|RO=Read Only|RW=Read Write|HD=Hidden|TRANS=TransportReady
B=Blocked|Consist=Consistent|R=Read Ahead Always|NR=No Read Ahead|WB=WriteBack
AWB=Always WriteBack|WT=WriteThrough|C=Cached IO|D=Direct IO|sCC=Scheduled
Check Consistency


PDs for VD 0 :
============

------------------------------------------------------------------------------
EID:Slt DID State  DG      Size Intf Med SED PI SeSz Model            Sp Type
------------------------------------------------------------------------------
8:0      12 Onln    0 12.732 TB SAS  HDD N   N  512B ST14000NM0048    U  -
8:1       9 Failed  0 12.732 TB SAS  HDD N   N  512B ST14000NM0048    U  -
8:2      10 Onln    0 12.732 TB SAS  HDD N   N  512B ST14000NM0048    U  -
8:3      11 Onln    0 12.732 TB SAS  HDD N   N  512B ST14000NM0048    U  -
------------------------------------------------------------------------------

EID=Enclosure Device ID|Slt=Slot No|DID=Device ID|DG=DriveGroup
DHS=Dedicated Hot Spare|UGood=Unconfigured Good|GHS=Global Hotspare
UBad=Unconfigured Bad|Sntze=Sanitize|Onln=Online|Offln=Offline|Intf=Interface
Med=Media Type|SED=Self Encryptive Drive|PI=Protection Info
SeSz=Sector Size|Sp=Spun|U=Up|D=Down|T=Transition|F=Foreign
UGUnsp=UGood Unsupported|UGShld=UGood shielded|HSPShld=Hotspare shielded
CFShld=Configured shielded|Cpybck=CopyBack|CBShld=Copyback Shielded
UBUnsp=UBad Unsupported|Rbld=Rebuild


VD0 Properties :
==============
Strip Size = 256 KB
Number of Blocks = 82031149056
VD has Emulated PD = Yes
Span Depth = 1
Number of Drives Per Span = 4
Write Cache(initial setting) = WriteThrough
Disk Cache Policy = Disabled
Encryption = None
Data Protection = Disabled
Active Operations = None
Exposed to OS = Yes
OS Drive Name = /dev/sda
Creation Date = 03-02-2021
Creation Time = 03:26:47 PM
Emulation type = default
Cachebypass size = Cachebypass-64k
Cachebypass Mode = Cachebypass Intelligent
Is LD Ready for OS Requests = Yes
SCSI NAA Id = 600e00040010f26027ad7d3730ecb7ad
Unmap Enabled = N/A

/bin/megacli -AdpBbuCmd -GetBbuStatus -aALL -NoLog
/opt/MegaRAID/storcli/storcli64 /cx/bbu show status nolog

this syntax works for me

storcli64 /call /bbu show status nolog
CLI Version = 007.1705.0000.0000 Mar 31, 2021
Operating system = Linux 4.19.0-16-amd64
Controller = 0
Status = Failure
Description = None

Detailed Status :
===============

----------------------------------------------
Ctrl Status Property ErrMsg             ErrCd
----------------------------------------------
   0 Failed -        Battery is absent!    34
----------------------------------------------

I extend the sudoers

 cat /etc/sudoers.d/check_raid

# Lines matching CHECK_RAID added by /usr/lib/nagios/plugins/check_raid -S on Wed Jun 16 14:57:01 2021
User_Alias CHECK_RAID=nagios, icinga, sensu
Defaults:CHECK_RAID !requiretty
CHECK_RAID ALL=(root) NOPASSWD: /bin/megacli -PDList -aALL -NoLog
CHECK_RAID ALL=(root) NOPASSWD: /bin/megacli -LdInfo -Lall -aALL -NoLog
CHECK_RAID ALL=(root) NOPASSWD: /bin/megacli -AdpBbuCmd -GetBbuStatus -aALL -NoLog

CHECK_RAID ALL=(root) NOPASSWD: /opt/MegaRAID/storcli/storcli64  /call /eall /sall show nolog
CHECK_RAID ALL=(root) NOPASSWD: /bin/megacli  /call /eall /sall show nolog

CHECK_RAID ALL=(root) NOPASSWD: /bin/megacli  /call /vall show all nolog
CHECK_RAID ALL=(root) NOPASSWD: /opt/MegaRAID/storcli/storcli64 /call /vall show all nolog

CHECK_RAID ALL=(root) NOPASSWD: /bin/megacli /call /bbu show status nolog
CHECK_RAID ALL=(root) NOPASSWD: /opt/MegaRAID/storcli/storcli64 /call /bbu show status nolog

And change the binary:

3785   sub commands {
3786         {
3787 #               'pdlist' => ['-|', '@CMD', '-PDList', '-aALL', '-NoLog'],
3788  #              'ldinfo' => ['-|', '@CMD', '-LdInfo', '-Lall', '-aALL', '-NoLog'],
3789   #             'battery' => ['-|', '@CMD', '-AdpBbuCmd', '-GetBbuStatus', '-aALL', '-NoLog'],
3790                 'pdlist' => ['-|', '@CMD', '/call', '/eall', '/sall', 'show', 'nolog'],
3791                 'ldinfo' => ['-|', '@CMD', '/call', '/vall', 'show', 'all', 'nolog'],
3792                 'battery' => ['-|', '@CMD', '/call', '/bbu', 'show', 'status', 'nolog'],
3793         }
3794   }
3795
3796   # TODO: process from COMMANDS
3797   sub sudo {
3798         my ($this, $deep) = @_;
3799         # quick check when running check
3800         return 1 unless $deep;
3801
3802         my $cmd = $this->{program};
3803
3804         (
3805                 "CHECK_RAID ALL=(root) NOPASSWD: $cmd -PDList -aALL -NoLog",
3806                 "CHECK_RAID ALL=(root) NOPASSWD: $cmd -LdInfo -Lall -aALL -NoLog",
3807                 "CHECK_RAID ALL=(root) NOPASSWD: $cmd -AdpBbuCmd -GetBbuStatus -aALL -NoLog",
3808                 "CHECK_RAID ALL=(root) NOPASSWD: $cmd /call /eall /sall show nolog",
3809                 "CHECK_RAID ALL=(root) NOPASSWD: $cmd /call /vall show all nolog",
3810                 "CHECK_RAID ALL=(root) NOPASSWD: $cmd /call /bbu show status nolog",
3811         );
3812   }

before my change:

sudo -u nagios /usr/lib/nagios/plugins/check_raid
sudo: a password is required
sudo: a password is required
CRITICAL: megacli:[Volumes(0): ; Devices(0): ]

after the change:

sudo -u nagios /usr/lib/nagios/plugins/check_raid
sudo: a password is required
sudo: a password is required
OK: megacli:[Volumes(0): ; Devices(0): ]

both on the same machine as above

@mbay0r
Copy link

mbay0r commented Nov 21, 2023

Has anyone got this up and running? thanks

@calestyo
Copy link

calestyo commented Mar 4, 2024

Seems StorCLI has now also been replaced by PERCCLI.

@boomertsfx
Copy link

boomertsfx commented Mar 4, 2024

Seems StorCLI has now also been replaced by PERCCLI.

storcli is the generic Broadcom tool to manage arrays for most of their RAID cards. perccli is Dell's version of storcli -- so that complicates things with scripts like this. I still use both depending on server vendor, but I just symlink everything to storcli so it works on ever server.

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

No branches or pull requests

5 participants