#! /bin/sh # # Copyright (c) 1997,2003 Silicon Graphics, Inc. All Rights Reserved. # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 2 of the License, or (at your # option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License # for more details. # # Install the Trace PMDA and/or PMNS # . $PCP_DIR/etc/pcp.env . $PCP_SHARE_DIR/lib/pmdaproc.sh iam=trace pmda_interface=2 forced_restart=false # Override interactive dialog from pmdaSetup in pmdaproc.sh # __choose_mode() { echo "Installing the \"$iam\" Performance Metrics Domain Agent (PMDA) ..." echo } numeric=0 getnumeric() { if [ "X$2" = "X" ] then numeric=0 elif [ "X`expr 0 + $2 2>/dev/null`" != "X$2" ] then echo "-- Sorry, $1 must be numeric (not $2) --" return 1 else numeric=$2 fi return 0 } getunits() { metric_name=$1 option_name=$2 # Default dimension and scale values # dimspace=0 dimtime=0 dimcount=0 scalespace=0 scaletime=0 scalecount=0 cat - </dev/null [ $? -ne 1 -a $numeric -ne 0 ] && args="-T $numeric" echo $PCP_ECHO_PROG $PCP_ECHO_N "Number of buckets [5]? ""$PCP_ECHO_C" read value getnumeric 'Number of buckets' $value >/dev/null [ $? -ne 1 -a $numeric -ne 0 ] && args="$args -N $numeric" echo $PCP_ECHO_PROG $PCP_ECHO_N "Port number for client connections [4323]? ""$PCP_ECHO_C" read value getnumeric 'Port number' $value >/dev/null [ $? -ne 1 -a $numeric -ne 0 ] && args="$args -I $numeric" getunits trace.observe.value -U getunits trace.counter.value -V while true do access="" echo $PCP_ECHO_PROG $PCP_ECHO_N "Client host access - (A)llow/(D)isallow [Enter to complete install]? ""$PCP_ECHO_C" read access access=`echo $access | tr -d ' '` [ "X$access" = "X" ] && break case $access in A|a|Allow|allow) echo $PCP_ECHO_PROG $PCP_ECHO_N "Host specification (IP mask/Enter to cancel): ""$PCP_ECHO_C" read access access=`echo $access | tr -d ' '` if [ "X$access" != "X" ] then maxconns="" echo $PCP_ECHO_PROG $PCP_ECHO_N "Maximum number of connections from $access (Enter for no limit): ""$PCP_ECHO_C" read maxconns maxconns=`echo $maxconns | tr -d ' '` [ "X$maxconns" = "X" ] && maxconns=0 args="$args"" -A ""allow:$access:$maxconns" fi;; D|d|Disallow|disallow) echo $PCP_ECHO_PROG $PCP_ECHO_N "Host specification (IP mask/Enter to cancel): ""$PCP_ECHO_C" read access access=`echo $access | tr -d ' '` [ "X$access" != "X" ] && args="$args"" -A ""disallow:$access";; *) echo 'Try again, "'$access'" not supported.';; esac done echo fi # for debugging the PMDA, uncomment this line ... # #args="-D appl0,appl1,pdu $args" # Do it ... # pmdaInstall echo Note: some warnings are expected until trace API calls are made - refer to echo " the man pages for pmtrace(1) and pmdatrace(3) for further details." exit 0