Discussion:
Conditional TALES expression in COMMAND Data Source?
j053ph4
2011-10-18 21:58:15 UTC
Permalink
j053ph4 [http://community.zenoss.org/people/j053ph4] created the discussion

"Conditional TALES expression in COMMAND Data Source?"

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

--------------------------------------------------------------
Does anyone know if this is possible?  If so, what would it look like?

I'm looking to make a command data source for a component template that would optionally add parameters if the component attributes exist, for example:

check_http -t 30 -H ${dev/manageIp} -p ${here/httpPort} -u ${here/httpUrl}

would change to:

check_http -t 30 -H ${dev/manageIp} -p ${here/httpPort} -u ${here/httpUrl} -a ${here/httpAuthUser}:${httpAuthPassword}

if the "httpAuthUser" and "httpAuthPassword" component attributes != None.


Thanks,
Joseph
--------------------------------------------------------------

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

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]
Shane Scott
2011-10-19 03:01:57 UTC
Permalink
Shane Scott [http://community.zenoss.org/people/hackman238] created the discussion

"Re: Conditional TALES expression in COMMAND Data Source?"

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

--------------------------------------------------------------
j053ph4:

Negative, there is no conditional in this situation.

You can, however, do this:
zProperty, httpAuthUser= '-a yourUser:'
zProperty, httpAuthPassword='mySecret'

Command= check_http -t 30 -H ${dev/manageIp} -p ${here/httpPort} -u ${here/httpUrl} ${here/httpAuthUser}${httpAuthPassword}

If httpAuthUser and httpAuthPassword are blank, they are filled in as '' else they fill in the -a and : you need to make it all work.

Best,
--Shane W. Scott(Hackman238)
  ZCA - http://community.zenoss.org/community/zca/blog http://community.zenoss.org/community/zca/blog
--------------------------------------------------------------

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

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]
j053ph4
2011-10-19 13:47:20 UTC
Permalink
j053ph4 [http://community.zenoss.org/people/j053ph4] created the discussion

"Re: Conditional TALES expression in COMMAND Data Source?"

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

--------------------------------------------------------------
Thanks Shane I'll give that a try...

Since what I asked isn't possible, are you saying that the optional argument handling (and selection of the relevant switches) is a function of the check_http plugin or is it more generic than that. 

Do you know if the "-s" (regex) or "-P" (POST) options can work the same way?

Thanks,
Joseph
--------------------------------------------------------------

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

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...