Discussion:
getGraphDef() Usage help
James Newman
2013-03-06 16:45:09 UTC
Permalink
James Newman [http://community.zenoss.org/people/JimForTheWin] created the discussion

"getGraphDef() Usage help"

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

--------------------------------------------------------------
The woes of my cursed Multi-Graph script continue:

I know I can use rpt.getGraphDefs()  to return all of the GraphDef objects that belong to a given report.  However I should be able to use rpt.getGraphDef(graphdef.id)  to return a specific graph definition.  Except it doesn't work.

Assume all previous variables are created correctly.
...         print gdef.id
...         type(gdef)
...         type(gdef.id)
...
MSF test-xx-test in
<type 'ImplicitAcquirerWrapper'>
<type 'str'>

This is as expected.
gd = rpt.getGraphDef('MSF test-xx-test in')
type(gd)
<type 'NoneType'>

It doesn't work as I'm expecting.
...     if rpt.getGraphDef(gdef.id):
...         print "Holy Cow it's worked!"
...

Doesn't result in anything.

I'm super stumped on this one.  I've tried working around it using a for in / if loop using getGraphDefs() but this just didn't fit the requirements.
--------------------------------------------------------------

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

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]
James Newman
2013-03-07 08:54:59 UTC
Permalink
James Newman [http://community.zenoss.org/people/JimForTheWin] created the discussion

"Re: getGraphDef() Usage help"

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

--------------------------------------------------------------
...     print "howdy doo"
...
howdy doo
--------------------------------------------------------------

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

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
2013-03-07 17:48:37 UTC
Permalink
Shane Scott [http://community.zenoss.org/people/hackman238] created the discussion

"Re: getGraphDef() Usage help"

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

--------------------------------------------------------------
James:

org=dmd.Reports._getOb('Multi-Graph Reports')
rpt=org._getOb('Provider Connections')
graphs=rpt.getGraphDefs()

for graph in graphs:
    graph.id
    graph.__class__

You can also:

graph=rpt.graphDefs._get('PPS-Inbound-Outbound')
graph.id
graph.__class__

Best,
--Shane Scott (Hackman238)
--------------------------------------------------------------

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

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