This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision | |||
|
aix:scripts_category:nagios_aix_check [2025/02/11 14:54] manu [Check SEA status] |
aix:scripts_category:nagios_aix_check [2025/02/24 15:34] (current) manu [Check path disks] |
||
|---|---|---|---|
| Line 572: | Line 572: | ||
| # v1.2 change for VSCSI | # v1.2 change for VSCSI | ||
| # v1.3 add verbose (-v), improvements linux | # v1.3 add verbose (-v), improvements linux | ||
| + | # On linux, add into /etc/sudoers the following lines for linux: | ||
| + | # nagios ALL=(ALL) NOPASSWD: /usr/sbin/multipath | ||
| + | # nrpe ALL=(ALL) NOPASSWD: /usr/sbin/multipath | ||
| + | |||
| # number of path per type of disk | # number of path per type of disk | ||
| Line 624: | Line 628: | ||
| pathok_pct=$(echo "scale=1;100*$pathok/$nbpath" | bc | cut -d '.' -f1) | pathok_pct=$(echo "scale=1;100*$pathok/$nbpath" | bc | cut -d '.' -f1) | ||
| verbose="$verbose $i;$pathok/$nbpath" # verbose message | verbose="$verbose $i;$pathok/$nbpath" # verbose message | ||
| - | if [ "$pathok_pct" -le "50" ] | + | if [ "$pathok_pct" -lt "50" ] |
| then | then | ||
| MSG="$MSG $i;$pathok/$nbpath" | MSG="$MSG $i;$pathok/$nbpath" | ||
| Line 709: | Line 713: | ||
| if [ $STATUS -lt $STATE_CRITICAL ] | if [ $STATUS -lt $STATE_CRITICAL ] | ||
| then | then | ||
| - | STATUS1=$STATE_CRITICAL | + | STATUS=$STATE_CRITICAL |
| - | STATUS=$(echo "$STATUS $STATUS1" | tr ' ' '\n' | sort -u | tail -1) | + | |
| fi | fi | ||
| else | else | ||
| - | if [ "$pathok_pct" -eq "100" ] | + | if [ "$pathok_pct" -ne "100" ] |
| then | then | ||
| - | STATUS1=$STATE_OK | ||
| - | STATUS=$(echo "$STATUS $STATUS1" | tr ' ' '\n' | sort -u | tail -1) | ||
| - | else | ||
| MSG="$MSG $hdisk;$pathok/$nbpath" | MSG="$MSG $hdisk;$pathok/$nbpath" | ||
| - | STATUS1=$STATE_WARNING | + | if [ $STATUS -lt $STATE_CRITICAL ] |
| - | STATUS=$(echo "$STATUS $STATUS1" | tr ' ' '\n' | sort -u | tail -1) | + | then |
| + | STATUS=$STATE_WARNING | ||
| + | fi | ||
| fi | fi | ||
| fi | fi | ||
| done | done | ||
| - | |||
| - | if [ $STATUS -eq $STATE_OK ] | ||
| - | then | ||
| - | MSG="ALL disks have $pathok paths" | ||
| - | fi | ||
| } | } | ||
| Line 743: | Line 740: | ||
| STATUS=$STATE_UNKNOWN | STATUS=$STATE_UNKNOWN | ||
| fi | fi | ||
| + | fi | ||
| + | |||
| + | if [ $STATUS -eq $STATE_OK ] | ||
| + | then | ||
| + | echo "OK" | ||
| + | else | ||
| + | echo "$MSG" | ||
| fi | fi | ||
| Line 751: | Line 755: | ||
| fi | fi | ||
| - | echo "$MSG" | ||
| exit $STATUS | exit $STATUS | ||
| </code> | </code> | ||