This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
import os | |
from optparse import OptionParser | |
zenhome = os.environ['ZENHOME'] | |
oldpath = os.environ.get('LD_LIBRARY_PATH', None) | |
libpath = os.path.join(zenhome, 'ZenPacks', | |
'ZenPacks.zenoss.ZenSQLTx-2.0.0-py2.4-linux-i686.egg', | |
'ZenPacks', 'zenoss', 'ZenSQLTx', 'lib') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from xmlrpclib import ServerProxy | |
baseUrl = 'http://admin:zenoss@localhost:8080' | |
p = ServerProxy(baseUrl + '/zport/dmd/Devices') | |
deviceNames = eval(p.jsonGetDeviceNames()) | |
for deviceName in deviceNames: | |
path = p.findDevicePath(deviceName) | |
dp = ServerProxy(baseUrl + path) | |
print "%s = %s" % (deviceName, dp.getProperty('snmpSysName')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 64492bf0117eb1649aad1f6b1cec1b281ea88938 Mon Sep 17 00:00:00 2001 | |
From: Chet Luther <[email protected]> | |
Date: Mon, 5 Oct 2009 14:30:25 -0400 | |
Subject: [PATCH] Various ZenAWS fixes. | |
Fixes #5597, Fixes #5601. Reviewed by ian. | |
--- | |
.../ZenPacks/zenoss/ZenAWS/EC2Manager.py | 5 +- | |
.../zenoss/ZenAWS/libexec/zenec2modeler.py | 29 ++++-- | |
.../modeler/plugins/zenoss/aws/EC2InstanceMap.py | 5 +- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def getComponentQuickly(device_name, component_type, component_name): | |
cs = dmd.Devices.componentSearch | |
for brain in cs(getParentDeviceName=device_name, meta_type=component_type): | |
component = brain.getObject() | |
if component.name() == component_name: | |
return component | |
grail = getComponentQuickly('mydevice', 'IpInterface', 'eth0') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from Products.ZenModel.ZenModelRM import ZenModelRM | |
pathlist = self.REQUEST['PATH_INFO'].split('/') | |
obj = self.getObjByPath('/'.join(pathlist)) | |
while not isinstance(obj, ZenModelRM): | |
pathlist = pathlist[:-1] | |
obj = self.getObjByPath('/'.join(pathlist)) | |
# Now obj is what you want. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
oldPlugin="zenoss.snmp.RouteMap" | |
newPlugin="IpRouteCSOB" | |
def replacePlugin(objs): | |
for obj in objs: | |
if not obj.hasProperty('zCollectorPlugins'): continue | |
if oldPlugin not in obj.zCollectorPlugins: continue | |
print "Replacing plugin for %s." % obj.id | |
obj.zCollectorPlugins = [ | |
p for p in obj.zCollectorPlugins if p != oldPlugin ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
log = logging.getLogger('zen.ZenPack') | |
import Globals | |
from AccessControl import ClassSecurityInfo | |
from Products.ZenModel.Location import Location | |
from Products.ZenModel.ZenPack import ZenPack as ZenPackBase | |
from Products.ZenModel.ZenossSecurity import ZEN_COMMON, ZEN_VIEW | |
from Products.ZenWidgets.ZenossPortlets import ZenossPortlets |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for t in dmd.Devices.getAllRRDTemplates(): | |
for g in t.graphDefs(): | |
g.buildRelations() | |
commit() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Remove non-existent devices from performance monitors | |
from Products.ZenModel.PerformanceConf import PerformanceConf | |
for pmon in dmd.Monitors.Performance.objectValues(): | |
if not isinstance(pmon, PerformanceConf): continue | |
for device in pmon.devices(): | |
try: | |
bah = device.primaryAq() | |
except Exception: | |
print "Removing %s from %s" % (device.id, pmon.id) | |
pmon.devices._remove(device) |
OlderNewer