root / plugins / emc / emc_vnx_nfsv3_stats @ 6506690a
Historique | Voir | Annoter | Télécharger (9,87 ko)
| 1 | 6506690a | Diver | #!/bin/bash |
|---|---|---|---|
| 2 | ###################################################################################################################### |
||
| 3 | # Plugin to monitor NFS statistics of EMC VNX 5300 Unified Storage system # |
||
| 4 | ###################################################################################################################### |
||
| 5 | |||
| 6 | # Author: Evgeny Beysembaev <megabotva@gmail.com> |
||
| 7 | |||
| 8 | ##################################### |
||
| 9 | # Description # |
||
| 10 | ##################################### |
||
| 11 | |||
| 12 | # The plugin monitors NFS v3 statistics of EMC Unified Storage system. Probably it can also be compatible with |
||
| 13 | # other Isilon or Celerra systems. It uses SSH to connect to Control Stations, then remotely executes |
||
| 14 | # /nas/sbin/server_stats and fetches and parses data from it. It supports gathering data both from active/active |
||
| 15 | # and active/passive Datamover configurations, ignoring offline or standby Datamovers. If all Datamovers are |
||
| 16 | # offline or absent, the plugin returns error. |
||
| 17 | # This plugin also automatically chooses Primary Control Station from the list by calling /nasmcd/sbin/getreason and |
||
| 18 | # /nasmcd/sbin/t2slot. |
||
| 19 | # |
||
| 20 | # At the moment data is gathered from the following statistics sources: |
||
| 21 | # nfs.v3.op - Tons of timings about NFS RPC calls |
||
| 22 | # nfs.client - Here new Client addresses are rescanned and added automatically. |
||
| 23 | # |
||
| 24 | # It's quite easy to comment out unneeded data to make graphs less overloaded or to add new statistics sources. |
||
| 25 | |||
| 26 | ##################################### |
||
| 27 | # Configuration # |
||
| 28 | ##################################### |
||
| 29 | |||
| 30 | # The plugin uses SSH to connect to Control Stations. It's possible to use 'nasadmin' user, but it would be better |
||
| 31 | # if you create read-only global user by Unisphere Client. The user should have only Operator role. |
||
| 32 | # I created "operator" user but due to the fact that Control Stations already had one internal "operator" user, |
||
| 33 | # the new one was called "operator1". So be careful. |
||
| 34 | # |
||
| 35 | # On munin-node side choose a user which will be used to connect through SSH. Generally user "munin" is ok. Then, |
||
| 36 | # execute "sudo su munin -s /bin/bash", "ssh-keygen" and "ssh-copy-id" to both Control Stations with newly created |
||
| 37 | # user. |
||
| 38 | # |
||
| 39 | # Make a link from /usr/share/munin/plugins/emc_vnx_nfsv3_stats to /etc/munin/plugins/emc_vnx_nfsv3_stats_<NAME>, |
||
| 40 | # where <NAME> is any arbitrary name of your storage system. The plugin will return <NAME> in its answer |
||
| 41 | # as "host_name" field. |
||
| 42 | # Assume your storage system is called "VNX5300". |
||
| 43 | # |
||
| 44 | # Make a configuration file at /etc/munin/plugin-conf.d/emc_vnx_nfsv3_stats_VNX5300 |
||
| 45 | # |
||
| 46 | # [emc_vnx_nfsv3_stats_vnx5300] |
||
| 47 | # user munin # SSH Client local user |
||
| 48 | # env.username operator1 # Remote user with Operator role |
||
| 49 | # env.cs_addr 192.168.1.1 192.168.1.2 # Control Stations addresses |
||
| 50 | # env.nas_servers server_2 server_3 # This is the default value and can be omitted |
||
| 51 | |||
| 52 | ##################################### |
||
| 53 | # History # |
||
| 54 | ##################################### |
||
| 55 | |||
| 56 | # 08.11.2016 - First Release |
||
| 57 | |||
| 58 | ###################################################################################################################### |
||
| 59 | |||
| 60 | export LANG=C |
||
| 61 | |||
| 62 | TARGET=$(echo "${0##*/}" | cut -d _ -f 5)
|
||
| 63 | : ${nas_servers:="server_2 server_3"}
|
||
| 64 | SSH_CHECK='ssh -q $username@$CS "/nasmcd/sbin/getreason | grep -w slot_\`/nasmcd/sbin/t2slot\` | cut -d- -f1"' |
||
| 65 | |||
| 66 | if [ "$1" = "autoconf" ]; then |
||
| 67 | echo "yes" |
||
| 68 | exit 0 |
||
| 69 | fi |
||
| 70 | |||
| 71 | if [ -z "$username" ]; then |
||
| 72 | echo "No username!" |
||
| 73 | exit 1 |
||
| 74 | fi |
||
| 75 | |||
| 76 | if [ -z "$cs_addr" ]; then |
||
| 77 | echo "No control station addresses!" |
||
| 78 | exit 1 |
||
| 79 | fi |
||
| 80 | |||
| 81 | #Choosing Cotrol Station. Code have to be "10" |
||
| 82 | for CS in $cs_addr; do |
||
| 83 | if [ "`eval $SSH_CHECK`" -eq "10" ]; then |
||
| 84 | # echo "$CS is Primary" |
||
| 85 | PRIMARY_CS=$CS |
||
| 86 | break |
||
| 87 | fi |
||
| 88 | done |
||
| 89 | |||
| 90 | if [ -z "$PRIMARY_CS" ]; then |
||
| 91 | echo "No alive primary Control Station from list \"$cs_addr\""; |
||
| 92 | exit 1; |
||
| 93 | fi |
||
| 94 | |||
| 95 | SSH="ssh -q $username@$PRIMARY_CS . /home/operator1/.bash_profile; " |
||
| 96 | |||
| 97 | echo "host_name ${TARGET}"
|
||
| 98 | |||
| 99 | if [ "$1" = "config" ] ; then |
||
| 100 | for server in $nas_servers; do |
||
| 101 | $SSH nas_server -i $server | grep -q 'type *= nas' |
||
| 102 | if [ "$?" != 0 ] ; then continue; fi |
||
| 103 | nas_server_ok=TRUE |
||
| 104 | #nfs.v3.op data |
||
| 105 | member_elements=`$SSH server_stats $server -info nfs.v3.op | grep member_elements | sed -ne 's/^.*= //p'` |
||
| 106 | IFS=',' read -ra graphs <<< $member_elements |
||
| 107 | echo "multigraph vnx_emc_calls_s |
||
| 108 | graph_title EMC VNX 5300 NFS V3 Calls per second |
||
| 109 | graph_vlabel Calls |
||
| 110 | graph_category nfs |
||
| 111 | graph_args --base 1000" |
||
| 112 | for graph in "${graphs[@]}"; do
|
||
| 113 | field=`echo "$graph" | cut -d '.' -f4 ` |
||
| 114 | echo "${server}_$field.label $server $field"
|
||
| 115 | done |
||
| 116 | |||
| 117 | echo " |
||
| 118 | multigraph vnx_emc_usec_call |
||
| 119 | graph_title EMC VNX 5300 NFS V3 uSeconds per call |
||
| 120 | graph_vlabel uSec / call |
||
| 121 | graph_category nfs |
||
| 122 | graph_args --base 1000" |
||
| 123 | for graph in "${graphs[@]}"; do
|
||
| 124 | field=`echo "$graph" | cut -d '.' -f4 ` |
||
| 125 | echo "${server}_$field.label $server $field"
|
||
| 126 | done |
||
| 127 | echo " |
||
| 128 | multigraph vnx_emc_op_percent |
||
| 129 | graph_title EMC VNX 5300 NFS V3 Op % |
||
| 130 | graph_vlabel % |
||
| 131 | graph_category nfs" |
||
| 132 | for graph in "${graphs[@]}"; do
|
||
| 133 | field=`echo "$graph" | cut -d '.' -f4 ` |
||
| 134 | echo "${server}_$field.label $server $field"
|
||
| 135 | echo "${server}_$field.min 0"
|
||
| 136 | done |
||
| 137 | |||
| 138 | |||
| 139 | #nfs.client data |
||
| 140 | # Total Read Write Suspicious Total Read Write Avg |
||
| 141 | # Ops/s Ops/s Ops/s Ops diff KiB/s KiB/s KiB/s uSec/call |
||
| 142 | member_elements=`$SSH server_stats server_2 -monitor nfs.client -count 1 -terminationsummary no -titles never | sed -ne 's/^.*id=//p' | cut -d' ' -f1` |
||
| 143 | readarray graphs2 <<< $member_elements |
||
| 144 | echo " |
||
| 145 | multigraph vnx_emc_nfs_client_ops_s |
||
| 146 | graph_title EMC VNX 5300 NFS Client Ops/s |
||
| 147 | graph_vlabel Ops/s |
||
| 148 | graph_category nfs" |
||
| 149 | echo -n "graph_order " |
||
| 150 | for graph in "${graphs2[@]}"; do
|
||
| 151 | field=`echo "$graph" | sed -ne 's/\./_/pg' ` |
||
| 152 | echo -n "${server}_${field}_r ${server}_${field}_w ${server}_${field}_t ${server}_${field}_s "
|
||
| 153 | done |
||
| 154 | echo " " |
||
| 155 | for graph in "${graphs2[@]}"; do
|
||
| 156 | field=`echo "$graph" | sed -ne 's/\./_/pg' ` |
||
| 157 | echo "${server}_${field}_r.label $server $field Read Ops/s"
|
||
| 158 | echo "${server}_${field}_w.label $server $field Write Ops/s"
|
||
| 159 | echo "${server}_${field}_w.draw STACK"
|
||
| 160 | echo "${server}_${field}_t.label $server $field Total Ops/s"
|
||
| 161 | echo "${server}_${field}_s.label $server $field Suspicious Ops diff"
|
||
| 162 | done |
||
| 163 | |||
| 164 | echo " |
||
| 165 | multigraph vnx_emc_nfs_client_kib_s |
||
| 166 | graph_title EMC VNX 5300 NFS Client KiB/s |
||
| 167 | graph_vlabel KiB/s |
||
| 168 | graph_category nfs" |
||
| 169 | echo -n "graph_order " |
||
| 170 | for graph in "${graphs2[@]}"; do
|
||
| 171 | field=`echo "$graph" | sed -ne 's/\./_/pg' ` |
||
| 172 | echo -n "${server}_${field}_r ${server}_${field}_w ${server}_${field}_t "
|
||
| 173 | done |
||
| 174 | echo " " |
||
| 175 | for graph in "${graphs2[@]}"; do
|
||
| 176 | field=`echo "$graph" | sed -ne 's/\./_/pg' ` |
||
| 177 | echo "${server}_${field}_r.label $server $field Read KiB/s"
|
||
| 178 | echo "${server}_${field}_w.label $server $field Write KiB/s"
|
||
| 179 | echo "${server}_${field}_w.draw STACK"
|
||
| 180 | echo "${server}_${field}_t.label $server $field Total KiB/s"
|
||
| 181 | done |
||
| 182 | |||
| 183 | echo " |
||
| 184 | multigraph vnx_emc_nfs_client_avg_usec |
||
| 185 | graph_title EMC VNX 5300 NFS Client Avg uSec/call |
||
| 186 | graph_vlabel uSec/call |
||
| 187 | graph_category nfs" |
||
| 188 | for graph in "${graphs2[@]}"; do
|
||
| 189 | field=`echo "$graph" | sed -ne 's/\./_/pg' ` |
||
| 190 | echo "${server}_${field}.label $server $field Avg uSec/call"
|
||
| 191 | done |
||
| 192 | done |
||
| 193 | if [ -z $nas_server_ok ]; then |
||
| 194 | echo "No active data movers!" |
||
| 195 | exit 1 |
||
| 196 | fi |
||
| 197 | exit 0 |
||
| 198 | fi |
||
| 199 | |||
| 200 | #nfs.v3.op data |
||
| 201 | for server in $nas_servers; do |
||
| 202 | $SSH nas_server -i $server | grep -q 'type *= nas' |
||
| 203 | if [ "$?" != 0 ] ; then continue; fi |
||
| 204 | nas_server_ok=TRUE |
||
| 205 | member_elements=`$SSH server_stats $server -monitor nfs.v3.op -count 1 -terminationsummary no -titles never | sed -ne 's/^.*v3/v3/p'` |
||
| 206 | NUMCOL=5 |
||
| 207 | LINES=`wc -l <<< $member_elements` |
||
| 208 | while IFS=$'\n' read -ra graphs ; do |
||
| 209 | element+=( $graphs ) |
||
| 210 | done <<< $member_elements |
||
| 211 | |||
| 212 | echo "multigraph vnx_emc_calls_s" |
||
| 213 | for ((i=0; i<$((LINES)); i++ )); do |
||
| 214 | echo "${server}_${element[i*$NUMCOL]}".value "${element[i*$NUMCOL+1]}"
|
||
| 215 | done |
||
| 216 | |||
| 217 | echo " |
||
| 218 | multigraph vnx_emc_usec_call" |
||
| 219 | for ((i=0; i<$((LINES)); i++ )); do |
||
| 220 | echo "${server}_${element[i*$NUMCOL]}".value "${element[i*$NUMCOL+3]}"
|
||
| 221 | done |
||
| 222 | |||
| 223 | echo " |
||
| 224 | multigraph vnx_emc_op_percent" |
||
| 225 | for ((i=0; i<$((LINES)); i++ )); do |
||
| 226 | echo "${server}_${element[i*$NUMCOL]}".value "${element[i*$NUMCOL+4]}"
|
||
| 227 | done |
||
| 228 | |||
| 229 | element=() |
||
| 230 | #nfs.client data |
||
| 231 | echo " |
||
| 232 | multigraph vnx_emc_nfs_client_ops_s" |
||
| 233 | member_elements=`$SSH server_stats server_2 -monitor nfs.client -count 1 -terminationsummary no -titles never | sed -ne 's/^.*id=//p'` |
||
| 234 | NUMCOL=9 |
||
| 235 | LINES=`wc -l <<< $member_elements` |
||
| 236 | while IFS=$'\n' read -ra graphs; do |
||
| 237 | element+=($graphs) |
||
| 238 | done <<< $member_elements |
||
| 239 | for (( i=0; i<$((LINES)); i++ )); do |
||
| 240 | client=` echo ${element[i*$NUMCOL]} | sed -ne 's/\./_/pg'`
|
||
| 241 | echo "${server}_${client}_r".value "${element[$i*$NUMCOL+2]}"
|
||
| 242 | echo "${server}_${client}_w".value "${element[$i*$NUMCOL+3]}"
|
||
| 243 | echo "${server}_${client}_t".value "${element[$i*$NUMCOL+1]}"
|
||
| 244 | echo "${server}_${client}_s".value "${element[$i*$NUMCOL+4]}"
|
||
| 245 | done |
||
| 246 | echo " |
||
| 247 | multigraph vnx_emc_nfs_client_kib_s" |
||
| 248 | for (( i=0; i<$((LINES)); i++ )); do |
||
| 249 | client=` echo ${element[i*$NUMCOL]} | sed -ne 's/\./_/pg'`
|
||
| 250 | echo "${server}_${client}_r".value "${element[$i*$NUMCOL+6]}"
|
||
| 251 | echo "${server}_${client}_w".value "${element[$i*$NUMCOL+7]}"
|
||
| 252 | echo "${server}_${client}_t".value "${element[$i*$NUMCOL+5]}"
|
||
| 253 | done |
||
| 254 | echo " |
||
| 255 | multigraph vnx_emc_nfs_client_avg_usec" |
||
| 256 | for (( i=0; i<$((LINES)); i++ )); do |
||
| 257 | client=` echo ${element[i*$NUMCOL]} | sed -ne 's/\./_/pg'`
|
||
| 258 | echo "${server}_${client}".value "${element[$i*$NUMCOL+8]}"
|
||
| 259 | done |
||
| 260 | done |
||
| 261 | if [ -z $nas_server_ok ]; then |
||
| 262 | echo "No active data movers!" |
||
| 263 | exit 1 |
||
| 264 | fi |
||
| 265 | exit 0 |
