Discussion:
Changes by zendmd are not shown in web interface
Benyi Wang
2011-11-23 21:38:37 UTC
Permalink
Benyi Wang [http://community.zenoss.org/people/bewang.tech] created the discussion

"Changes by zendmd are not shown in web interface"

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

--------------------------------------------------------------
I use zendmd to create thresholds for a template.

from Products.ZenModel.MinMaxThreshold import MinMaxThreshold

thresholds = {
  "mapred.jobtracker.HeartBeatsWarning": {
    "severity" : 3,
    "maxval"   : 30,
    "dsnames"  : [ "HadoopGanglia_mapred.jobtracker.heartbeats" ]
  },
   ...

}


template = dmd.Devices.rrdTemplates.HadoopJobTracker
for (id, data) in thresholds.items():
  t = MinMaxThreshold(id)
  t.severity = data["severity"]
  t.maxval = data["maxval"]
  t.dsnames = data["dsnames"]
  t.eventClass = '/Perf/Ganglia'
  if not template.thresholds.hasobject(t):
    template.thresholds._add(t)
commit()

I can find those thresholds even I restart zendmd, but I cannot find the thresholds in zenoss web ui. I restarted zopectl, but it didn't work.

The template HadoopJobTracker is defined in a ZenPack, and I use

zenpack --link --install=/home/bewang/ws-zenpacks/ZenPack.Metrics.HadoopMetrics

I can define a threshold in web UI.

What's wrong?

Thanks.
--------------------------------------------------------------

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

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
2011-11-23 22:26:21 UTC
Permalink
dpetzel [http://community.zenoss.org/people/dpetzel] created the discussion

"Re: Changes by zendmd are not shown in web interface"

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

--------------------------------------------------------------
Try replacing
Post by Benyi Wang
template = dmd.Devices.rrdTemplates.HadoopJobTracker
With
Post by Benyi Wang
template_name = "HadoopJobTracker"
    template = t
    break
I'm not sure you getting a valid reference to the template with the approach you are taking. Is that template really targeted at the Device class? or is it targeted at a sub class? IE /Devices/Server/Linux?

I think the modification above should get you a valid reference to the template object you want.
--------------------------------------------------------------

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

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]
Benyi Wang
2011-11-23 22:54:37 UTC
Permalink
Benyi Wang [http://community.zenoss.org/people/bewang.tech] created the discussion

"Re: Changes by zendmd are not shown in web interface"

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

--------------------------------------------------------------
I'm sure this works
Post by Benyi Wang
template = dmd.Devices.rrdTemplates.HadoopJobTracker
because I try to update one of threshold defined manually in web UI like this
Post by Benyi Wang
t = template.thresholds._getOb('mapred.jobtracker.FailedTasksWarning')
t.maxval = 'here.getRRDValue("jobs_submitted") * 0.003'
commit()
The maxval did change in UI.

The only problem is the new thresholds added by zendmd scripts, for example, "mapred.jobtracker.KilledMapsWarning". I cannot even add a threshold manually with the name "mapred.jobtracker.KilledMapsWarning".

I don't know if this problem is related to the zenpack where the template resides.
--------------------------------------------------------------

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

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
2011-11-23 23:23:47 UTC
Permalink
dpetzel [http://community.zenoss.org/people/dpetzel] created the discussion

"Re: Changes by zendmd are not shown in web interface"

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

--------------------------------------------------------------
gotcha, I think I have a better idea of what your after. Does the following work any better
Post by Benyi Wang
  t = MinMaxThreshold(id)
  t.severity = data["severity"]
  t.maxval = data["maxval"]
  t.dsnames = data["dsnames"]
  t.eventClass = '/Perf/Ganglia'
    template.thresholds._add(t)
with
Post by Benyi Wang
      t.severity = data["severity"]
      t.maxval = data["maxval"]
      t.dsnames = data["dsnames"]
      t.eventClass = '/Perf/Ganglia'
This isnt tested, but just something I threw together in a quick glance through the source on http://dev.zenoss.com/trac/browser/trunk/Products/ZenModel/RRDTemplate.py http://dev.zenoss.com/trac/browser/trunk/Products/ZenModel/RRDTemplate.py. On the surface it seems that function will create an "empty" threshold that you can then set attributes on.

Again untested..
--------------------------------------------------------------

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

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]
Benyi Wang
2011-11-24 06:28:28 UTC
Permalink
Benyi Wang [http://community.zenoss.org/people/bewang.tech] created the discussion

"Re: Changes by zendmd are not shown in web interface"

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

--------------------------------------------------------------
  t = template.manage_addRRDThreshold(id, 'MinMaxThreshold')
    t.severity = data["severity"]
    t.maxval = data["maxval"]
    t.dsnames = data["dsnames"]
    t.eventClass = '/Perf/Ganglia'
  t = MinMaxThreshold(id)
  t.severity = data["severity"]
  t.maxval = data["maxval"]
  t.dsnames = data["dsnames"]
  t.eventClass = '/Perf/Ganglia'
  template.thresholds._setObject(id, t)
template.thresholds._add(t) won't work in that _add is "add an object to one side of a ToManyContRelationship", but _setObject set relation between the object and ToManyContRelationship. check the source code here http://storage.fused.net/mirrors/fused/sources/zenoss-api-docs/Products.ZenRelations.ToManyContRelationship.ToManyContRelationship-class.html#_setObject. (http://storage.fused.net/mirrors/fused/sources/zenoss-api-docs/Products.ZenRelations.ToManyContRelationship.ToManyContRelationship-class.html#_setObject)
--------------------------------------------------------------

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

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