Here are some “quick & dirty” working userparameter for Zabbix :), they check:
- how many paths per device are available, </li>
- if some of that paths are in a faulty state</li>
Number of paths
1
UserParameter=Count.Multipath.Devices, echo $(( $(echo 'show paths' | sudo /sbin/multipathd -k | grep ready | wc -l) / $(echo 'show maps' | sudo /sbin/multipathd -k | grep dm | wc -l) ))
this mix of commands uses the multipathd -k
and gets the paths and maps. Is the amount of paths / maps = 4
we assume that all 4 paths for each device is ok.
Checking if some is faulty
1
UserParameter=Check.Failed.Path, echo 'show paths' | sudo /sbin/multipathd -k | awk '/failed/||/faulty/||/shaky/||/offline/ {print $2,$5,$6,$7}'|wc -l
We pipe the output of echo 'show path' | multipathd -k
in an awk
and check if the following failure is in the returnvalue
- shaky / faulty If a path connected and ready for I/O is the status “online”, otherwise the status is faulty or shaky.
- failed is a DM down, its marked as “failed”. It means the same like “faulty”.
- offline Is a SCSI Device deactivated, the Online_Status changed to offline.
The returnvalue of this script is 0, when everything is ok. Is the returnwert something else, you have to check the multipathing.
Trigger
The trigger in zabbix react to the specific values and because of that, the escalation starts.
Berechtigungen
To use multipathd in this way, you have to configure some permissions in sudo to get the job done. Take a look to this article SUDO Settings for Zabbix.