Projet

Général

Profil

Paste
Télécharger au format
Statistiques
| Branche: | Révision:

root / plugins / emc / emc_vnx_file_stats @ a8e1084b

Historique | Voir | Annoter | Télécharger (17,3 ko)

1
#!/bin/bash
2

    
3
: <<=cut
4

    
5
=head1 NAME 
6

    
7
 emc_vnx_file_stats - Plugin to monitor Basic, NFSv3 and NFSv4 statistics of EMC VNX 5300 Unified Storage system's Datamovers
8

    
9
=head1 AUTHOR
10

    
11
 Evgeny Beysembaev <megabotva@gmail.com>
12

    
13
=head1 LICENSE
14

    
15
 GPLv2
16

    
17
=head1 MAGIC MARKERS
18

    
19
  #%# family=auto
20
  #%# capabilities=autoconf
21

    
22
=head1 DESCRIPTION
23

    
24
 The plugin monitors basic statistics of EMC Unified Storage system Datamovers and NFS statistics of EMC VNX5300 Unified 
25
 Storage system. Probably it can also be compatible with other Isilon or Celerra systems. It uses SSH to connect to Control 
26
 Stations, then remotely executes '/nas/sbin/server_stats' and fetches and parses data from it. It supports gathering 
27
 data both from active/active and active/passive Datamover configurations, ignoring offline or standby Datamovers. 
28
 If all Datamovers are offline or absent, the plugin returns error.
29
 This plugin also automatically chooses Primary Control Station from the list by calling '/nasmcd/sbin/getreason' and 
30
 '/nasmcd/sbin/t2slot'.
31
 
32
 At the moment data is gathered from the following statistics sources:
33
  * nfs.v3.op - Tons of timings about NFSv3 RPC calls
34
  * nfs.v4.op - Tons of timings about NFSv4 RPC calls
35
  * nfs.client - Here new Client addresses are rescanned and added automatically.
36
  * basic-std Statistics Group - Basic Statistics of Datamovers (eg. CPU, Memory etc.)
37
 
38
 It's quite easy to comment out unneeded data to make graphs less overloaded or to add new statistics sources.
39

    
40
=head1 COMPATIBILITY
41

    
42
 The plugin has been written for being compatible with EMC VNX5300 Storage system, as this is the only EMC storage which 
43
 i have.
44
 By the way, i am pretty sure it can also work with other VNX1 storages, like VNX5100 and VNX5500.
45
 About VNX2 series, i don't know whether the plugin will be able to work with them. Maybe it would need some corrections
46
 in command-line backend. The same situation is with other EMC systems, so i encourage you to try and fix the plugin. 
47

    
48
=head1 CONFIGURATION
49

    
50
 The plugin uses SSH to connect to Control Stations. It's possible to use 'nasadmin' user, but it would be better
51
 if you create read-only global user by Unisphere Client. The user should have only Operator role.
52
 I created "operator" user but due to the fact that Control Stations already had one internal "operator" user,
53
 the new one was called "operator1". So be careful.
54
 
55
 On munin-node side choose a user which will be used to connect through SSH. Generally user "munin" is ok. Then,
56
 execute "sudo su munin -s /bin/bash", "ssh-keygen" and "ssh-copy-id" to both Control Stations with newly created 
57
 user.
58
 
59
 Make a link from /usr/share/munin/plugins/emc_vnx_file_stats to /etc/munin/plugins/.
60
 If you want to get NFS statistics, name the link as "emc_vnx_file_nfs_stats_<NAME>", otherwise to get Basic Datamover
61
 statistics you have to name it "emc_vnx_file_basicdm_stats_<NAME>", where <NAME> is any arbitrary name of your 
62
 storage system. The plugin will return <NAME> in its answer as "host_name" field.
63

    
64
 For example, assume your storage system is called "VNX5300".
65
 Make a configuration file at /etc/munin/plugin-conf.d/emc_vnx_file_stats_VNX5300
66
 
67
 [emc_vnx_file_*]
68
 user munin							# SSH Client local user
