Zabbix Custom NetApp Statistics Gather Scripts

Aggregate Stats

#!/bin/bash
#
# script expects to be supplied the following values:
# $1 = cluster name
#

cluster=$1

ssh monitor@$cluster statistics aggregate show -iterations 1 -interval 10 |  sed -n '/aggr/,$p' | tr -s '[:space:]' ',' | sed -r 's/(.)('aggr')/\1\n\2/g' > '/tmp/'$cluster'_aggr_stats.txt'

 

Flexgroup & Infinite Volume Stats:

#!/bin/bash
#
# script expects to be supplied the following values:
# $1 = cluster name
# $2 = Flexgroup SVM name
# $3 = Flexgroup name
#
# This script will work on flexgroups and ivols, the formatting
# of the statistics command handles the wrapping of lines
# caused by long constituent names and large numbers in
# various metric columns.
#
# the latency code at the bottom had to check whether the
# column figure is a number or not because it can sometimes
# be a "-"
count=0
total=0
cluster=$1
svm=$2
fg=$3
ssh monitor@$cluster statistics volume show -interval 10 -max 40 -iterations 1 -vserver $svm | sed -n '/'$fg'/,$p' | grep -v "_vol0" | tr -s '[:space:]' ',' | sed -r 's/(.)('$fg')/\1\n\2/g' | grep -v ^, | awk -F, '{print $3" "$4" "$5" "$6" "$7" "$8" "$9}' > '/tmp/'$cluster'_'$fg'_stats.txt'

awk -F" " '{print $2}' '/tmp/'$cluster'_'$fg'_stats.txt' | paste -sd+ - | bc > '/tmp/'$cluster'_'$fg'_read_ops.txt'
awk -F" " '{print $3}' '/tmp/'$cluster'_'$fg'_stats.txt' | paste -sd+ - | bc > '/tmp/'$cluster'_'$fg'_write_ops.txt'
awk -F" " '{print $4}' '/tmp/'$cluster'_'$fg'_stats.txt' | paste -sd+ - | bc > '/tmp/'$cluster'_'$fg'_other_ops.txt'
awk -F" " '{print $5}' '/tmp/'$cluster'_'$fg'_stats.txt' | paste -sd+ - | bc > '/tmp/'$cluster'_'$fg'_read_bps.txt'
awk -F" " '{print $6}' '/tmp/'$cluster'_'$fg'_stats.txt' | paste -sd+ - | bc > '/tmp/'$cluster'_'$fg'_write_bps.txt'
for i in $( awk -F" " '{print $7}' '/tmp/'$cluster'_'$fg'_stats.txt' )
    do
        if [[ $i == ?(+|-)+([0-9]) ]]
        then
            total=$(echo $total+$i | bc ); ((count++));
        else
            continue
        fi
    done
echo "scale=4; ($total / $count) / 1000" | bc > '/tmp/'$cluster'_'$fg'_latency.txt'

 

Leave a Reply

Your email address will not be published. Required fields are marked *