3 # Exercise dbpmda use with the Perl implementation of nfsclient
5 # Copyright (c) 2013 Red Hat.
9 echo "QA output created by $seq"
11 # get standard filters
16 [ -d $PCP_PMDAS_DIR/nfsclient
] || _notrun
"nfsclient PMDA directory is not installed"
19 perl
-e "use PCP::PMDA" >/dev
/null
2>&1
20 [ $?
-eq 0 ] || _notrun
"perl PCP::PMDA module not installed"
24 $sudo rm -f $here/nfsclient.log
28 trap "_cleanup; exit \$status" 0 1 2 3 15
33 -e "s;$PCP_PMDAS_DIR;\$PCP_PMDAS_DIR;" \
34 -e "s;$script;pmdanfsclient.pl;" \
41 -e 's/^\(Log for pmda[^ ]* on\) .*/\1 HOST .../' \
42 -e 's/^\(Log finished\) .*/\1 .../' \
49 # for indom 62.0 the order of the instances (and hence internal
50 # instance number depends on the version of perl and the phase
53 # [ 0] inst: 0 name: "/mnt/nfsv4"
54 # [ 1] inst: 1 name: "/mnt/nfs41"
55 # [ 2] inst: 2 name: "/ifs"
56 # [ 3] inst: 3 name: "/ifsfoo"
59 rm -f $tmp.1 $tmp.2 $tmp.3
62 part == 2 && $1 == "dbpmda>" { part = 3 }
63 { outname = "'$tmp'." part; print >outname }
64 part == 1 && $1 == "pmInDom:" && $2 == "62.0" { part = 2 }'
66 [ -f $tmp.1 ] && cat $tmp.1
67 [ -f $tmp.2 ] && LC_COLLATE
=posix
sort --key 6 $tmp.2 \
69 NR == 1 { printf "[ X] inst: X name: %s\n",$6 }
70 NR > 1 { printf "[X+%d] inst: X+%d name: %s\n", NR-1, NR-1, $6 }'
71 [ -f $tmp.3 ] && cat $tmp.3
74 # real QA test starts here
76 script=pmdanfsclient.pl
77 cd "$PCP_PMDAS_DIR/nfsclient"
79 # create a root namespace file for dbpmda to use
80 PCP_PERL_PMNS
=root
/usr
/bin
/env perl
$script > $tmp.root
82 # create a set of commands for dbpmda
83 cat >$tmp.cmds
<<End-of-File
84 open pipe /usr/bin/env perl $script
87 desc nfsclient.mountpoint
88 desc nfsclient.options.string
89 desc nfsclient.options.proto
90 desc nfsclient.options.vers
91 fetch nfsclient.export
92 fetch nfsclient.mountpoint
93 fetch nfsclient.options.string
94 fetch nfsclient.options.proto
95 fetch nfsclient.options.vers
96 fetch nfsclient.options.vers
100 # iterate over our pre-canned mountstats files
101 test="$here/nfsclient"
102 for file in $test/*.qa
104 export NFSCLIENT_MOUNTSTATS_PATH
="$file"
105 echo === Test
case: `basename $file`
106 $sudo rm -f nfsclient.log
107 $sudo TERM
=ansi sh
-c ". /etc/pcp.env; dbpmda -n $tmp.root -ie" < $tmp.cmds
2>&1 | _filter | _filter_indom
108 _filter_pmda_log
< nfsclient.log