KS-Soft. Network Management Solutions
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister    ProfileProfile    Log inLog in 

Simple shell script with SNMP to remote host

 
Post new topic   Reply to topic    KS-Soft Forum Index -> RMA for UNIX
View previous topic :: View next topic  
Author Message
Christiane



Joined: 15 Nov 2011
Posts: 12

PostPosted: Mon Apr 27, 2015 3:41 am    Post subject: Simple shell script with SNMP to remote host Reply with quote

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
View user's profile Send private message
Christiane



Joined: 15 Nov 2011
Posts: 12

PostPosted: Mon Apr 27, 2015 7:05 am    Post subject: Reply with quote

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
View user's profile Send private message
KS-Soft



Joined: 03 Apr 2002
Posts: 12791
Location: USA

PostPosted: Mon Apr 27, 2015 7:06 am    Post subject: Reply with quote

May we see script?

Regards
Alex
Back to top
View user's profile Send private message Visit poster's website
KS-Soft



Joined: 03 Apr 2002
Posts: 12791
Location: USA

PostPosted: Mon Apr 27, 2015 8:19 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Christiane



Joined: 15 Nov 2011
Posts: 12

PostPosted: Mon Apr 27, 2015 10:35 am    Post subject: Reply with quote

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
View user's profile Send private message
KS-Soft



Joined: 03 Apr 2002
Posts: 12791
Location: USA

PostPosted: Mon Apr 27, 2015 1:33 pm    Post subject: Reply with quote

I see.
Thank you for details

Regards
Alex
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    KS-Soft Forum Index -> RMA for UNIX All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

KS-Soft Forum Index