Create a file (remote) with an agent

Remote Monitoring Agent for Linux, FreeBSD, and other UNIX-like platforms.
Post Reply
Vini
Posts: 12
Joined: Wed Apr 23, 2008 2:44 am

Create a file (remote) with an agent

Post by Vini »

Hi everyone,
I'd like to know how to make an agent create a file on a remote host via a shell script.
I've already done a little script which should store configuration informations in a specific file, that script works well localy but when i make the RMA execute it, it looks that there is no problem but i don't know where my agent creates my file, i didn't find anything in the main rma folder or in the tmp rma folder.
Do you have any clues please??
Vini
Posts: 12
Joined: Wed Apr 23, 2008 2:44 am

Post by Vini »

Well to precise a bit....
I understood that the agent execute my script as a new process on teh remote host so it should create my file where that process is launched...but where??
My script simply do a "touch" command and then add all information i need in it.
Well, i don't know what to add...
Thx for any rely.
Vini
Vini
Posts: 12
Joined: Wed Apr 23, 2008 2:44 am

Post by Vini »

Ok, sorry for disturbing, i found i to reslove my problem. I just needed to use complete path (from / i mean).
So now file file is well created where i want and i can now rapatriate it through sftp ^^. Great!!
Thx anyway
Have a nice day
Vini
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Post by KS-Soft Europe »

Correct. You should use full path to the file. Glad you managed it to work.
Thank you for your feedback.

Regards,
Max
ataudte
Posts: 28
Joined: Wed Apr 23, 2008 3:40 am
Location: FFM, Germany

Post by ataudte »

Hello,

I cann't find my mistake.
I created an Action Profile to run external program. It should be executed by an agent (Unix).

Command line:
/usr/bin/echo %Reply_CStyle% >> /opt/hostmonitor/test.txt

Window mode:
SW_HIDE

After status change, there isn't a file in the specified folder. Why?
The RMA runs correctly and executes a lot of shell script tests, but it doesn't run the command of the Action Profile.

Regards,
ataudte
ataudte
Posts: 28
Joined: Wed Apr 23, 2008 3:40 am
Location: FFM, Germany

Post by ataudte »

APPENDIX

I checked the RMA for Unix on the Server. The rma got the permission to run external program (ExecuteAction=1). I restarted the RMA and the HostMonitor, but the command (/usr/bin/echo %Reply_CStyle% >> /opt/hostmonitor/test58.txt) doesn't make an impact.

Regards,
ataudte
KS-Soft
Posts: 12869
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

That's because output redirection (>>) is processed by command shell. In your case shell is not executed.
I would recommend to create simple script, e.g. /usr/rma/testlog.sh
============
#/bin/sh
/usr/bin/echo $1 >> /opt/hostmonitor/test.txt

============

Then HostMonitor can execute the following command
sh /usr/rma/testlog.sh %Reply_CStyle%

Regards
Alex
ataudte
Posts: 28
Joined: Wed Apr 23, 2008 3:40 am
Location: FFM, Germany

Post by ataudte »

Hallo Alex,

thanks a lot!
We tried some other shell commands yesterday and fixed the fault ("... >> ..."). Now we know, how to run an external program via RMA for Unix and it works great :)

Thanks for the trouble,
ataudte
KS-Soft
Posts: 12869
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

You are welcome

Regards
Alex
Post Reply