#!/bin/bash

# Script to invoke runact API to gather AIX/PM files.  This script is intended for use
# by Service Agent and will invokeed multiple times to gather required PM files.
#
# runact format:
# runact -cxD " " IBM.ServiceEvent GetServiceInfo GetID="5" Args1="MT-MM_MS_LPARID" Args2="datatype"
#
# Usage:
#     saPmAix <parms>
#
#     <parms>
#         $1 machineType
#         $2 machineModel
#         $3 machineSerial
#         $4 lparID
#         $5 option
#       where option can be:
#                   -d        Disk usage stats      dustat.send
#                   -e        Environment stats     envstat.send
#                   -i        IO Stats stats        iostat.send
#                   -n        Network stats         netstat.send
#                   -s        CPU/Memory stats      stats.send
#
#
# Exit status = 0 if no errors occur; non-zero otherwise.
#
#
# Module History:
# 00 10/14/2004  M. Gregor     Initial release

actzTrace "ESA    T: -> saPmAix $*"

if (($# < 5)); then
   actzTrace 'ESA    F: Missing required argument(s).'
   exit 100
fi

/usr/bin/runact -cxD "::" IBM.ServiceEvent GetServiceInfo GetID="5" Args1='"'$1"-"$2"_"$3"_"$4'"' Args2='"'$5'"'
pmaixRC=$?

actzTrace 'ESA    T: <- saPmAix'

exit $pmaixRC
