Update ssacli-helper.sh
This commit is contained in:
parent
eec9ec54ac
commit
96108c3cc5
@ -1,5 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
if ! [ "${LOGNAME}" == "root" ]; then
|
if ! [ "${LOGNAME}" == "root" ]; then
|
||||||
echo "Please run this script as root or with sudo..."
|
echo "Please run this script as root or with sudo..."
|
||||||
exit 1
|
exit 1
|
||||||
@ -23,7 +22,10 @@ Usage: $1 [OPTION]
|
|||||||
Mandatory:
|
Mandatory:
|
||||||
|
|
||||||
Optionial:
|
Optionial:
|
||||||
-f|--free-space FREE_SPACE How many free space do the arrays provide
|
-a|--array-info ARRAY_INFO Info about arrays and how much free
|
||||||
|
space they provide
|
||||||
|
-l|--ld LD_INFO Info about logical drives
|
||||||
|
-p|--pd PD_INFO Info about physical drives
|
||||||
|
|
||||||
HELP
|
HELP
|
||||||
exit 0
|
exit 0
|
||||||
@ -35,10 +37,44 @@ get_controllers() {
|
|||||||
|
|
||||||
get_array_free_space() {
|
get_array_free_space() {
|
||||||
for CONTROLLER in ${CONTROLLERS}; do
|
for CONTROLLER in ${CONTROLLERS}; do
|
||||||
|
header2 "Controller slot=${CONTROLLER}"
|
||||||
ssacli ctrl slot=${CONTROLLER} array all show | sed -e '/^$/d'
|
ssacli ctrl slot=${CONTROLLER} array all show | sed -e '/^$/d'
|
||||||
|
echo ""
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get_logical_drives() {
|
||||||
|
for CONTROLLER in ${CONTROLLERS}; do
|
||||||
|
header2 "Controller slot=${CONTROLLER}"
|
||||||
|
ssacli ctrl slot=${CONTROLLER} ld all show | sed -e '/^$/d'
|
||||||
|
echo ""
|
||||||
|
done
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
get_physical_drives() {
|
||||||
|
for CONTROLLER in ${CONTROLLERS}; do
|
||||||
|
header2 "Controller slot=${CONTROLLER}"
|
||||||
|
ssacli ctrl slot=${CONTROLLER} pd all show | sed -e '/^$/d'
|
||||||
|
echo ""
|
||||||
|
done
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
header1() {
|
||||||
|
cat << HEADER1
|
||||||
|
################################################################################
|
||||||
|
# ${@}
|
||||||
|
################################################################################
|
||||||
|
HEADER1
|
||||||
|
}
|
||||||
|
|
||||||
|
header2() {
|
||||||
|
cat << HEADER2
|
||||||
|
# ${@}
|
||||||
|
HEADER2
|
||||||
|
}
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Argument parser
|
# Argument parser
|
||||||
################################################################################
|
################################################################################
|
||||||
@ -53,9 +89,14 @@ while :; do
|
|||||||
show_help # Display a usage synopsis.
|
show_help # Display a usage synopsis.
|
||||||
exit
|
exit
|
||||||
;;
|
;;
|
||||||
-f|--free-space)
|
-a|--array-info)
|
||||||
FREE_SPACE=true
|
ARRAY_INFO=true
|
||||||
shift
|
;;
|
||||||
|
-l|--ld)
|
||||||
|
LD_INFO=true
|
||||||
|
;;
|
||||||
|
-p|--pd)
|
||||||
|
PD_INFO=true
|
||||||
;;
|
;;
|
||||||
--) # End of all options.
|
--) # End of all options.
|
||||||
shift
|
shift
|
||||||
@ -64,7 +105,6 @@ while :; do
|
|||||||
*) # Default case: No more options, so break out of the loop.
|
*) # Default case: No more options, so break out of the loop.
|
||||||
break
|
break
|
||||||
esac
|
esac
|
||||||
|
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
@ -72,12 +112,25 @@ done
|
|||||||
################################################################################
|
################################################################################
|
||||||
# Main Main Main
|
# Main Main Main
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
if ! get_controllers; then
|
if ! get_controllers; then
|
||||||
echo "Could not get list of controllers..."
|
echo "Could not get list of controllers..."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${FREE_SPACE}" == "true" ]; then
|
if [ "${ARRAY_INFO}" == "true" ]; then
|
||||||
|
header1 "Array Infos"
|
||||||
get_array_free_space
|
get_array_free_space
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${LD_INFO}" == "true" ]; then
|
||||||
|
header1 "Logical Drive Infos"
|
||||||
|
get_logical_drives
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${PD_INFO}" == "true" ]; then
|
||||||
|
header1 "Physical Drive Infos"
|
||||||
|
get_physical_drives
|
||||||
|
echo ""
|
||||||
fi
|
fi
|
||||||
Loading…
Reference in New Issue
Block a user