69
 env.username operator1						# Remote user with Operator role
70
 env.cs_addr 192.168.1.1 192.168.1.2				# Control Stations addresses
71
 env.nas_servers server_2 server_3				# This is the default value and can be omitteda
72

    
73
=head1 HISTORY
74

    
75
 08.11.2016 - First Release
76
 17.11.2016 - NFSv4 support, Memory section
77
 16.12.2016 - Merged "NFS" and "Datamover Stats" plugins
78
 26.12.2016 - Compatibility with Munin coding style
79

    
80
=cut
81

    
82
export LANG=C
83

    
84
STATSTYPE=$(echo "${0##*/}" | cut -d _ -f 1-5)
85
if [ $STATSTYPE = "emc_vnx_file_nfs_stats" ]; then STATSTYPE=NFS; 
86
elif [ $STATSTYPE = "emc_vnx_file_basicdm_stats" ]; then STATSTYPE=BASICDM;
87
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
88
# echo $STATSTYPE
89

    
90
TARGET=$(echo "${0##*/}" | cut -d _ -f 6)
91
: ${nas_servers:="server_2 server_3"}
92
SSH_CHECK='ssh -q $username@$CS "/nasmcd/sbin/getreason | grep -w slot_\`/nasmcd/sbin/t2slot\` | cut -d- -f1"'
93

    
94
if [ "$1" = "autoconf" ]; then
95
	echo "yes"
96
	exit 0
97
fi
98

    
99
if [ -z "$username" ]; then
100
	echo "No username!"
101
	exit 1
102
fi
103

    
104
if [ -z "$cs_addr" ]; then
105
	echo "No control station addresses!"
106
	exit 1
107
fi
108

    
109
#Choosing Cotrol Station. Code have to be "10"
110
for CS in $cs_addr; do
111
	if [[ "10" -eq "$(eval $SSH_CHECK)" ]]; then
112
#		echo "$CS is Primary"
113
		PRIMARY_CS=$CS
114
		break
115
	fi
116
done
117

    
118
if [ -z "$PRIMARY_CS" ]; then
119
	echo "No alive primary Control Station from list \"$cs_addr\"";
120
	exit 1;
121
fi
122

    
123
SSH="ssh -q $username@$PRIMARY_CS . /home/operator1/.bash_profile; "
124

    
125
echo "host_name ${TARGET}"
126

    
127
if [ "$1" = "config" ] ; then
128
	for server in $nas_servers; do
129
		$SSH nas_server -i $server | grep -q 'type *= nas'
130
		if [ "$?" != 0 ]  ; then continue; fi
131
		nas_server_ok=TRUE
132
		
133
		if [ $STATSTYPE = "BASICDM" ] ; then
134
			echo "multigraph emc_vnx_cpu_percent
135
graph_title EMC VNX 5300 Datamover CPU Util %
136
graph_vlabel %
137
graph_category cpu
138
graph_scale no
139
graph_args --upper-limit 100 -l 0
140
${server}_cpuutil.min 0
141
${server}_cpuutil.label $server CPU util. in %."
142

    
143
                echo -e "\nmultigraph emc_vnx_network_kib
144
graph_title EMC VNX 5300 Datamover Network bytes over all interfaces
145
graph_vlabel B/s recv. (-) / sent (+)
146
graph_category network
147
graph_args --base 1000
148
${server}_net_in.graph no
149
${server}_net_in.label none
150
${server}_net_in.cdef ${server}_net_in,1000,*
151
${server}_net_out.label $server B/s
152
${server}_net_out.cdef ${server}_net_out,1000,*
153
${server}_net_out.negative ${server}_net_in
154
${server}_net_out.draw AREA"
155

    
156
                echo -e "\nmultigraph emc_vnx_storage_kib
