#! /bin/sh
#
# Copyright (c) 1997 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 summary PMDA and/or PMNS
#

. $PCP_DIR/etc/pcp.env
. $PCP_SHARE_DIR/lib/pmdaproc.sh

iam=summary

pmdaSetup

if [ ! -x $PCP_BIN_DIR/pmie ]
then
    echo \
'Error: The "summary" PMDA requires the pmie(1) application but this
   does not appear to be installed.'
    status=1
    exit
fi

while true
do
    $PCP_ECHO_PROG $PCP_ECHO_N "Interval between summary expression evaluation (seconds)? [10] ""$PCP_ECHO_C"
    read delta
    [ -z "$delta" ] && delta=10
    [ -z "`echo $delta | tr -d '[0-9]'`" ] && break
    echo "Error: interval \"$delta\" must be an integer, please try again"
done
# Use localhost (inet socket) by default now as local: may pass pmdasummary
# user account ($PCP_USER) credentials, which may not always be appropriate
#
args="$PCP_BIN_DIR/pmie -h localhost -x -t $delta $PCP_PMDAS_DIR/summary/expr.pmie"
check_delay=15

pmdaInstall
exit
