Skip to content

Instantly share code, notes, and snippets.

View dougsyer's full-sized avatar

Doug Syer dougsyer

View GitHub Profile
@cluther
cluther / zenscriptbase_example.py
Created March 5, 2013 17:00
ZenScriptBase Example
#!/usr/bin/env python
import Globals
from Products.ZenUtils.ZenScriptBase import ZenScriptBase
class MyTool(ZenScriptBase):
def buildOptions(self):
super(MyTool, self).buildOptions()
self.parser.add_option(
@cluther
cluther / copyDashboard.py
Created September 24, 2012 21:53
Copy Zenoss Dashboard
#!/usr/bin/env python
import sys
import Globals
from transaction import commit
from Products.ZenUtils.ZenScriptBase import ZenScriptBase
dmd = ZenScriptBase(connect=True).dmd
if len(sys.argv) < 3:
print "Usage: %s <source_user> <destination_user>" % (sys.argv[0],)
sys.exit(1)
@cluther
cluther / overrids.zcml
Created September 22, 2011 19:02
Override Default Zenoss Permissions
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:browser="http://namespaces.zope.org/browser">
<include package="Products.Five" file="meta.zcml"/>
<include package="zope.viewlet" file="meta.zcml"/>
<include package="Products.ZenModel" file="permissions.zcml"/>
<browser:viewlet
name="Reports"
# This script looks for, and fixes problems where zDeviceTemplates was
# set as a regular object attribute instead of through the acquisition
# mechanism.
from Acquisition import aq_base
for d in dmd.Devices.getSubDevices():
if hasattr(aq_base(d), 'zCollectorPlugins') and not d.hasProperty('zCollectorPlugins'):
print "%s has the problem." % d.id
templates = d.zCollectorPlugins
del(d.zCollectorPlugins)
d._setProperty('zCollectorPlugins', templates)