Solaris Scripting with RMA Issues

All questions related to installations, configurations and maintenance of Advanced Host Monitor (including additional tools such as RMA for Windows, RMA Manager, Web Servie, RCC).
Post Reply
jhancock
Posts: 1
Joined: Mon May 24, 2004 2:31 pm

Solaris Scripting with RMA Issues

Post by jhancock »

I have created the following test script to run through RMA, but am getting an error when I try and insert any if...else, or two ifs in a script. I am runnning on Solaris 2.8 (Sparc)

Below is a test script:

--------------------Script----------------
#/bin/sh

PCOUNT=`vmstat|tail -1|awk '{print $5}'`

if [ $PCOUNT -lt $1 ]
then
echo ScriptRes:Ok:$PCOUNT
fi

--------------------------------------------

which gives the following result

-----------------Result--------------------
[4:49:44 PM] Agent: ITSPARKY is going to execute "Test Script" script ...
[4:49:45 PM] Script executed, correct result received:
----------
- Status: Ok
- Reply: 43968
----------
-------------------------------------------


Now, when I try this script:

----------------------Script----------------
#/bin/sh

PCOUNT=`vmstat|tail -1|awk '{print $5}'`

if [ $PCOUNT -lt $1 ]
then
echo ScriptRes:Ok:$PCOUNT
else
echo ScriptRes:Bad:$PCOUNT
fi
----------------------------------------------

it errors with the following:

---------------------Result------------------
[4:52:56 PM] Agent: ITSPARKY is going to execute "Test Script" script ...
[4:52:56 PM] Agent error: Cannot read data
----------------------------------------------

Nothing changes except the addition of the else clause. Also, all of the scripts that came with HA are failing with the same error through RMA but will run in a shell window on the box.

Any ideas?
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

We experienced similar problem when developed agent. Problem appeared because Windows uses \r\n to separate lines (HostMonitor is Windows application).
That's why RMA for UNIX replaces \r\n to \n in any script received from HostMointor. This behavior was implemented in first version of the agent, I wonder why you experience problem...
Nothing changes except the addition of the else clause. Also, all of the scripts that came with HA are failing with the same error through RMA but will run in a shell window on the box.
Have no idea :-( We checked all scripts on Sparc system before release... Unfortunately I cannot check this again because we rented Sparc station.
If you don't change scripts often, you may locate (and edit) scripts on Sparc station and use HostMonitor's Script Manager to execute script.

Regards
Alex
Post Reply