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 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231
|
#!/bin/sh
# PCP QA Test No. 365
# Errors in pmcd.conf [acccess] that should not prevent pmcd starting
#
# Copyright (c) 1995-2002 Silicon Graphics, Inc. All Rights Reserved.
#
seq=`basename $0`
echo "QA output created by $seq"
# get standard filters
. ./common.product
. ./common.check
. ./common.filter
rm -f $seq.out
_get_libpcp_config
if $ipv6 ; then
ln $seq.out.ipv6 $seq.out || exit 1
else
ln $seq.out.nonipv6 $seq.out || exit 1
fi
_cleanup()
{
if $done_clean
then
:
else
if [ -f $tmp.pmcd.conf ]
then
$sudo cp $tmp.pmcd.conf $PCP_PMCDCONF_PATH
rm -f $tmp.pmcd.conf
fi
_service pmcd restart 2>&1 | _filter_pcp_restart
_wait_for_pmcd
_service pmlogger restart 2>&1 | _filter_pcp_restart
_wait_for_pmlogger
done_clean=true
fi
rm -f $tmp.*
}
status=1
done_clean=false
trap "_cleanup; exit \$status" 0 1 2 3 15
# don't need to regenerate config.default with pmlogconf
#
PMLOGGER_CHECK_SKIP_LOGCONF=yes; export PMLOGGER_CHECK_SKIP_LOGCONF
qahost=`hostname`
eval `./getpmcdhosts -L -n 2 2>$tmp.out | sed -e 's/^/other1=/' -e 's/ / other2=/'`
echo "other1=$other1" >$seq_full
echo "other2=$other2" >>$seq_full
echo "qahost=$qahost" >>$seq_full
[ -z "$other1" ] && _notrun "Cannot find first remote host running pmcd"
[ -z "$other2" ] && _notrun "Cannot find second remote host running pmcd"
# stop pmcd and pmlogger cleanly
#
if ! _service pmlogger stop 2>&1; then _exit 1; fi \
| _filter_pcp_stop
_wait_pmlogger_end || _exit 1
if ! _service pmcd stop 2>&1; then _exit 1; fi \
| _filter_pcp_stop
_wait_pmcd_end || _exit 1
# real QA test starts here
home=$PCP_PMDAS_DIR
# copy the pmcd config file to restore state later.
cp $PCP_PMCDCONF_PATH $tmp.pmcd.conf
if [ $PCP_PLATFORM = linux ]
then
cat <<End-of-File >$tmp.tmp
# Installed by PCP QA test $seq on `date`
#
linux 60 dso linux_init $PCP_PMDAS_DIR/linux/pmda_linux.so
pmcd 2 dso pmcd_init $PCP_PMDAS_DIR/pmcd/pmda_pmcd.so
End-of-File
elif [ $PCP_PLATFORM = darwin ]
then
cat <<End-of-File >$tmp.tmp
# Installed by PCP QA test $seq on `date`
#
darwin 78 dso darwin_init $PCP_PMDAS_DIR/darwin/pmda_darwin.dylib
pmcd 2 dso pmcd_init $PCP_PMDAS_DIR/pmcd/pmda_pmcd.dylib
End-of-File
elif [ $PCP_PLATFORM = solaris ]
then
cat <<End-of-File >$tmp.tmp
# Installed by PCP QA test $seq on `date`
#
solaris 75 dso solaris_init $PCP_PMDAS_DIR/solaris/pmda_solaris.so
pmcd 2 dso pmcd_init $PCP_PMDAS_DIR/pmcd/pmda_pmcd.so
End-of-File
elif [ $PCP_PLATFORM = freebsd ]
then
cat <<End-of-File >$tmp.tmp
# Installed by PCP QA test $seq on `date`
#
freebsd 85 dso freebsd_init $PCP_PMDAS_DIR/freebsd/pmda_freebsd.so
pmcd 2 dso pmcd_init $PCP_PMDAS_DIR/pmcd/pmda_pmcd.so
End-of-File
elif [ $PCP_PLATFORM = netbsd ]
then
cat <<End-of-File >$tmp.tmp
# Installed by PCP QA test $seq on `date`
#
netbsd 116 dso netbsd_init $PCP_PMDAS_DIR/netbsd/pmda_netbsd.so
pmcd 2 dso pmcd_init $PCP_PMDAS_DIR/pmcd/pmda_pmcd.so
End-of-File
elif [ $PCP_PLATFORM = openbsd ]
then
cat <<End-of-File >$tmp.tmp
# Installed by PCP QA test $seq on `date`
#
openbsd 139 dso openbsd_init $PCP_PMDAS_DIR/openbsd/pmda_openbsd.so
pmcd 2 dso pmcd_init $PCP_PMDAS_DIR/pmcd/pmda_pmcd.so
End-of-File
else
echo "Arrgh ... need pmcd.conf for $PCP_PLATFORM"
exit 1
fi
cat <<End-of-File >>$tmp.tmp
[access]
allow no.such.host.pcp.io : all;
allow nohost.engr.sgi.com, $qahost : all;
allow $other1, no.such.host.pcp.io, localhost : fetch;
allow localhost, $other2, nohost.melbourne.sgi.com : store;
allow "local:" , "unix:" : all;
End-of-File
echo >>$tmp.tmp
echo "# from qa/$seq" >>$tmp.tmp
$sudo cp $tmp.tmp $PCP_PMCDCONF_PATH
echo >>$seq_full
echo "=== pmcd.conf ===" >>$seq_full
cat $PCP_PMCDCONF_PATH >>$seq_full
echo "=== pmcd restarting ===" >>$seq_full
# Note: need to use $PCP_RC_DIR/* here, not _service pmcd or
# _service pmlogger so that systemd does not get a chance to have
# a look in and syphon off our (expected) error messages.
#
$sudo $PCP_RC_DIR/pmcd restart 2>>$seq_full | _filter_pcp_restart
$sudo $PCP_RC_DIR/pmlogger restart 2>>$seq_full | _filter_pcp_restart
_wait_for_pmcd || _exit 1
_wait_for_pmlogger || _exit 1
echo "=== pmcd restarted ===" >>$seq_full
cat $PCP_PMCDLOG_PATH >>$seq_full
echo >>$seq_full
echo "=== pmcd.log ===" >>$seq_full
_filter_pmcd_log <$PCP_PMCDLOG_PATH \
| sed \
-e '/^linux/{
s/ [12] dso/1-or-2 dso/
s/lib=\/usr\//lib=\/usr-or-var\//
s/lib=\/var\//lib=\/usr-or-var\//
}' \
-e 's/__pmGetAddrInfo/gethostbyname/g' \
-e 's/__pmGetHostByName/gethostbyname/g' \
-e '/gethostbyname(/s/ Unknown host/ No address associated with name/' \
-e '/gethostbyname(/s/ Unknown server error/ No address associated with name/' \
-e '/gethostbyname(/s/ Host name lookup failure/ No address associated with name/' \
-e '/gethostbyname(/s/ Resolver Error 0 (no error)/ No address associated with name/' \
-e '/gethostbyname(/s/ Resolver internal error/ No address associated with name/' \
-e "/$qahost\$/"'{
s/ [0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]* / LOCALIP /
s/ */ /g
}' \
-e "/$other1\$/"'{
s/ [0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]* / OTHERIP1 /
s/ */ /g
}' \
-e "/$other2\$/"'{
s/ [0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]* / OTHERIP2 /
s/ */ /g
}' \
-e "s/$qahost\$/LOCALHOST/g" \
-e "s/$other1\$/OTHERHOST1/g" \
-e "s/$other2\$/OTHERHOST2/g" \
-e '/UNIX_DOMAIN_SOCKET/d' \
-e '/ContactAgents: agent/d' \
-e '/1 unix:$/d' \
-e '/error sending Conn ACK PDU/d' \
-e "s/[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]/<hexnum>/" \
| $PCP_AWK_PROG '
$8 ~ /^[A-Z]+HOST[12]*$/ && $5 ~ /^[0-9a-f]/ {
sub(/^[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$/,"<ipaddr>",$5)
sub(/^[0-9a-f:][0-9a-f:]*%[0-9a-z]+$/,"<ipaddr>",$5)
sub(/^[0-9a-f:][0-9a-f:]*$/,"<ipaddr>",$5)
}
{ print }'
status=0
echo "check pmcd is up and we can get local access" >>$seq_full
if pmprobe hinv.ncpu >>$seq_full 2>&1
then
:
else
echo "pmcd check FAILED"
$PCP_PS_PROG $PCP_PS_ALL_FLAGS | grep -E '[P]PID|/[p]mcd( |$)'
status=1
fi
echo "check primary pmlogger is running" >>$seq_full
pmlc -P </dev/null 2>&1 \
| tee -a $seq_full \
| if grep 'Connected to primary pmlogger' >/dev/null
then
:
else
echo "primary pmlogger check FAILED"
# Note: no ( |$) for egrep, want to find pmlogger_* as well
$PCP_PS_PROG $PCP_PS_ALL_FLAGS | grep -E '[P]PID|/[p]mlogger'
status=1
fi
exit
|