Discussion:
Mass zLinks Script
stevez
2012-03-16 14:20:55 UTC
Permalink
stevez [http://community.zenoss.org/people/stevez] created the discussion

"Mass zLinks Script"

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

--------------------------------------------------------------
I recently tied all of our firewalls to an external report through a script which updates zLinks on each firewall:

for d in dmd.Devices.Network.Firewall.getSubDevices():
    if d.location() != None:
        d.zLinks = "<a href=\" http://webserver/cgi-bin/Report_Generator.pl?site_id= http://webserver/cgi-bin/Report_Generator.pl?site_id="+d.location().id+"\">Site Report - "+d.location().id+"</a>"
        commit()

Unfortunately, this created a zLinks attribute on each device which is something Zenoss moved away from as documented here: http://community.zenoss.org/message/32001#32001#32001 http://community.zenoss.org/message/32001#32001

This script worked fine and the links work fine but I now get errors regarding the zLinks property not existing when trying to save configuration properties. This is because the attribute takes precedence over the property or something of the sort.

What I am trying to find out is what is the device function call that adds or edits and existing zLinks property in such a way. A quick look through zendmd shows numerous lists and maps regarding properties. Is there a nice clean overarching function like d.addProperty("zLinks","the link") which properly adds/manages all of these lists.

Does anyone else do a mass configuration of zLinks on thousands of devices?

Thanks!
--------------------------------------------------------------

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

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]
TitoOrtega
2012-03-16 14:59:09 UTC
Permalink
TitoOrtega [http://community.zenoss.org/people/TitoOrtega] created the discussion

"Re: Mass zLinks Script"

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

--------------------------------------------------------------
No i cant find one

Courtesy of ZDC.
--------------------------------------------------------------

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

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
2012-03-16 15:13:33 UTC
Permalink
Shane Scott [http://community.zenoss.org/people/hackman238] created the discussion

"Re: Mass zLinks Script"

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

--------------------------------------------------------------
stevez:

Try using d.setZenProperty('zLinks','yourString') rather than dumping a string directly in.


What we do here is use tales expressions in the links like follows:

<a href="${here/zRancidUrl}/${here/zRancidGroup}/configs/${here/manageIp}?root=CVS&view=markup" target="_">RANCID</a>

You can do the same for any attribute/property accessible at the here context.

Best,
--Shane
--------------------------------------------------------------

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

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]
stevez
2012-03-16 15:16:18 UTC
Permalink
stevez [http://community.zenoss.org/people/stevez] created the discussion

"Re: Mass zLinks Script"

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

--------------------------------------------------------------
I was looking at that one but had no way to tell if that was the correct, highest-level function or if it was some middle function and then half my object structure wouldn't have the info. that's what you use regularly without ill effect?
--------------------------------------------------------------

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

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
2012-03-16 15:27:10 UTC
Permalink
Shane Scott [http://community.zenoss.org/people/hackman238] created the discussion

"Re: Mass zLinks Script"

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

--------------------------------------------------------------
stevez:

It should work without cuasing issues, yes. It won't fix existing issues, however. This method will essentially ensure aren't accidently creating a string named zLinks over the string type attribute zLinks. Can you post the trace/page error you're seeing on the zProperties submission screen?

I would use tales for what you're doing rather than dmd voodoo.

--Shane
--------------------------------------------------------------

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

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]
stevez
2012-03-22 15:45:50 UTC
Permalink
stevez [http://community.zenoss.org/people/stevez] created the discussion

"Re: Mass zLinks Script"

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

--------------------------------------------------------------
device.setZenProperty("zLinks", link) did not work initially on the polluted devices. Running device.__delattr__("zLinks") seemed to purge it it a way which now allows setZenProperty() to stick.

Thanks for the assist.
--------------------------------------------------------------

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

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
2012-03-22 15:53:16 UTC
Permalink
Shane Scott [http://community.zenoss.org/people/hackman238] created the discussion

"Re: Mass zLinks Script"

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

--------------------------------------------------------------
Anytime.

Best,
--Shane
--------------------------------------------------------------

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

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