cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

What is the best way to execute a shell script on mulitple unix hosts and return results to appmon

clayton_swiggs
Participant

We are in the process of migrating host monitoring of our Unix hosts from
Nagios into Dynatrace. I have been investigating one particular migration issue
where we are trying to find a way to execute the below shell script across more
than 100 aix hosts and have the results returned to Dynatrace so we can perform
alerting.

I installed the Generic Execution Plugin from the community but we are
unable to access these aix hosts via direct ssh during to security policies. Do
you have any suggestions about how else we can do this, either via the local
access method of the GE plugin or possibly by executing a cron on the remote
hosts to run the script and then somehow send/retrieve the results in Dynatrace?
Thanks,

AIX mpath shell script:

#!usrbinksh

#set -x

#

# $Id check_mpath.sh 145 2012-09-16 125628Z
u09422fra $

#

# AIX multipath check plugin for Nagios

#

# Paths

EGREP=usrbinegrep

LSPATH=usrsbinlspath

TR=usrbintr

WC=usrbinwc

# Nagios return codes and strings

R_OK=0;S_OK=OK

R_WARNING=1;S_WARNING=WARNING

R_CRITICAL=2; S_CRITICAL=CRITICAL

R_UNKNOWN=3;S_UNKNOWN=UNKNOWN

S_ALL=

# Variables

PATHS_TOTAL=0

PATHS_ENABLED=0

PATHS_NOT_ENABLED=0

# Check for lspath executeable

if [ -e ${LSPATH} -a -x ${LSPATH} ]; then

PATHS_TOTAL=`${LSPATH}${EGREP}
-vi ses${WC} -l${TR} -d ' '`

PATHS_NOT_ENABLED=`${LSPATH}${EGREP} -vi ses${EGREP} -vi
enabled${WC} -l${TR} -d ' '`

if [
${PATHS_TOTAL} !=-a ${PATHS_NOT_ENABLED}
!=]; then

PATHS_ENABLED=$((PATHS_TOTAL-PATHS_NOT_ENABLED))

S_ALL=Paths total(${PATHS_TOTAL})enabled(${PATHS_ENABLED})not
enabled(${PATHS_NOT_ENABLED})

else

echo
MPATH ${S_UNKNOWN} - Unknown value ${PATHS_TOTAL}, ${PATHS_NOT_ENABLED}

exit
${R_UNKNOWN}

fi

if [
${PATHS_NOT_ENABLED} -gt $((PATHS_TOTAL2)) ]; then

echo
MPATH ${S_CRITICAL} - ${S_ALL}

exit
${R_CRITICAL}

elif [
${PATHS_NOT_ENABLED} -gt 0 ]; then

echo
MPATH ${S_WARNING} - ${S_ALL}

exit
${R_WARNING}

else

echo
MPATH ${S_OK} - ${S_ALL}

exit
${R_OK}

fi

else

echo
MPATH ${S_UNKNOWN} - lspath not found or not executeable.

exit
${R_UNKNOWN}

fi

exit 0

#

## EOF

2 REPLIES 2

sooryaprabha_mo
Inactive

Hi,

Just try to execute the GEP as a monitors and run manually to check AIX server is reachable from dynatrace.

Usually GEP runs in dynatrace Collector, so from communication between dynatrace collector and all AIX servers should be present.

Also dynatrace collector should run on the account which has rights to access Remote connection to AIX servers. In case if you are executing Scripts which is placed in some destination(this path must have access to the account(dynatrace collector runs)).

Please walk through below link, hope it will be helpful

https://answers.dynatrace.com/questions/90387/exec...

Thanks

Soorya Mohan

Joe_Hoffman
Dynatrace Champion
Dynatrace Champion

Clayton,

The Generic Execution Plugin is open source, so you're free to modify/augment it as necessary to communicate to your AIX hosts in whatever manner and protocol your infrastructure permits.

An alternate idea: Run your chron job idea to generate the required data, push that data to a file system that's accessible to a Dynatrace Monitor. Then write a Dynatrace Monitor to read that file system (using local mount, HTTP, FTP, whatever) and populate the measures that trigger the incidents. Use the Generic Execution Plugin source as a reference and I think you'll find writing plugins is quite easy.