157
graph_title EMC VNX 5300 Datamover Storage bytes over all interfaces
158
graph_vlabel B/s recv. (-) / sent (+)
159
graph_category network
160
graph_args --base 1000
161
${server}_stor_read.graph no
162
${server}_stor_read.label none
163
${server}_stor_read.cdef ${server}_stor_read,1000,*
164
${server}_stor_write.label $server B/s
165
${server}_stor_write.cdef ${server}_stor_write,1000,*
166
${server}_stor_write.negative ${server}_stor_read
167
${server}_stor_write.draw AREA"
168

    
169
                echo -e "\nmultigraph emc_vnx_memory
170
graph_title EMC VNX 5300 Datamover Memory
171
graph_vlabel MiB
172
graph_category memory
173
graph_args --base 1024
174
graph_order ${server}_used ${server}_free ${server}_total ${server}_freebuffer ${server}_encumbered
175
${server}_used.label ${server} Used
176
${server}_used.cdef ${server}_used,1024,/
177
${server}_free.label ${server} Free
178
${server}_free.draw STACK
179
${server}_free.cdef ${server}_free,1024,/
180
${server}_total.label ${server} Total
181
${server}_total.cdef ${server}_total,1024,/
182
${server}_freebuffer.label ${server} Free Buffer
183
${server}_freebuffer.cdef ${server}_freebuffer,1024,/
184
${server}_encumbered.label ${server} Encumbered
185
${server}_encumbered.cdef ${server}_encumbered,1024,/"
186
			
187
echo -e "\nmultigraph emc_vnx_filecache
188
graph_title EMC VNX 5300 File Buffer Cache
189
graph_vlabel per second
190
graph_category memory
191
graph_args --base 1000
192
graph_order ${server}_highw_hits ${server}_loww_hits ${server}_w_hits ${server}_hits ${server}_lookups
193
${server}_highw_hits.label High Watermark Hits
194
${server}_loww_hits.label Low Watermark Hits
195
${server}_loww_hits.draw STACK
196
${server}_w_hits.label Watermark Hits
197
${server}_hits.label Hits
198
${server}_lookups.label Lookups"
199
        
200
                echo -e "\nmultigraph emc_vnx_fileresolve
201
graph_title EMC VNX 5300 FileResolve
202
graph_vlabel Entries
203
graph_category memory
204
graph_args --base 1000
205
${server}_dropped.label Dropped Entries
206
${server}_max.label Max Limit
207
${server}_used.label Used Entries"
208
		fi
209
		if [ $STATSTYPE = "NFS" ] ; then
210
#nfs.v3.op data
211
		member_elements=$($SSH server_stats $server -info nfs.v3.op | grep member_elements | sed -ne 's/^.*= //p')
212
		IFS=',' read -ra graphs <<< $member_elements
213
		echo "multigraph vnx_emc_v3_calls_s
214
graph_title EMC VNX 5300 NFSv3 Calls per second
215
graph_vlabel Calls
216
graph_category nfs
217
graph_args --base 1000"
218
		for graph in "${graphs[@]}"; do
219
        	        field=$(echo "$graph" | cut -d '.' -f4 )
220
			echo "${server}_$field.label $server $field"
221
        	done
222

    
223
		echo -e "\nmultigraph vnx_emc_v3_usec_call
224
graph_title EMC VNX 5300 NFSv3 uSeconds per call
225
graph_vlabel uSec / call
226
graph_category nfs
227
graph_args --base 1000"
228
		for graph in "${graphs[@]}"; do
229
                	field=$(echo "$graph" | cut -d '.' -f4 )
230
			echo "${server}_$field.label $server $field"
231
        	done
232
		echo -e "\nmultigraph vnx_emc_v3_op_percent
233
graph_title EMC VNX 5300 NFSv3 Op %
234
graph_vlabel %
235
graph_scale no
236
graph_category nfs"
237
		for graph in "${graphs[@]}"; do
238
                	field=$(echo "$graph" | cut -d '.' -f4 )
239
			echo "${server}_$field.label $server $field"
240
			echo "${server}_$field.min 0"
241
        	done
242
		graphs=()
243
#nfs.v4.op data
244
		member_elements=$($SSH server_stats $server -info nfs.v4.op | grep member_elements | sed -ne 's/^.*= //p')
