2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00

Shellcheck

This commit is contained in:
Diver 2016-12-26 23:50:15 +03:00
parent 9c2aabf4d6
commit 210ebae0a0
2 changed files with 24 additions and 24 deletions

View File

@ -180,7 +180,7 @@ if [ "$1" = "config" ] ; then
${LUN}_write.min 0 ${LUN}_write.min 0
${LUN}_write.draw STACK ${LUN}_write.draw STACK
EOF EOF
done <<< $LUNLIST done <<< "$LUNLIST"
cat <<-EOF cat <<-EOF
@ -202,7 +202,7 @@ if [ "$1" = "config" ] ; then
${LUN}_writereq.type COUNTER ${LUN}_writereq.type COUNTER
${LUN}_writereq.min 0 ${LUN}_writereq.min 0
EOF EOF
done <<< $LUNLIST done <<< "$LUNLIST"
cat <<-EOF cat <<-EOF
@ -215,7 +215,7 @@ if [ "$1" = "config" ] ; then
echo -n "graph_order " echo -n "graph_order "
while read -r LUN ; do while read -r LUN ; do
echo -n "${LUN}_busyticks ${LUN}_idleticks ${LUN}_bta=${LUN}_busyticks_spa ${LUN}_idleticks_spa ${LUN}_btb=${LUN}_busyticks_spb ${LUN}_idleticks_spb " echo -n "${LUN}_busyticks ${LUN}_idleticks ${LUN}_bta=${LUN}_busyticks_spa ${LUN}_idleticks_spa ${LUN}_btb=${LUN}_busyticks_spb ${LUN}_idleticks_spb "
done <<< $LUNLIST done <<< "$LUNLIST"
echo "" echo ""
while read -r LUN ; do while read -r LUN ; do
cat <<-EOF cat <<-EOF
@ -242,7 +242,7 @@ if [ "$1" = "config" ] ; then
${LUN}_load_spa.cdef 100,${LUN}_bta,${LUN}_busyticks_spa,${LUN}_idleticks_spa,+,/,* ${LUN}_load_spa.cdef 100,${LUN}_bta,${LUN}_busyticks_spa,${LUN}_idleticks_spa,+,/,*
${LUN}_load_spb.cdef 100,${LUN}_btb,${LUN}_busyticks_spa,${LUN}_idleticks_spa,+,/,* ${LUN}_load_spb.cdef 100,${LUN}_btb,${LUN}_busyticks_spa,${LUN}_idleticks_spa,+,/,*
EOF EOF
done <<< $LUNLIST done <<< "$LUNLIST"
cat <<-EOF cat <<-EOF
@ -257,7 +257,7 @@ if [ "$1" = "config" ] ; then
${LUN}_outstandsum.label $LUN ${LUN}_outstandsum.label $LUN
${LUN}_outstandsum.type COUNTER ${LUN}_outstandsum.type COUNTER
EOF EOF
done <<< $LUNLIST done <<< "$LUNLIST"
cat <<-EOF cat <<-EOF
@ -272,7 +272,7 @@ if [ "$1" = "config" ] ; then
${LUN}_nonzeroreq.label $LUN ${LUN}_nonzeroreq.label $LUN
${LUN}_nonzeroreq.type COUNTER ${LUN}_nonzeroreq.type COUNTER
EOF EOF
done <<< $LUNLIST done <<< "$LUNLIST"
cat <<-EOF cat <<-EOF
@ -286,7 +286,7 @@ if [ "$1" = "config" ] ; then
${LUN}_implic_tr.label ${LUN} Implicit Trespasses ${LUN}_implic_tr.label ${LUN} Implicit Trespasses
${LUN}_explic_tr.label ${LUN} Explicit Trespasses ${LUN}_explic_tr.label ${LUN} Explicit Trespasses
EOF EOF
done <<< $LUNLIST done <<< "$LUNLIST"
cat <<-EOF cat <<-EOF
@ -331,7 +331,7 @@ if [ "$1" = "config" ] ; then
${LUN}_ql_l_b.label ${LUN} Queue Length SPB ${LUN}_ql_l_b.label ${LUN} Queue Length SPB
${LUN}_ql_l_b.cdef ${LUN}_outstandsum,${LUN}_nonzeroreq,2,/,-,${LUN}_readreq,${LUN}_writereq,+,/,${LUN}_busyticks_spb,*,${LUN}_busyticks_spb,${LUN}_idleticks_spb,+,/ ${LUN}_ql_l_b.cdef ${LUN}_outstandsum,${LUN}_nonzeroreq,2,/,-,${LUN}_readreq,${LUN}_writereq,+,/,${LUN}_busyticks_spb,*,${LUN}_busyticks_spb,${LUN}_idleticks_spb,+,/
EOF EOF
done <<< $LUNLIST done <<< "$LUNLIST"
exit 0 exit 0
fi fi
@ -352,7 +352,7 @@ while read -r LUN ; do
s/Implicit Trespasses\:\ */${LUN}_implic_tr.value /p; s/Implicit Trespasses\:\ */${LUN}_implic_tr.value /p;
s/Explicit Trespasses\:\ */${LUN}_explic_tr.value /p; s/Explicit Trespasses\:\ */${LUN}_explic_tr.value /p;
' ;" ' ;"
done <<< $LUNLIST done <<< "$LUNLIST"
ANSWER="$($BIGSSHCMD)" ANSWER="$($BIGSSHCMD)"
echo "multigraph emc_vnx_block_blocks" echo "multigraph emc_vnx_block_blocks"
echo "$ANSWER" | grep "read\.\|write\." echo "$ANSWER" | grep "read\.\|write\."
@ -363,7 +363,7 @@ echo -e "\nmultigraph emc_vnx_block_ticks"
while read -r LUN ; do while read -r LUN ; do
echo "${LUN}_load_spa.value 0" echo "${LUN}_load_spa.value 0"
echo "${LUN}_load_spb.value 0" echo "${LUN}_load_spb.value 0"
done <<< $LUNLIST done <<< "$LUNLIST"
echo "$ANSWER" | grep "busyticks_spa\.\|idleticks_spa\." echo "$ANSWER" | grep "busyticks_spa\.\|idleticks_spa\."
echo "$ANSWER" | grep "busyticks_spb\.\|idleticks_spb\." echo "$ANSWER" | grep "busyticks_spb\.\|idleticks_spb\."
@ -387,5 +387,5 @@ echo -e "\nmultigraph emc_vnx_block_queue"
while read -r LUN ; do while read -r LUN ; do
echo "${LUN}_ql_l_a.value 0 " echo "${LUN}_ql_l_a.value 0 "
echo "${LUN}_ql_l_b.value 0 " echo "${LUN}_ql_l_b.value 0 "
done <<< $LUNLIST done <<< "$LUNLIST"
exit 0 exit 0

