3 # Exercise bug in pmGetContextHostName with pmcd.hostname metric.
5 # Copyright (c) 2014 Red Hat.
9 echo "QA output created by $seq"
11 # get standard environment, filters and checks
16 status
=1 # failure is the default!
17 $sudo rm -rf $tmp.
* $seq.full
18 trap "cd $here; rm -rf $tmp.*; exit \$status" 0 1 2 3 15
20 # prefer an old host without pmcd.hostname, however the test is still
21 # useful even with more recent remotes (exercises different paths).
22 oldhost
=`./getpmcdhosts -L -n 1 -v 'pcp<3.8.4' 2>$seq.full`
23 [ -z "$oldhost" ] && oldhost
=`./getpmcdhosts -L -n 1`
24 [ -z "$oldhost" ] && _notrun
"No remote hosts available"
25 short_oldhost
=`echo $oldhost | sed -e 's/\..*//'`
26 # match pmstat(1) truncation
27 short_oldhost
=`printf "%-7.7s" "$short_oldhost" | sed -e 's/ *$//'`
29 # real QA test starts here
30 set -- `pmprobe -h localhost -v pmcd.hostname`
32 short_newhost
=`echo $newhost | sed -e 's/\..*//'`
33 # match pmstat(1) truncation
34 short_newhost
=`printf "%-7.7s" "$short_newhost" | sed -e 's/ *$//'`
36 echo "using oldhost $oldhost ($short_oldhost)" >> $seq.full
37 echo "using newhost $newhost ($short_newhost)" >> $seq.full
39 pmstat
-t 0.2 -s 2 -h localhost
-h $oldhost > $tmp.out
40 grep -q $short_newhost $tmp.out
&& echo "Correct local hostname in pmstat output"
41 grep -q $short_oldhost $tmp.out
&& echo "Correct remote hostname in pmstat output"
42 cat $tmp.out
>> $seq.full