View previous topic :: View next topic |
Author |
Message |
Christiane
Joined: 15 Nov 2011 Posts: 12
|
Posted: Mon Apr 27, 2015 3:41 am Post subject: Simple shell script with SNMP to remote host |
|
|
Hi,
I wrote a little shell script to get some info from remote host (SNMP) and I want to use this script with RMA for UNIX (located on one of our debians).
On cmd the script is running fine but with RMA (script is in HM script manager) I get "Agent error: Connection error".
Other scripts from script manager are working perfect.
May be the problem is getting info from other remote host or would this be possible?
Christiane |
|
Back to top |
|
|
Christiane
Joined: 15 Nov 2011 Posts: 12
|
Posted: Mon Apr 27, 2015 7:05 am Post subject: |
|
|
Oh sorry - I just realized this happens only in test mode of script manager. And there it happens for all shell scripts with RMA for Unix. But in live mode the test is working fine and I am happy now.
May be this is a bug of the test feature ("let's try")?
Christiane |
|
Back to top |
|
|
KS-Soft
Joined: 03 Apr 2002 Posts: 12801 Location: USA
|
Posted: Mon Apr 27, 2015 7:06 am Post subject: |
|
|
May we see script?
Regards
Alex |
|
Back to top |
|
|
KS-Soft
Joined: 03 Apr 2002 Posts: 12801 Location: USA
|
Posted: Mon Apr 27, 2015 8:19 am Post subject: |
|
|
So, if you setup test, it works fine with agent?
May be you are using Remote Control Console (RCC) started on some system with blocked network connection to RMA agent?
Regards
Alex |
|
Back to top |
|
|
Christiane
Joined: 15 Nov 2011 Posts: 12
|
Posted: Mon Apr 27, 2015 10:35 am Post subject: |
|
|
That was exactly the problem, thanks!!
Now both work fine - the test in RCC an the test in real life
And here ist my sample script:
#!/bin/sh
if [ $# -ge 2 ]
then
diskfree=`snmpget $1 .1.3.6.1.4.1.2021.9.1.7.1 | awk '{print $NF}'`
diskfree=$(($diskfree / 1024 / 1024))
if [ $diskfree -ge $2 ]
then
echo 'ScriptRes:Ok:'$diskfree' GB'
else
echo 'ScriptRes:Bad:'$diskfree' GB'
fi
else
echo 'ScriptRes:Unknown:not enough parameters specified'
fi
I know we can do same test with RMA itself but all of our debians are located in DMZ and we don't want RMA on each of them and open the necessary ports. With shell script / SNMP over one RMA we now are able to monitor all other hosts.
Christiane |
|
Back to top |
|
|
KS-Soft
Joined: 03 Apr 2002 Posts: 12801 Location: USA
|
Posted: Mon Apr 27, 2015 1:33 pm Post subject: |
|
|
I see.
Thank you for details
Regards
Alex |
|
Back to top |
|
|
|