View File

@ -129,8 +129,8 @@ if [ "$1" = "suggest" ]; then
fi fi
STATSTYPE=$(echo "${0##*/}" | cut -d _ -f 1-5) STATSTYPE=$(echo "${0##*/}" | cut -d _ -f 1-5)
if [ $STATSTYPE = "emc_vnx_file_nfs_stats" ]; then STATSTYPE=NFS; if [ "$STATSTYPE" = "emc_vnx_file_nfs_stats" ]; then STATSTYPE=NFS;
elif [ $STATSTYPE = "emc_vnx_file_basicdm_stats" ]; then STATSTYPE=BASICDM; elif [ "$STATSTYPE" = "emc_vnx_file_basicdm_stats" ]; then STATSTYPE=BASICDM;
else echo "Do not know what to do. Name the plugin as 'emc_vnx_file_nfs_stats_<HOSTNAME>' or 'emc_vnx_file_basicdm_stats_<HOSTNAME>'"; exit 1; fi else echo "Do not know what to do. Name the plugin as 'emc_vnx_file_nfs_stats_<HOSTNAME>' or 'emc_vnx_file_basicdm_stats_<HOSTNAME>'"; exit 1; fi
# echo $STATSTYPE # echo $STATSTYPE
@ -233,7 +233,7 @@ if [ "$1" = "config" ] ; then
if [ $STATSTYPE = "NFS" ] ; then if [ $STATSTYPE = "NFS" ] ; then
#nfs.v3.op data #nfs.v3.op data
member_elements=$($SSH server_stats $server -info nfs.v3.op | grep member_elements | sed -ne 's/^.*= //p') member_elements=$($SSH server_stats $server -info nfs.v3.op | grep member_elements | sed -ne 's/^.*= //p')
IFS=',' read -ra graphs <<< $member_elements IFS=',' read -ra graphs <<< "$member_elements"
cat <<-EOF cat <<-EOF
multigraph vnx_emc_v3_calls_s multigraph vnx_emc_v3_calls_s
graph_title EMC VNX 5300 NFSv3 Calls per second graph_title EMC VNX 5300 NFSv3 Calls per second
@ -274,7 +274,7 @@ if [ "$1" = "config" ] ; then
graphs=() graphs=()
#nfs.v4.op data #nfs.v4.op data
member_elements=$($SSH server_stats $server -info nfs.v4.op | grep member_elements | sed -ne 's/^.*= //p') member_elements=$($SSH server_stats $server -info nfs.v4.op | grep member_elements | sed -ne 's/^.*= //p')
IFS=',' read -ra graphs <<< $member_elements IFS=',' read -ra graphs <<< "$member_elements"
cat <<-EOF cat <<-EOF
multigraph vnx_emc_v4_calls_s multigraph vnx_emc_v4_calls_s
graph_title EMC VNX 5300 NFSv4 Calls per second graph_title EMC VNX 5300 NFSv4 Calls per second
@ -317,7 +317,7 @@ if [ "$1" = "config" ] ; then
# Total Read Write Suspicious Total Read Write Avg # Total Read Write Suspicious Total Read Write Avg
# Ops/s Ops/s Ops/s Ops diff KiB/s KiB/s KiB/s uSec/call # Ops/s Ops/s Ops/s Ops diff KiB/s KiB/s KiB/s uSec/call
member_elements=$($SSH server_stats server_2 -monitor nfs.client -count 1 -terminationsummary no -titles never | sed -ne 's/^.*id=//p' | cut -d' ' -f1) member_elements=$($SSH server_stats server_2 -monitor nfs.client -count 1 -terminationsummary no -titles never | sed -ne 's/^.*id=//p' | cut -d' ' -f1)
readarray graphs2 <<< $member_elements readarray graphs2 <<< "$member_elements"
cat <<-EOF cat <<-EOF
multigraph vnx_emc_nfs_client_ops_s multigraph vnx_emc_nfs_client_ops_s
@ -391,7 +391,7 @@ for server in $nas_servers; do
if [ $STATSTYPE = "BASICDM" ] ; then if [ $STATSTYPE = "BASICDM" ] ; then
member_elements=$($SSH server_stats $server -count 1 -terminationsummary no -titles never | grep '^[^[:space:]]') member_elements=$($SSH server_stats $server -count 1 -terminationsummary no -titles never | grep '^[^[:space:]]')
# NUMCOL=5 # NUMCOL=5
IFS=$' ' read -ra graphs <<< $member_elements IFS=$' ' read -ra graphs <<< "$member_elements"
echo "multigraph emc_vnx_cpu_percent" echo "multigraph emc_vnx_cpu_percent"
echo "${server}_cpuutil.value ${graphs[1]}" echo "${server}_cpuutil.value ${graphs[1]}"
@ -405,7 +405,7 @@ member_elements=$($SSH server_stats $server -count 1 -terminationsummary no -tit
echo "${server}_stor_write.value ${graphs[5]}" echo "${server}_stor_write.value ${graphs[5]}"
member_elements=$($SSH server_stats $server -monitor kernel.memory -count 1 -terminationsummary no -titles never | grep '^[^[:space:]]') member_elements=$($SSH server_stats $server -monitor kernel.memory -count 1 -terminationsummary no -titles never | grep '^[^[:space:]]')
IFS=$' ' read -ra graphs <<< $member_elements IFS=$' ' read -ra graphs <<< "$member_elements"
echo -e "\nmultigraph emc_vnx_memory" echo -e "\nmultigraph emc_vnx_memory"
echo "${server}_total.value ${graphs[14]}" echo "${server}_total.value ${graphs[14]}"
@ -432,10 +432,10 @@ member_elements=$($SSH server_stats $server -count 1 -terminationsummary no -tit
#nfs.v3.op data #nfs.v3.op data
member_elements=$($SSH server_stats $server -monitor nfs.v3.op -count 1 -terminationsummary no -titles never | sed -ne 's/^.*v3/v3/p') member_elements=$($SSH server_stats $server -monitor nfs.v3.op -count 1 -terminationsummary no -titles never | sed -ne 's/^.*v3/v3/p')
NUMCOL=5 NUMCOL=5
LINES=$(wc -l <<< $member_elements) LINES=$(wc -l <<< "$member_elements")
while IFS=$'\n' read -ra graphs ; do while IFS=$'\n' read -ra graphs ; do
element+=( $graphs ) element+=( $graphs )
done <<< $member_elements done <<< "$member_elements"
echo "multigraph vnx_emc_v3_calls_s" echo "multigraph vnx_emc_v3_calls_s"
for ((i=0; i<$((LINES)); i++ )); do for ((i=0; i<$((LINES)); i++ )); do
@ -457,10 +457,10 @@ member_elements=$($SSH server_stats $server -count 1 -terminationsummary no -tit
#nfs.v4.op data #nfs.v4.op data
member_elements=$($SSH server_stats $server -monitor nfs.v4.op -count 1 -terminationsummary no -titles never | sed -ne 's/^.*v4/v4/p') member_elements=$($SSH server_stats $server -monitor nfs.v4.op -count 1 -terminationsummary no -titles never | sed -ne 's/^.*v4/v4/p')
NUMCOL=5 NUMCOL=5
LINES=$(wc -l <<< $member_elements) LINES=$(wc -l <<< "$member_elements")
while IFS=$'\n' read -ra graphs ; do while IFS=$'\n' read -ra graphs ; do
element+=( $graphs ) element+=( $graphs )
done <<< $member_elements done <<< "$member_elements"
echo -e "\nmultigraph vnx_emc_v4_calls_s" echo -e "\nmultigraph vnx_emc_v4_calls_s"
for ((i=0; i<$((LINES)); i++ )); do for ((i=0; i<$((LINES)); i++ )); do
@ -483,10 +483,10 @@ member_elements=$($SSH server_stats $server -count 1 -terminationsummary no -tit
echo -e "\nmultigraph vnx_emc_nfs_client_ops_s" echo -e "\nmultigraph vnx_emc_nfs_client_ops_s"
member_elements=$($SSH server_stats server_2 -monitor nfs.client -count 1 -terminationsummary no -titles never | sed -ne 's/^.*id=//p') member_elements=$($SSH server_stats server_2 -monitor nfs.client -count 1 -terminationsummary no -titles never | sed -ne 's/^.*id=//p')
NUMCOL=9 NUMCOL=9
LINES=$(wc -l <<< $member_elements) LINES=$(wc -l <<< "$member_elements")
while IFS=$'\n' read -ra graphs; do while IFS=$'\n' read -ra graphs; do
element+=($graphs) element+=($graphs)
done <<< $member_elements done <<< "$member_elements"
for (( i=0; i<$((LINES)); i++ )); do for (( i=0; i<$((LINES)); i++ )); do
client=$( echo ${element[i*$NUMCOL]} | sed -ne 's/\./_/pg') client=$( echo ${element[i*$NUMCOL]} | sed -ne 's/\./_/pg')
echo "${server}_${client}_r".value "${element[$i*$NUMCOL+2]}" echo "${server}_${client}_r".value "${element[$i*$NUMCOL+2]}"