1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
|
#! /bin/sh
# PCP QA Test No. 1049 (formerly 552)
# make sure that installed pmie rule files are syntactically OK.
#
# Copyright (c) 2015 Red Hat.
# Copyright (c) 1995-2002 Silicon Graphics, Inc. All Rights Reserved.
#
seq=`basename $0`
echo "QA output created by $seq"
# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check
which pmieconf >/dev/null 2>&1 || _notrun "No pmieconf binary installed"
status=1 # failure is the default!
username=`id -u -n`
trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
# Some metrics unavailable by default, so skip the associated rules
#
echo "modify all enabled yes" >$tmp.cmd
for group in shping cisco dmthin mssql openvswitch
do
# most have group == dir, but some do not
#
case $group
in
dmthin)
dir=dm
;;
*)
dir=$group
;;
esac
[ -d $PCP_ETC_DIR/pcp/pmieconf/$dir ] && echo "modify $group enabled no" >>$tmp.cmd
done
# Some rules need special cusomization
#
disks=`pmprobe -I disk.dev.total | sed -e 's/" "/ /g' -e 's/^[^ ]* [0-9][0-9]* //'`
if [ -z "$disks" ]
then
# Arrgh ...
#
echo "Empty list of disks from ..."
pmprobe -I disk.dev.total
exit
fi
echo "modify per_disk.bandwidth disks $disks" >>$tmp.cmd
echo "modify per_disk.iops disks $disks" >>$tmp.cmd
# real QA test starts here
echo "running pmieconf with default rules..."
( cat $tmp.cmd; echo quit ) | pmieconf -f $tmp.eek
echo "status=$?"
echo "running pmie..."
pmieargs="-C"
id pcp >/dev/null 2>&1 && pmieargs="$pmieargs -U $username"
pmie $pmieargs -c $tmp.eek -l $tmp.pmielog
echo "status=$?"
echo "pmie log file..."
cat $tmp.pmielog | _filter_pmie_log
echo "--- pmieconf input ---" >$seq_full
cat $tmp.cmd >>$seq_full
echo "--- pmie input ---" >>$seq_full
cat $tmp.eek >>$seq_full
echo "--- pmie output ---" >>$seq_full
cat $tmp.pmielog >>$seq_full
# success, all done
status=0
exit
|