StorCLI plugin (MegaRAID)

The storcli plugin monitors LSI/Broadcom MegaRAID controllers, virtual drives (RAID volumes) and physical drives with StorCLI, the successor of the end-of-life MegaCLI utility. It reports health flags you can alert on, such as a degraded array, a failed disk or a SMART alert, along with temperatures and error counters.

Requirements

  • A server with a MegaRAID controller (LSI / Avago / Broadcom).
  • StorCLI installed (storcli64 or storcli). Typical location: /opt/MegaRAID/storcli/storcli64.
  • Agent360 installed. The plugin needs root or a sudo rule, see below.

Setup

1. Check that StorCLI works

sudo /opt/MegaRAID/storcli/storcli64 /call show all J

This should print JSON. If it doesn't, fix StorCLI first.

2. Allow the agent to run StorCLI

The agent normally runs as the agent360 user. When it isn't root, the plugin runs StorCLI through sudo -n, which never prompts for a password, so it needs a sudoers rule.

Create /etc/sudoers.d/agent360-storcli (mode 0440) with the exact commands the plugin runs and nothing more:

Cmnd_Alias STORCLI_MON = \
    /opt/MegaRAID/storcli/storcli64 /call show all J, \
    /opt/MegaRAID/storcli/storcli64 /call/vall show all J, \
    /opt/MegaRAID/storcli/storcli64 /call/eall/sall show all J
agent360 ALL=(root) NOPASSWD: STORCLI_MON

Replace the path with the output of which storcli64 if yours differs, then validate the file:

visudo -cf /etc/sudoers.d/agent360-storcli

Why not a plain agent360 ALL=(ALL) NOPASSWD: /path/to/storcli64?
That lets the agent360 user run any StorCLI command as root, including deleting virtual drives or erasing disks. Listing the exact arguments limits the agent to read-only queries.

3. Enable the plugin

Add to /etc/agent360.ini:

[storcli]
enabled = yes
; optional, only if StorCLI is not in a standard location
; binary = /opt/MegaRAID/storcli/storcli64

Restart the agent, for example systemctl restart agent360.

4. Test

sudo -u agent360 agent360 test storcli

You should see controller_*, vd_* and pd_* entries. If you see an error string instead, check Troubleshooting.

Configuration

OptionDefaultDescription
enablednoSet to yes to turn the plugin on.
binaryautoPath to StorCLI. If unset, the plugin tries, in order: storcli64, storcli, /opt/MegaRAID/storcli/storcli64, /usr/sbin/storcli64. A configured value is tried first.

Use the full path in binary and in the sudoers rule. The path in the sudoers rule has to match the binary that runs.

What it runs

All commands use StorCLI's JSON output (J) and are read-only:

storcli64 /call show all J
storcli64 /call/vall show all J
storcli64 /call/eall/sall show all J

A controller without virtual drives is not an error: the plugin still reports the controller and any physical drives.

Metrics

Every controller <c>, virtual drive <v>, enclosure <e> and slot <s> gets its own entry. A field that StorCLI doesn't report is returned as an empty string or 0.

controller_<c>

FieldDescription
modelController model.
statusController status as reported by StorCLI.
optimal1 if the status is Optimal, otherwise 0.
memory_correctable_errorsCorrectable memory errors.
memory_uncorrectable_errorsUncorrectable memory errors.
bbu_statusBattery backup unit status. May be a number or a string, depending on the controller.
virtual_drivesNumber of virtual drives.
physical_drivesNumber of physical drives.
roc_temperatureRAID-on-chip temperature in °C. Only present if the controller reports it.

vd_<c>_<v>

FieldDescription
nameVirtual drive name.
raid_levelRAID level, for example RAID1.
sizeSize as reported by StorCLI.
stateState, for example Optl, Dgrd, Pdgd, OfLn.
optimal1 if the state is Optl, otherwise 0.
accessAccess policy, for example RW.
consistent1 if the drive is consistent, otherwise 0.
stripe_sizeStripe size.
number_of_drivesDrives per span.
span_depthSpan depth.
default_cache_policyDefault cache policy.
current_cache_policyCurrent cache policy.
disk_cache_policyDisk cache policy.
encryptionEncryption status.

pd_<c>_<e>_<s>

FieldDescription
stateState, for example Onln, UGood, GHS, DHS, JBOD, Failed, UBad, Offln.
healthy1 for Onln, UGood, GHS, DHS or JBOD, otherwise 0.
mediaMedia type, for example HDD or SSD.
interfaceInterface, for example SAS or SATA.
sizeSize as reported by StorCLI.
modelDrive model.
media_error_countMedia error counter.
other_error_countOther error counter.
predictive_failure_countPredictive failure counter.
smart_alert1 if the drive flagged a S.M.A.R.T. alert, otherwise 0.
temperatureDrive temperature in °C. Only present if the drive reports it.

Suggested alerts

ConditionMeaning
vd_*.optimal = 0A virtual drive is degraded, rebuilding or offline.
pd_*.healthy = 0A physical drive failed, is offline or is in a bad state.
pd_*.smart_alert = 1A drive reports an imminent failure.
pd_*.predictive_failure_count > 0Drive predicts failure.
controller_*.optimal = 0The controller reports a problem.
controller_*.memory_uncorrectable_errors > 0Controller memory problem.
pd_*.temperature or controller_*.roc_temperature highCooling problem.

Troubleshooting

Message / symptomCause and fix
Could not find storcli binaryStorCLI isn't in PATH or a standard location. Install it or set binary = in [storcli].
Could not load storcli controller dataThe /call show all query failed. Run the command from step 1. Common causes: the sudoers rule is missing or doesn't match the path or arguments (sudo -n fails without a password), or no MegaRAID controller is present.
Works as root but not as agent360Sudoers problem. Run sudo -u agent360 sudo -n /opt/MegaRAID/storcli/storcli64 /call show all J. If it asks for a password or is denied, fix the rule and the path.
Some fields are empty or 0StorCLI field names differ between versions and controller generations. Compare with the output of the commands above.
No vd_* entriesThe controller has no virtual drives configured (for example JBOD-only setups).

Migrating from the MegaCLI plugin

The megacli plugin is not removed, but it only reported the last virtual drive and doesn't cover controllers or physical drives. storcli reports all virtual drives on all controllers, plus controller and physical-drive health.

The metric names are different, so existing graphs and alerts for megacli don't carry over. Recreate them with the metrics above.


Did this page help you?