245
		IFS=',' read -ra graphs <<< $member_elements
246
		echo "multigraph vnx_emc_v4_calls_s
247
graph_title EMC VNX 5300 NFSv4 Calls per second
248
graph_vlabel Calls
249
graph_category nfs
250
graph_args --base 1000"
251
		for graph in "${graphs[@]}"; do
252
        	        field=$(echo "$graph" | cut -d '.' -f4 )
253
			echo "${server}_$field.label $server $field"
254
        	done
255

    
256
		echo -e "\nmultigraph vnx_emc_v4_usec_call
257
graph_title EMC VNX 5300 NFSv4 uSeconds per call
258
graph_vlabel uSec / call
259
graph_category nfs
260
graph_args --base 1000"
261
		for graph in "${graphs[@]}"; do
262
                	field=$(echo "$graph" | cut -d '.' -f4 )
263
			echo "${server}_$field.label $server $field"
264
        	done
265
		echo -e "\nmultigraph vnx_emc_v4_op_percent
266
graph_title EMC VNX 5300 NFSv4 Op %
267
graph_vlabel %
268
graph_scale no
269
graph_category nfs"
270
		for graph in "${graphs[@]}"; do
271
                	field=$(echo "$graph" | cut -d '.' -f4 )
272
			echo "${server}_$field.label $server $field"
273
			echo "${server}_$field.min 0"
274
        	done
275

    
276
#nfs.client data
277
#							 Total    Read     Write   Suspicious   Total    Read     Write      Avg   
278
#                                                      Ops/s    Ops/s    Ops/s    Ops diff    KiB/s    KiB/s    KiB/s   uSec/call
279
		member_elements=$($SSH server_stats server_2 -monitor nfs.client -count 1 -terminationsummary no -titles never | sed -ne 's/^.*id=//p' | cut -d' ' -f1)
280
		readarray graphs2 <<< $member_elements
281
		echo -e "\nmultigraph vnx_emc_nfs_client_ops_s
282
graph_title EMC VNX 5300 NFS Client Ops/s
283
graph_vlabel Ops/s
284
graph_category nfs"
285
		echo -n "graph_order "
286
		for graph in "${graphs2[@]}"; do
287
                        field=$(echo "$graph" | sed -ne 's/\./_/pg' )
288
			echo -n "${server}_${field}_r ${server}_${field}_w ${server}_${field}_t ${server}_${field}_s "
289
		done
290
		echo " "
291
		for graph in "${graphs2[@]}"; do
292
                        field=$(echo "$graph" | sed -ne 's/\./_/pg' )
293
                        echo "${server}_${field}_r.label $server $field Read Ops/s"
294
                        echo "${server}_${field}_w.label $server $field Write Ops/s"
295
                        echo "${server}_${field}_w.draw STACK"
296
                        echo "${server}_${field}_t.label $server $field Total Ops/s"
297
			echo "${server}_${field}_s.label $server $field Suspicious Ops diff"
298
                done
299

    
300
		echo -e "\nmultigraph vnx_emc_nfs_client_kib_s
301
graph_title EMC VNX 5300 NFS Client B/s
302
graph_vlabel B/s
303
graph_category nfs"
304
		echo -n "graph_order "
305
		for graph in "${graphs2[@]}"; do
306
                        field=$(echo "$graph" | sed -ne 's/\./_/pg' )
307
			echo -n "${server}_${field}_r ${server}_${field}_w ${server}_${field}_t "
308
		done
309
		echo " "
310
		for graph in "${graphs2[@]}"; do
311
                        field=$(echo "$graph" | sed -ne 's/\./_/pg' )
312
                        echo "${server}_${field}_r.label $server $field Read B/s"
313
                        echo "${server}_${field}_r.cdef ${server}_${field}_r,1024,*"
314
                        echo "${server}_${field}_w.label $server $field Write B/s"
315
                        echo "${server}_${field}_w.cdef ${server}_${field}_w,1024,*"
316
                        echo "${server}_${field}_w.draw STACK"
