Discussion:
calling script from transform...
sadat khan
2012-10-25 11:28:29 UTC
Permalink
sadat khan [http://community.zenoss.org/people/sadat.ali.khan] created the discussion

"calling script from transform..."

To view the discussion, visit: http://community.zenoss.org/message/69526#69526

--------------------------------------------------------------
hello,
        i am calling a script from my transform and i have to pass evt.message as an arguement to the script... i am setting my command as

cmd = '<script path>' + evt.message
os.system(cmd)

    but the transform does not seemt to run... is there a special way to pass evt.message as an arguement ?

regards

Sadat
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/69526#69526]

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
dpetzel
2012-10-26 03:27:20 UTC
Permalink
dpetzel [http://community.zenoss.org/people/dpetzel] created the discussion

"Re: calling script from transform..."

To view the discussion, visit: http://community.zenoss.org/message/69551#69551

--------------------------------------------------------------
I'm curious as to why you want to call the script from an event transform instead of calling the script via an event command (or trigger if your on 4x)? If go with the event command, you can pass evt.mass using tales expression ${event/message} (or something akin to that)
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/69551#69551]

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
sadat khan
2012-10-26 07:14:55 UTC
Permalink
sadat khan [http://community.zenoss.org/people/sadat.ali.khan] created the discussion

"Re: calling script from transform..."

To view the discussion, visit: http://community.zenoss.org/message/69553#69553

--------------------------------------------------------------
thing is i have to make a sytem call from my transform ( zensendevent ) and using subprocess.Popen is spawning processes and not exiting. I am able to call the same using a script where the spawning does not happen. SO i wanted to call this script and opass the event message along with device ip as arguements to the script.
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/69553#69553]

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
sadat khan
2012-10-26 11:15:53 UTC
Permalink
sadat khan [http://community.zenoss.org/people/sadat.ali.khan] created the discussion

"Re: calling script from transform..."

To view the discussion, visit: http://community.zenoss.org/message/69556#69556

--------------------------------------------------------------
i am now using event notification command to do the same... however my script that has to be called is a python... what i see in zenactiond.log is that the script is being called with /bin/sh -c ... where cani change this /bin/sh thing in zenoss configuration ?
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/69556#69556]

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
jmp242
2012-10-26 12:04:10 UTC
Permalink
jmp242 [http://community.zenoss.org/people/jmp242] created the discussion

"Re: calling script from transform..."

To view the discussion, visit: http://community.zenoss.org/message/69545#69545

--------------------------------------------------------------
Just change the command definition to say:
python yourscriptname

--
James Pulver
ZCA Member
LEPP Computer Group
Cornell University
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/69545#69545]

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
sadat khan
2012-10-26 16:08:03 UTC
Permalink
sadat khan [http://community.zenoss.org/people/sadat.ali.khan] created the discussion

"Re: calling script from transform..."

To view the discussion, visit: http://community.zenoss.org/message/69547#69547

--------------------------------------------------------------
1./ had already tried that... quite obviously should have worked but what it does is something like /bin/sh -c /usr/bin/python <myscript>... and fails

2./ what i have done is written a bash wrapper around the python script... but /bin/sh -c <wrapper.sh> does not run the script... i have to get rid of that -c somehow... how can that be done ?
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/69547#69547]

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Loading...