Projet

Général

Profil

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

root / plugins / emc / emc_vnx_file_ @ a337fbbb

Historique | Voir | Annoter | Télécharger (23,5 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 
8
 EMC VNX 5300 Unified Storage system's Datamovers
9

    
10
=head1 AUTHOR
11

    
12
 Evgeny Beysembaev <megabotva@gmail.com>
13

    
14
=head1 LICENSE
15

    
16
 GPLv2
17

    
18
=head1 MAGIC MARKERS
19

    
20
  #%# family=auto
21
  #%# capabilities=autoconf suggest
22

    
23
=head1 DESCRIPTION
24

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

    
46
 The plugin has been tested in the following Operating Environment (OE):
47
  File Version T7.1.76.4
48
  Block Revision 05.32.000.5.215
49

    
50
=head1 LIST OF GRAPHS
51

    
52
 These are Basic Datamover Graphs.
53
 Graph category CPU:
54
	EMC VNX 5300 Datamover CPU Util %
55
 Graph category Network:
56
	EMC VNX 5300 Datamover Network bytes over all interfaces
57
	EMC VNX 5300 Datamover Storage bytes over all interfaces
58
 Graph category Memory:
59
	EMC VNX 5300 Datamover Memory
60
	EMC VNX 5300 File Buffer Cache
61
	EMC VNX 5300 FileResolve
62

    
63
 These are NFS (v3,v4) Graphs.
64
 Graph category NFS:
65
	EMC VNX 5300 NFSv3 Calls per second
66
	EMC VNX 5300 NFSv3 uSeconds per call
67
	EMC VNX 5300 NFSv3 Op %
68
	EMC VNX 5300 NFSv4 Calls per second
69
	EMC VNX 5300 NFSv4 uSeconds per call
70
	EMC VNX 5300 NFSv4 Op %
71
	EMC VNX 5300 NFS Client Ops/s
72
	EMC VNX 5300 NFS Client B/s
73
	EMC VNX 5300 NFS Client Avg uSec/call
74

    
75
=head1 COMPATIBILITY
76

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

    
86
=head1 CONFIGURATION
87

    
88
 The plugin uses SSH to connect to Control Stations. It's possible to use 
89
 'nasadmin' user, but it would be better if you create read-only global user by
90
 Unisphere Client. The user should have only Operator role.
91
 I created "operator" user but due to the fact that Control Stations already
92
 had one internal "operator" user, the new one was called "operator1". So be 
93
 careful. After that, copy .bash_profile from /home/nasadmin to a newly created
94
 /home/operator1
95
 
96
 On munin-node side choose a user which will be used to connect through SSH.
97
 Generally user "munin" is ok. Then, execute "sudo su munin -s /bin/bash", 
98
 "ssh-keygen" and "ssh-copy-id" to both Control Stations with newly created 
99
 user.
100
 
101
 Make a link from /usr/share/munin/plugins/emc_vnx_file_stats to 
102
 /etc/munin/plugins/. If you want to get NFS statistics, name the link as 
103
 "emc_vnx_file_nfs_stats_<NAME>", otherwise to get Basic Datamover statistics
104
 you have to name it "emc_vnx_file_basicdm_stats_<NAME>", where <NAME> is any
105
 arbitrary name of your storage system. The plugin will return <NAME> in its 
106
 answer as "host_name" field.
107

    
108
 For example, assume your storage system is called "VNX5300".
109
 Make a configuration file at 
110
 /etc/munin/plugin-conf.d/emc_vnx_file_stats_VNX5300
111
 
112
 [emc_vnx_file_*]
113
 user munin				
114
 env.username operator1				
115
 env.cs_addr 192.168.1.1 192.168.1.2		
116
 env.nas_servers server_2 server_3		
117

    
118
 Where: 
119
 user - SSH Client local user
120
 env.username - Remote user with Operator role
121
 env.cs_addr - Control Stations addresses
122
 env.nas_servers - This is the default value and can be omitted
123

    
124
=head1 HISTORY
125

    
126
 08.11.2016 - First Release
127
 17.11.2016 - NFSv4 support, Memory section
128
 16.12.2016 - Merged "NFS" and "Datamover Stats" plugins
129
 26.12.2016 - Compatibility with Munin coding style
130

    
131
=cut
132

    
133
export LANG=C
134

    
135
. "$MUNIN_LIBDIR/plugins/plugin.sh"
136

    
137
ssh_check_cmd() {
138
	ssh -q $username@$1 "/nasmcd/sbin/getreason | grep -w slot_\`/nasmcd/sbin/t2slot\` | cut -d- -f1"
139
}
140

    
141
check_conf () {
142
	if [ -z "$username" ]; then
143
		echo "No username ('username' environment variable)!"
144
		return 1
145
	fi
146

    
147
	if [ -z "$cs_addr" ]; then
148
		echo "No control station addresses ('cs_addr' environment variable)!"
149
		return 1
150
	fi
151

    
152
	#Choosing Cotrol Station. Code have to be "10"
153
	for CS in $cs_addr; do
154
		if [[ "10" -eq "$(ssh_check_cmd $CS)" ]]; then
155
			PRIMARY_CS=$CS
156
			break
157
		fi
158
	done
159

    
160
	if [ -z "$PRIMARY_CS" ]; then
161
		echo "No alive primary Control Station from list \"$cs_addr\"";
162
		return 1
163
	fi
164
	return 0
165
}
166

    
167
if [ "$1" = "autoconf" ]; then
168
	check_conf_ans=$(check_conf)
169
	if [ $? -eq 0 ]; then
170
		echo "yes"
171
	else
172
		echo "no ($check_conf_ans)"
173
	fi
174
	exit 0
175
fi
176

    
177
if [ "$1" = "suggest" ]; then
178
	echo "nfs_stats"
179
	echo "basicdm_stats"
180
	exit 0;
181
fi
182

    
183
STATSTYPE=$(echo "${0##*/}" | cut -d _ -f 1-5)
184
if [ "$STATSTYPE" = "emc_vnx_file_nfs_stats" ]; then STATSTYPE=NFS; 
185
elif [ "$STATSTYPE" = "emc_vnx_file_basicdm_stats" ]; then STATSTYPE=BASICDM;
186
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
187
# echo $STATSTYPE
188

    
189
TARGET=$(echo "${0##*/}" | cut -d _ -f 6)
190
: ${nas_servers:="server_2 server_3"}
191

    
192
check_conf 1>&2 || exit 1
193

    
194
run_remote () {
195
	ssh -q "$username@$PRIMARY_CS" ". /home/""$username""/.bash_profile; $*"
196
}
197

    
198
echo "host_name ${TARGET}"
199

    
200
if [ "$1" = "config" ] ; then
201
	for server in $nas_servers; do
202
		run_remote nas_server -i $server | grep -q 'type *= nas'
203
		if [ "$?" != 0 ]  ; then continue; fi
204
		nas_server_ok=TRUE
205
		
206
		if [ $STATSTYPE = "BASICDM" ] ; then
207
			cat <<-EOF 
208
			multigraph emc_vnx_cpu_percent
209
			graph_title EMC VNX 5300 Datamover CPU Util %
210
			graph_vlabel %
211
			graph_category cpu
212
			graph_scale no
213
			graph_args --upper-limit 100 -l 0
214
			${server}_cpuutil.min 0
215
			${server}_cpuutil.label $server CPU util. in %.
216

    
217
			multigraph emc_vnx_network_b
218
			graph_title EMC VNX 5300 Datamover Network bytes over all interfaces
219
			graph_vlabel B/s recv. (-) / sent (+)
220
			graph_category network
221
			graph_args --base 1000
222
			${server}_net_in.graph no
223
			${server}_net_in.label none
224
			${server}_net_out.label $server B/s
225
			${server}_net_out.negative ${server}_net_in
226
			${server}_net_out.draw AREA
227

    
228
			multigraph emc_vnx_storage_b
229
			graph_title EMC VNX 5300 Datamover Storage bytes over all interfaces
230
			graph_vlabel B/s recv. (-) / sent (+)
231
			graph_category network
232
			graph_args --base 1000
233
			${server}_stor_read.graph no
234
			${server}_stor_read.label none
235
			${server}_stor_write.label $server B/s
236
			${server}_stor_write.negative ${server}_stor_read
237
			${server}_stor_write.draw AREA
238

    
239
			multigraph emc_vnx_memory
240
			graph_title EMC VNX 5300 Datamover Memory
241
			graph_vlabel KiB
242
			graph_category memory
243
			graph_args --base 1024
244
			graph_order ${server}_used ${server}_free ${server}_total ${server}_freebuffer ${server}_encumbered
245
			${server}_used.label ${server} Used
246
			${server}_free.label ${server} Free
247
			${server}_free.draw STACK
248
			${server}_total.label ${server} Total
249
			${server}_freebuffer.label ${server} Free Buffer
250
			${server}_encumbered.label ${server} Encumbered
251
						
252
			multigraph emc_vnx_filecache
253
			graph_title EMC VNX 5300 File Buffer Cache
254
			graph_vlabel per second
255
			graph_category memory
256
			graph_args --base 1000
257
			graph_order ${server}_highw_hits ${server}_loww_hits ${server}_w_hits ${server}_hits ${server}_lookups
258
			${server}_highw_hits.label High Watermark Hits
259
			${server}_loww_hits.label Low Watermark Hits
260
			${server}_loww_hits.draw STACK
261
			${server}_w_hits.label Watermark Hits
262
			${server}_hits.label Hits
263
			${server}_lookups.label Lookups
264
				
265
			multigraph emc_vnx_fileresolve
266
			graph_title EMC VNX 5300 FileResolve
267
			graph_vlabel Entries
268
			graph_category memory
269
			graph_args --base 1000
270
			${server}_dropped.label Dropped Entries
271
			${server}_max.label Max Limit
272
			${server}_used.label Used Entries
273
			EOF
274
		fi
275
		if [ $STATSTYPE = "NFS" ] ; then
276
#nfs.v3.op data
277
			member_elements_by_line=$(run_remote server_stats "$server" -info nfs.v3.op | grep member_elements | sed -ne 's/^.*= //p')
278
			IFS=',' read -ra graphs <<< "$member_elements_by_line"
279
			cat <<-EOF 
280
			run_remote server_stats "$server" -info nfs.v3.op
281
			echo "$member_elements_by_line"
282
			multigraph vnx_emc_v3_calls_s
283
			graph_title EMC VNX 5300 NFSv3 Calls per second
284
			graph_vlabel Calls
285
			graph_category nfs
286
			graph_args --base 1000
287
			EOF
288
			for graph in "${graphs[@]}"; do
289
				field=$(echo "$graph" | cut -d '.' -f4 )
290
				echo "${server}_$field.label $server $field"
291
			done
292

    
293
			cat <<-EOF
294
			
295
			multigraph vnx_emc_v3_usec_call
296
			graph_title EMC VNX 5300 NFSv3 uSeconds per call
297
			graph_vlabel uSec / call
298
			graph_category nfs
299
			graph_args --base 1000
300
			EOF
301
			for graph in "${graphs[@]}"; do
302
				field=$(echo "$graph" | cut -d '.' -f4 )
303
				echo "${server}_$field.label $server $field"
304
			done
305
			cat <<-EOF
306

    
307
			multigraph vnx_emc_v3_op_percent
308
			graph_title EMC VNX 5300 NFSv3 Op %
309
			graph_vlabel %
310
			graph_scale no
311
			graph_category nfs
312
			EOF
313
			for graph in "${graphs[@]}"; do
314
				field=$(echo "$graph" | cut -d '.' -f4 )
315
				echo "${server}_$field.label $server $field"
316
				echo "${server}_$field.min 0"
317
			done
318
			graphs=()
319
#nfs.v4.op data
320
			member_elements_by_line=$(run_remote server_stats "$server" -info nfs.v4.op | grep member_elements | sed -ne 's/^.*= //p')
321
			IFS=',' read -ra graphs <<< "$member_elements_by_line"
322
			cat <<-EOF
323
			multigraph vnx_emc_v4_calls_s
324
			graph_title EMC VNX 5300 NFSv4 Calls per second
325
			graph_vlabel Calls
326
			graph_category nfs
327
			graph_args --base 1000
328
			EOF
329
			for graph in "${graphs[@]}"; do
330
				field=$(echo "$graph" | cut -d '.' -f4 )
331
				echo "${server}_$field.label $server $field"
332
			done
333

    
334
			cat <<-EOF
335

    
336
			multigraph vnx_emc_v4_usec_call
337
			graph_title EMC VNX 5300 NFSv4 uSeconds per call
338
			graph_vlabel uSec / call
339
			graph_category nfs
340
			graph_args --base 1000
341
			EOF
342
			for graph in "${graphs[@]}"; do
343
				field=$(echo "$graph" | cut -d '.' -f4 )
344
				echo "${server}_$field.label $server $field"
345
			done
346
			cat <<-EOF
347
			
348
			multigraph vnx_emc_v4_op_percent
349
			graph_title EMC VNX 5300 NFSv4 Op %
350
			graph_vlabel %
351
			graph_scale no
352
			graph_category nfs
353
			EOF
354
			for graph in "${graphs[@]}"; do
355
				field=$(echo "$graph" | cut -d '.' -f4 )
356
				echo "${server}_$field.label $server $field"
357
				echo "${server}_$field.min 0"
358
			done
359

    
360
#nfs.client data
361
#							 Total    Read     Write   Suspicious   Total    Read     Write      Avg   
362
#                                                      Ops/s    Ops/s    Ops/s    Ops diff    KiB/s    KiB/s    KiB/s   uSec/call
363
			member_elements_by_line=$(run_remote server_stats server_2 -monitor nfs.client -count 1 -terminationsummary no -titles never | sed -ne 's/^.*id=//p' | cut -d' ' -f1)
364
			readarray graphs_array <<< "$member_elements_by_line"
365
			#removing array in case of empty set
366
			if [ "${graphs_array[0]}" == $'\n' ]; then graphs_array=(); fi
367
			cat <<-EOF
368

    
369
			multigraph vnx_emc_nfs_client_ops_s
370
			graph_title EMC VNX 5300 NFS Client Ops/s
371
			graph_vlabel Ops/s
372
			graph_category nfs
373
			EOF
374
			echo -n "graph_order "
375
			for graph in "${graphs_array[@]}"; do
376
				field="$(clean_fieldname "_$graph")"
377
				echo -n "${server}${field}_r ${server}${field}_w ${server}${field}_t ${server}${field}_s "
378
			done
379
			echo " "
380
			for graph in "${graphs_array[@]}"; do
381
				field="$(clean_fieldname "_$graph")"
382
				echo "${server}${field}_r.label $server $graph Read Ops/s"
383
				echo "${server}${field}_w.label $server $graph Write Ops/s"
384
				echo "${server}${field}_w.draw STACK"
385
				echo "${server}${field}_t.label $server $graph Total Ops/s"
386
				echo "${server}${field}_s.label $server $graph Suspicious Ops diff"
387
			done
388

    
389
			cat <<-EOF
390

    
391
			multigraph vnx_emc_nfs_client_b_s
392
			graph_title EMC VNX 5300 NFS Client B/s
393
			graph_vlabel B/s
394
			graph_category nfs
395
			EOF
396
			echo -n "graph_order "
397
			for graph in "${graphs_array[@]}"; do
398
				field="$(clean_fieldname "_$graph")"
399
				echo -n "${server}${field}_r ${server}${field}_w ${server}${field}_t "
400
			done
401
			echo " "
402
			for graph in "${graphs_array[@]}"; do
403
				echo "Graph is $graph"
404
				field="$(clean_fieldname "_$graph")"
405
				echo "${server}${field}_r.label $server $graph Read B/s"
406
				echo "${server}${field}_w.label $server $graph Write B/s"
407
				echo "${server}${field}_w.draw STACK"
408
				echo "${server}${field}_t.label $server $graph Total B/s"
409
			done
410

    
411
			cat <<-EOF
412

    
413
			multigraph vnx_emc_nfs_client_avg_usec
414
			graph_title EMC VNX 5300 NFS Client Avg uSec/call
415
			graph_vlabel uSec/call
416
			graph_category nfs
417
			EOF
418
			for graph in "${graphs_array[@]}"; do
419
				field="$(clean_fieldname "_$graph")"
420
				echo "${server}${field}.label $server $graph Avg uSec/call"
421
			done
422
		fi
423
	done
424
	if [ -z $nas_server_ok ]; then
425
		echo "No active data movers!" 1>&2
426
	fi
427
	exit 0
428
fi
429

    
430
for server in $nas_servers; do
431
	run_remote nas_server -i $server | grep -q 'type *= nas'
432
	if [ "$?" != 0 ]  ; then continue; fi
433
	nas_server_ok=TRUE
434
	if [ $STATSTYPE = "BASICDM" ] ; then
435
#basicdm data
436
# [nasadmin@mnemonic0 ~]$ server_stats server_2 -count 1 -terminationsummary no 
437
# server_2   CPU    Network     Network       dVol        dVol   
438
# Timestamp  Util      In         Out         Read       Write   
439
#             %      KiB/s       KiB/s       KiB/s       KiB/s   
440
# 20:42:26      9       16432        3404        1967       24889
441

    
442
	member_elements_by_line=$(run_remote server_stats "$server" -count 1 -terminationsummary no -titles never | grep '^[^[:space:]]')
443
	IFS=$' ' read -ra graphs <<< "$member_elements_by_line"
444

    
445
	echo "multigraph emc_vnx_cpu_percent"
446
	echo "${server}_cpuutil.value ${graphs[1]}"
447

    
448
	echo -e "\nmultigraph emc_vnx_network_b"
449
	echo "${server}_net_in.value $((${graphs[2]} * 1024))"
450
	echo "${server}_net_out.value $((${graphs[3]} * 1024))"
451

    
452
	echo -e "\nmultigraph emc_vnx_storage_b"
453
	echo "${server}_stor_read.value $((${graphs[4]} * 1024))"
454
	echo "${server}_stor_write.value $((${graphs[5]} * 1024))"
455

    
456
# [nasadmin@mnemonic0 ~]$ server_stats server_2 -monitor kernel.memory -count 1 -terminationsummary no 
457
# server_2       Free           Buffer       Buffer   Buffer    Buffer         Buffer       Buffer Cache  Encumbered  FileResolve  FileResolve  FileResolve  Free KiB   Page     Total    Used KiB     Memory  
458
# Timestamp     Buffer        Cache High     Cache    Cache      Cache       Cache Low       Watermark      Memory      Dropped        Max         Used                 Size    Memory                  Util   
459
#                KiB       Watermark Hits/s  Hit %    Hits/s   Lookups/s  Watermark Hits/s     Hits/s        KiB        Entries       Limit       Entries                KiB      KiB                    %     
460
# 20:44:14        3522944                 0      96     11562      12010                 0             0     3579268            0            0            0    3525848      8    6291456    2765608          44
461

    
462
	member_elements_by_line=$(run_remote server_stats "$server" -monitor kernel.memory -count 1 -terminationsummary no -titles never | grep '^[^[:space:]]')
463
	IFS=$' ' read -ra graphs <<< "$member_elements_by_line"
464

    
465
	echo -e "\nmultigraph emc_vnx_memory"
466
	#Reserved for math
467
	echo "${server}_total.value $((${graphs[14]} / 1))"	
468
	echo "${server}_used.value $((${graphs[15]} / 1))"
469
	echo "${server}_free.value $((${graphs[12]} / 1))"
470
	echo "${server}_freebuffer.value $((${graphs[1]} / 1))"
471
	echo "${server}_encumbered.value $((${graphs[8]} / 1))"
472

    
473
	echo -e "\nmultigraph emc_vnx_filecache"
474
	echo "${server}_highw_hits.value ${graphs[2]}"
475
	echo "${server}_loww_hits.value ${graphs[6]}"
476
	echo "${server}_w_hits.value ${graphs[7]}"
477
	echo "${server}_hits.value ${graphs[4]}"
478
	echo "${server}_lookups.value ${graphs[5]}"
479

    
480
	echo -e "\nmultigraph emc_vnx_fileresolve"
481
	echo "${server}_dropped.value ${graphs[9]}"
482
	echo "${server}_max.value ${graphs[10]}"
483
	echo "${server}_used.value ${graphs[11]}"
484

    
485

    
486
	fi
487
	if [ $STATSTYPE = "NFS" ] ; then
488
#nfs.v3.op data
489
# [nasadmin@mnemonic0 ~]$ server_stats server_2 -monitor nfs.v3.op -count 1 -terminationsummary no
490
# server_2       NFS Op          NFS      NFS Op     NFS       NFS Op % 
491
# Timestamp                       Op      Errors      Op                
492
#                              Calls/s     diff   uSec/Call             
493
# 22:14:41   v3GetAttr                30       0          23          21
494
#            v3Lookup                 40       0       98070          27
495
#            v3Access                 50       0          20          34
496
#            v3Read                    4       0       11180           3
497
#            v3Write                   2       0        2334           1
498
#            v3Create                  1       0        1743           1
499
#            v3Mkdir                  13       0         953           9
500
#            v3Link                    6       0        1064           4
501

    
502
	member_elements_by_line=$(run_remote server_stats "$server" -monitor nfs.v3.op -count 1 -terminationsummary no -titles never | sed -ne 's/^.*v3/v3/p')
503
	NUMCOL=5
504
	LINES=$(wc -l <<< "$member_elements_by_line")
505
	while IFS=$'\n' read -ra graphs ; do
506
		elements_array+=( $graphs )
507
	done <<< "$member_elements_by_line"
508
	
509
	if [ "${#elements_array[@]}" -eq "0" ]; then  LINES=0; fi
510

    
511
	echo "multigraph vnx_emc_v3_calls_s"
512
	for ((i=0; i<$((LINES)); i++ )); do
513
		echo "${server}_${elements_array[i*$NUMCOL]}".value "${elements_array[i*$NUMCOL+1]}"
514
	done
515

    
516
	echo -e "\nmultigraph vnx_emc_v3_usec_call"
517
	for ((i=0; i<$((LINES)); i++ )); do
518
		echo "${server}_${elements_array[i*$NUMCOL]}".value "${elements_array[i*$NUMCOL+3]}"
519
	done
520

    
521
	echo -e "\nmultigraph vnx_emc_v3_op_percent"
522
	for ((i=0; i<$((LINES)); i++ )); do
523
		echo "${server}_${elements_array[i*$NUMCOL]}".value "${elements_array[i*$NUMCOL+4]}"
524
	done
525

    
526
	elements_array=()
527

    
528
#nfs.v4.op data
529
# [nasadmin@mnemonic0 ~]$ server_stats server_2 -monitor nfs.v4.op -count 1 -terminationsummary no
530
# server_2       NFS Op          NFS      NFS Op     NFS       NFS Op % 
531
# Timestamp                       Op      Errors      Op                
532
#                              Calls/s     diff   uSec/Call             
533
# 22:13:14   v4Compound             2315       0        7913          30
534
#            v4Access                246       0           5           3
535
#            v4Close                 133       0          11           2
536
#            v4Commit                  2       0        6928           0
537
#            v4Create                  1       0         881           0
538
#            v4DelegRet               84       0          19           1
539
#            v4GetAttr              1330       0           7          17
540
#            v4GetFh                 164       0           3           2
541
#            v4Lookup                 68       0          43           1
542
#            v4Open                  132       0        1061           2
543
#            v4PutFh                2314       0          11          30
544
#            v4Read                  359       0       15561           5
545
#            v4ReadDir                 1       0          37           0
546
#            v4Remove                 62       0        1096           1
547
#            v4Rename                  1       0         947           0
548
#            v4Renew                   2       0           3           0
549
#            v4SaveFh                  1       0           3           0
550
#            v4SetAttr                 9       0         889           0
551
#            v4Write                 525       0       16508           7
552

    
553
	member_elements_by_line=$(run_remote server_stats "$server" -monitor nfs.v4.op -count 1 -terminationsummary no -titles never | sed -ne 's/^.*v4/v4/p')
554
	NUMCOL=5
555
	LINES=$(wc -l <<< "$member_elements_by_line")
556
	while IFS=$'\n' read -ra graphs ; do
557
		elements_array+=( $graphs )
558
	done <<< "$member_elements_by_line"
559

    
560
	if [ "${#elements_array[@]}" -eq "0" ]; then  LINES=0; fi
561

    
562
	echo -e "\nmultigraph vnx_emc_v4_calls_s"
563
	for ((i=0; i<$((LINES)); i++ )); do
564
		echo "${server}_${elements_array[i*$NUMCOL]}".value "${elements_array[i*$NUMCOL+1]}"
565
	done
566

    
567
	echo -e "\nmultigraph vnx_emc_v4_usec_call"
568
	for ((i=0; i<$((LINES)); i++ )); do
569
		echo "${server}_${elements_array[i*$NUMCOL]}".value "${elements_array[i*$NUMCOL+3]}"
570
	done
571

    
572
	echo -e "\nmultigraph vnx_emc_v4_op_percent"
573
	for ((i=0; i<$((LINES)); i++ )); do
574
		echo "${server}_${elements_array[i*$NUMCOL]}".value "${elements_array[i*$NUMCOL+4]}"
575
	done
576

    
577
	elements_array=()
578

    
579
#nfs.client data
580
# [nasadmin@mnemonic0 ~]$ server_stats server_2 -monitor nfs.client -count 1 -terminationsummary no 
581
# server_2                    Client                     NFS      NFS      NFS       NFS        NFS      NFS      NFS       NFS   
582
# Timestamp                                             Total    Read     Write   Suspicious   Total    Read     Write      Avg   
583
#                                                       Ops/s    Ops/s    Ops/s    Ops diff    KiB/s    KiB/s    KiB/s   uSec/call
584
# 20:26:38   id=192.168.1.223                           2550       20     2196          13     4673      159     4514       1964
585
#            id=192.168.1.2                              691        4        5           1     1113      425      688       2404
586
#            id=192.168.1.1                              159        0        0          51        0        0        0       6017
587
#            id=192.168.1.6                               37        4        2           0      586      295      291       5980
588
#            id=192.168.1.235                             21        1        0           0        0        0        0     155839
589
#            id=192.168.1.224                              5        0        5           0       20        0       20     704620
590

    
591
	echo -e "\nmultigraph vnx_emc_nfs_client_ops_s"
592
 	member_elements_by_line=$(run_remote server_stats server_2 -monitor nfs.client -count 1 -terminationsummary no -titles never | sed -ne 's/^.*id=//p')
593
	NUMCOL=9
594
	LINES=$(wc -l <<< "$member_elements_by_line")
595
	while IFS=$'\n' read -ra graphs; do
596
		elements_array+=($graphs)
597
	done  <<< "$member_elements_by_line"
598

    
599
	#Not drawing elements in case of empty set
600
	if [ "${#elements_array[@]}" -eq "0" ]; then  LINES=0; fi
601

    
602
	for (( i=0; i<$((LINES)); i++ )); do
603
		client="$(clean_fieldname "_${elements_array[i*$NUMCOL]}")"
604
		echo "${server}${client}_r".value "${elements_array[$i*$NUMCOL+2]}"
605
		echo "${server}${client}_w".value "${elements_array[$i*$NUMCOL+3]}"
606
		echo "${server}${client}_t".value "${elements_array[$i*$NUMCOL+1]}"
607
		echo "${server}${client}_s".value "${elements_array[$i*$NUMCOL+4]}"
608
        done
609
	echo -e "\nmultigraph vnx_emc_nfs_client_b_s"
610
	for (( i=0; i<$((LINES)); i++ )); do
611
		client="$(clean_fieldname "_${elements_array[i*$NUMCOL]}")"
612
		echo "${server}${client}_r".value "$((${elements_array[$i*$NUMCOL+6]} * 1024))"
613
		echo "${server}${client}_w".value "$((${elements_array[$i*$NUMCOL+7]} * 1024))"
614
		echo "${server}${client}_t".value "$((${elements_array[$i*$NUMCOL+5]} * 1024))"
615
        done
616
	echo -e "\nmultigraph vnx_emc_nfs_client_avg_usec"
617
	for (( i=0; i<$((LINES)); i++ )); do
618
		client="$(clean_fieldname "_${elements_array[i*$NUMCOL]}")"
619
		echo "${server}${client}".value "${elements_array[$i*$NUMCOL+8]}"
620
	done
621
	fi
622
done
623
if [ -z $nas_server_ok ]; then
624
	echo "No active data movers!" 1>&2
625
fi
626
exit 0
627