317
                        echo "${server}_${field}_t.label $server $field Total B/s"
318
                        echo "${server}_${field}_t.cdef ${server}_${field}_t,1024,*"
319
                done
320

    
321
		echo -e "\nmultigraph vnx_emc_nfs_client_avg_usec
322
graph_title EMC VNX 5300 NFS Client Avg uSec/call
323
graph_vlabel uSec/call
324
graph_category nfs"
325
		for graph in "${graphs2[@]}"; do
326
                        field=$(echo "$graph" | sed -ne 's/\./_/pg' )
327
                        echo "${server}_${field}.label $server $field Avg uSec/call"
328
                done
329
		fi
330
	done
331
	if [ -z $nas_server_ok ]; then
332
		echo "No active data movers!"
333
		exit 1
334
	fi
335
exit 0
336
fi
337

    
338
for server in $nas_servers; do
339
	$SSH nas_server -i $server | grep -q 'type *= nas'
340
	if [ "$?" != 0 ]  ; then continue; fi
341
	nas_server_ok=TRUE
342
	if [ $STATSTYPE = "BASICDM" ] ; then
343
member_elements=$($SSH server_stats $server -count 1 -terminationsummary no -titles never | grep '^[^[:space:]]')
344
#       NUMCOL=5
345
        IFS=$' ' read -ra graphs <<< $member_elements
346

    
347
        echo "multigraph emc_vnx_cpu_percent"
348
        echo "${server}_cpuutil.value ${graphs[1]}"
349

    
350
        echo -e "\nmultigraph emc_vnx_network_kib"
351
        echo "${server}_net_in.value ${graphs[2]}"
352
        echo "${server}_net_out.value ${graphs[3]}"
353

    
354
        echo -e "\nmultigraph emc_vnx_storage_kib"
355
        echo "${server}_stor_read.value ${graphs[4]}"
356
        echo "${server}_stor_write.value ${graphs[5]}"
357

    
358
        member_elements=$($SSH server_stats $server -monitor kernel.memory -count 1 -terminationsummary no -titles never | grep '^[^[:space:]]')
359
        IFS=$' ' read -ra graphs <<< $member_elements
360

    
361
        echo -e "\nmultigraph emc_vnx_memory"
362
        echo "${server}_total.value ${graphs[14]}"
363
        echo "${server}_used.value ${graphs[15]}"
364
        echo "${server}_free.value ${graphs[12]}"
365
        echo "${server}_freebuffer.value ${graphs[1]}"
366
        echo "${server}_encumbered.value ${graphs[8]}"
367

    
368
        echo -e "\nmultigraph emc_vnx_filecache"
369
        echo "${server}_highw_hits.value ${graphs[2]}"
370
        echo "${server}_loww_hits.value ${graphs[6]}"
371
        echo "${server}_w_hits.value ${graphs[7]}"
372
        echo "${server}_hits.value ${graphs[4]}"
373
	echo "${server}_lookups.value ${graphs[5]}"
374
        
375
        echo -e "\nmultigraph emc_vnx_fileresolve"
376
        echo "${server}_dropped.value ${graphs[9]}"
377
        echo "${server}_max.value ${graphs[10]}"
378
        echo "${server}_used.value ${graphs[11]}"
379

    
380

    
381
	fi
382
	if [ $STATSTYPE = "NFS" ] ; then
383
#nfs.v3.op data
384
	member_elements=$($SSH server_stats $server -monitor nfs.v3.op -count 1 -terminationsummary no -titles never | sed -ne 's/^.*v3/v3/p')
385
	NUMCOL=5
386
	LINES=$(wc -l <<< $member_elements)
387
	while IFS=$'\n' read -ra graphs ; do
388
		element+=( $graphs )
389
	done <<< $member_elements
390

    
391
	echo "multigraph vnx_emc_v3_calls_s"
392
	for ((i=0; i<$((LINES)); i++ )); do
393
		echo "${server}_${element[i*$NUMCOL]}".value "${element[i*$NUMCOL+1]}"
394
	done
395

    
396
	echo -e "\nmultigraph vnx_emc_v3_usec_call"
397
	for ((i=0; i<$((LINES)); i++ )); do
398
		echo "${server}_${element[i*$NUMCOL]}".value "${element[i*$NUMCOL+3]}"
399
	done
400

    
401
	echo -e "\nmultigraph vnx_emc_v3_op_percent"
402
	for ((i=0; i<$((LINES)); i++ )); do
403
		echo "${server}_${element[i*$NUMCOL]}".value "${element[i*$NUMCOL+4]}"
404
	done
405

    
406
	element=()
407

    
408
#nfs.v4.op data
409
	member_elements=$($SSH server_stats $server -monitor nfs.v4.op -count 1 -terminationsummary no -titles never | sed -ne 's/^.*v4/v4/p')
410
	NUMCOL=5
411
	LINES=$(wc -l <<< $member_elements)
412
	while IFS=$'\n' read -ra graphs ; do
413
		element+=( $graphs )
414
	done <<< $member_elements
415

    
416
	echo -e "\nmultigraph vnx_emc_v4_calls_s"
417
	for ((i=0; i<$((LINES)); i++ )); do
418
		echo "${server}_${element[i*$NUMCOL]}".value "${element[i*$NUMCOL+1]}"
419
	done
420

    
421
	echo -e "\nmultigraph vnx_emc_v4_usec_call"
422
	for ((i=0; i<$((LINES)); i++ )); do
423
		echo "${server}_${element[i*$NUMCOL]}".value "${element[i*$NUMCOL+3]}"
424
	done
425

    
426
	echo -e "\nmultigraph vnx_emc_v4_op_percent"
427
	for ((i=0; i<$((LINES)); i++ )); do
428
		echo "${server}_${element[i*$NUMCOL]}".value "${element[i*$NUMCOL+4]}"
429
	done
430

    
431
	element=()
432

    
433
#nfs.client data
434
	echo -e "\nmultigraph vnx_emc_nfs_client_ops_s"
435
        member_elements=$($SSH server_stats server_2 -monitor nfs.client -count 1 -terminationsummary no -titles never | sed -ne 's/^.*id=//p')
436
	NUMCOL=9
437
        LINES=$(wc -l <<< $member_elements)
438
	while IFS=$'\n' read -ra graphs; do
439
		element+=($graphs)
440
	done  <<< $member_elements
441
	for (( i=0; i<$((LINES)); i++ )); do
442
		client=$( echo ${element[i*$NUMCOL]} | sed -ne 's/\./_/pg')
443
               echo "${server}_${client}_r".value "${element[$i*$NUMCOL+2]}"
444
               echo "${server}_${client}_w".value "${element[$i*$NUMCOL+3]}"
445
               echo "${server}_${client}_t".value "${element[$i*$NUMCOL+1]}"
446
               echo "${server}_${client}_s".value "${element[$i*$NUMCOL+4]}"
447
        done
448
	echo -e "\nmultigraph vnx_emc_nfs_client_kib_s"
449
	for (( i=0; i<$((LINES)); i++ )); do
450
		client=$( echo ${element[i*$NUMCOL]} | sed -ne 's/\./_/pg')
451
               echo "${server}_${client}_r".value "${element[$i*$NUMCOL+6]}"
452
               echo "${server}_${client}_w".value "${element[$i*$NUMCOL+7]}"
453
               echo "${server}_${client}_t".value "${element[$i*$NUMCOL+5]}"
454
        done
455
	echo -e "\nmultigraph vnx_emc_nfs_client_avg_usec"
456
	for (( i=0; i<$((LINES)); i++ )); do
457
		client=$( echo ${element[i*$NUMCOL]} | sed -ne 's/\./_/pg')
458
		echo "${server}_${client}".value "${element[$i*$NUMCOL+8]}"
459
	done
460
	fi
461
done
462
if [ -z $nas_server_ok ]; then
463
	echo "No active data movers!"
464
	exit 1
465
fi
466
exit 0
467