def upgrade(self, app): if hasattr(self.dmd.zenMenus, "Database"): self.dmd.zenMenus._delObject("Database") self.dmd.zenMenus.manage_addZenMenu("Database") ZenPackBase.upgrade(self, app) for d in self.dmd.Devices.getSubDevices(): d.os.buildRelations()
def upgrade(self, app): """ Upgrading the ZenPack procedures """ self._add_events() ZenPackBase.upgrade(self, app) self._registerPortlet(app)
def remove(self, app, leaveObjects=False): # Delete only suborganizer /Storage/Qsan if hasattr(app.zport.dmd.Devices, 'Storage') and \ hasattr(app.zport.dmd.Devices.Storage, 'Qsan'): app.zport.dmd.Devices.manage_deleteOrganizer('/Storage/Qsan') ZenPackBase.remove(self, app, leaveObjects)
def install(self, app): if not hasattr(self.dmd.Devices.Server, 'NetWare'): manage_addDeviceClass(self.dmd.Devices.Server, 'NetWare') dc = self.dmd.Devices.Server.NetWare dc.description = 'Novell NetWare Servers' # dc.devtypes = ['SNMP',] dc.zIcon = '/zport/dmd/server-netware.png' dc.zLinks = "<a href='https://${here/manageIp}:8009' target='_'>Novell Remote Manager</a> <a href='https://${here/manageIp}/nps' target='_'>iManager</a>" dc.zCollectorPlugins = tuple(self.dmd.Devices.Server.zCollectorPlugins) + ( 'community.snmp.NWDeviceMap', 'community.snmp.NWFileSystemMap') if not hasattr(self.dmd.Devices.Server.NetWare, 'NCS'): manage_addDeviceClass(self.dmd.Devices.Server.NetWare, 'NCS') nwcs = self.dmd.Devices.Server.NetWare.NCS nwcs.description = 'Novell Cluster Virtual Resources' # nwcs.devtypes = ['SNMP',] nwcs.zCollectorPlugins = ('zenoss.snmp.NewDeviceMap', 'zenoss.snmp.DeviceMap', 'zenoss.snmp.IpServiceMap', 'zenoss.snmp.HRSWRunMap', 'community.snmp.Interface2IPMap', 'community.snmp.NWFileSystemMap', ) ZenPackBase.install(self, app) dc.zNWFileSystemMapIncludeNames = '^SYS' nwcs.zNWFileSystemMapIncludeNames = '^VOLUME_NAME'
def remove(self, app, junk): ZenPackBase.remove(self, app, junk) if hasattr(self.dmd.zenMenus, "Database"): self.dmd.zenMenus._delObject("Database") OperatingSystem._relations = tuple([x for x in OperatingSystem._relations if x[0] != "softwaredatabases"]) for d in self.dmd.Devices.getSubDevices(): d.os.buildRelations()
def install(self, app): """ Set the collector plugins for Server/SSH/Linux. """ linux = app.dmd.Devices.createOrganizer('/Server/SSH/Linux') linux.setZenProperty( 'zCollectorPlugins', ['zenoss.cmd.uname', 'zenoss.cmd.uname_a', 'zenoss.cmd.linux.cpuinfo', 'zenoss.cmd.linux.memory', 'community.cmd.linux.ip', 'community.cmd.linux.netstat_an', 'zenoss.cmd.linux.netstat_rn', 'zenoss.cmd.linux.process', 'community.cmd.linux.df', 'community.cmd.linux.lsb_release', 'community.cmd.linux.dmidecode', 'community.cmd.linux.sys_block', 'community.cmd.linux.mdstat', 'community.cmd.linux.lspci', 'community.cmd.linux.sw.dpkg', 'community.cmd.linux.sw.rpm' ] ) linux.register_devtype('Linux Server', 'SSH') # fix zHardDiskMapMatch for /Server/SSH/Linux hdProp = linux.getProperty('zHardDiskMapMatch') if not hdProp or hdProp == ZHD_OLD: linux.setZenProperty('zHardDiskMapMatch', ZHD_NEW) ZenPackBase.install(self, app)
def remove(self, app, junk): ZenPackBase.remove(self, app, junk) OperatingSystem._relations = tuple( [x for x in OperatingSystem._relations if x[0] not in ['lldplinks', ]]) for d in self.dmd.Devices.getSubDevices(): d.os.buildRelations()
def remove(self, app, junk): self._removeMenu('Database') self._removeMenu('DBSrvInst') ZenPackBase.remove(self, app, junk) OperatingSystem._relations = tuple([x for x in OperatingSystem._relations if x[0] not in ('softwaredatabases','softwaredbsrvinstances')]) for d in self.dmd.Devices.getSubDevices(): d.os.buildRelations()
def remove(self, app, leaveObjects=False): for dcp in self.dcProperties.keys(): try: dc = app.zport.dmd.Devices.getOrganizer(dcp) dc._delProperty('zCollectorPlugins') except: continue ZenPackBase.remove(self, app, leaveObjects)
def upgrade(self, app): for devClass, properties in self.dcProperties.iteritems(): self.addDeviceClass(app, devClass, properties) ZenPackBase.upgrade(self, app) for d in self.dmd.Devices.getSubDevices(): d.hw.buildRelations() d.os.buildRelations()
def install(self, zport): """ Set the collector plugin """ ZenPackBase.install(self, zport) setuphandlers.install(zport, self)
def install(self, app): """Initial installation of the ZenPack """ self._add_events() ZenPackBase.install(self, app) self._registerPortlet(app)
def install(self, app): ZenPackBase.install(self, app) log.info("Starting installation of ZenPacks.TwoNMS.Rancid (rancid v" + self.RANCID_VERSION + ")") self.install_rancid(app) for d in self.dmd.Devices.getSubDevices(): d.os.buildRelations()
def remove(self, app, leaveObjects=False ): """ Remove the ZenPack from Zenoss """ # NB: As of Zenoss 2.2, this function now takes three arguments. ZenPackBase.remove(self, app, leaveObjects) zpm = app.zport.ZenPortletManager zpm.unregister_portlet('myDeviceIssuesPortlet')
def upgrade(self, app): if hasattr(self.dmd.Reports, 'Device Reports'): devReports = self.dmd.Reports['Device Reports'] rClass = devReports.getReportClass() if not hasattr(devReports, 'Dell PowerEdge Reports'): dc = rClass('Dell PowerEdge Reports', None) devReports._setObject('Dell PowerEdge Reports', dc) ZenPackBase.upgrade(self, app)
def upgrade(self, app): ZenPackBase.upgrade(self, app) self._removeMenu('Database') self._addMenu('Database', 'Database') self._removeMenu('DBSrvInst') self._addMenu('DBSrvInst', 'Database Server Instance') for d in self.dmd.Devices.getSubDevices(): d.os.buildRelations()
def install(self, app): if hasattr(self.dmd.Reports, 'Device Reports'): devReports = self.dmd.Reports['Device Reports'] rClass = devReports.getReportClass() if not hasattr(devReports, 'HP ProLiant Reports'): dc = rClass('HP ProLiant Reports', None) devReports._setObject('HP ProLiant Reports', dc) ZenPackBase.install(self, app)
def upgrade(self, app): from ZenPacks.community.deviceAdvDetail.thresholds.StatusThreshold import StatusThreshold for t in dmd.Devices.getAllRRDTemplates(): for gt in t.thresholds(): if isinstance(gt, StatusThreshold): continue if gt.id != '%s status'%t.id: continue template.thresholds.removeRelation(gt) ZenPackBase.upgrade(self, app)
def install(self, app): ZenPackBase.install(self, app) super(ZenPack, self).install(app) log.info("Adding ZenPacks.community.CiscoEnvmonE" " relationships to existing devices") self._buildHWRelations()
def install(self, app): if not hasattr(app.zport.dmd.Events.Status, 'VMware'): app.zport.dmd.Events.createOrganizer("/Status/VMware") app.zport.dmd.Reports.createOrganizer('/VMware Reports') ZenPackBase.install(self, app) log.info('Linking icon into $ZENHOME/Products/ZenWidgets/skins/zenui/img/icons') os.system('ln -sf %s %s' % (self.path('resources/img/icons/server-vmware.png'), zenPath('Products/ZenWidgets/skins/zenui/img/icons', 'server-vmware.png'))) os.system('chmod 0644 %s' % (zenPath('Products/ZenWidgets/skins/zenui/img/icons', 'server-vmware.png')))
def install(self, app): if hasattr(self.dmd.Reports, "Device Reports"): devReports = self.dmd.Reports["Device Reports"] rClass = devReports.getReportClass() if not hasattr(devReports, "HP ProLiant Reports"): dc = rClass("HP ProLiant Reports", None) devReports._setObject("HP ProLiant Reports", dc) ZenPackBase.install(self, app)
def remove(self, app, junk): ZenPackBase.remove(self, app, junk) if hasattr(self.dmd.Reports, 'Device Reports'): devReports = self.dmd.Reports['Device Reports'] if hasattr(devReports, 'Snmp Reports'): devReports._delObject('Snmp Reports') OperatingSystem._relations = tuple([x for x in OperatingSystem._relations if x[0] not in ['snmpCommand']]) for d in self.dmd.Devices.getSubDevices(): d.os.buildRelations()
def install(self, app): ZenPackBase.install(self, app) dc = app.dmd.Devices.createOrganizer('/AWS/EC2') dc.setZenProperty('zCollectorPlugins', ('zenoss.aws.EC2InstanceMap',)) dc.setZenProperty('zPythonClass', 'ZenPacks.zenoss.ZenAWS.EC2Manager') if dc.devices._getOb('EC2Manager', None): return ec2m = dc.createInstance('EC2Manager') ec2m.setPerformanceMonitor('localhost')
def remove(self, app, leaveObjects=False): pct = app.zport.dmd.Monitors.rrdTemplates.PerformanceConf for gdn, dpn, stacked, format in self._gdmap: gd = getattr(pct.graphDefs, gdn, None) if not gd: continue gd.manage_deleteGraphPoints(['zenperfsql']) if hasattr(pct.datasources, 'zenperfsql'): pct.manage_deleteRRDDataSources(['zenperfsql']) ZenPackBase.remove(self, app, leaveObjects)
def upgrade(self, app): if hasattr(self.dmd.Reports, 'Device Reports'): devReports = self.dmd.Reports['Device Reports'] rClass = devReports.getReportClass() if not hasattr(devReports, 'SMI-S Reports'): dc = rClass('SMI-S Reports', None) devReports._setObject('SMI-S Reports', dc) for devClass, properties in self.dcProperties.iteritems(): self.addDeviceClass(app, devClass, properties) ZenPackBase.upgrade(self, app)
def upgrade(self, app): """ Delete and re-create the top-level menu. """ if hasattr(self.dmd.zenMenus, 'MessageQueues'): self.dmd.zenMenus._delObject('MessageQueues') self.dmd.zenMenus.manage_addZenMenu('MessageQueues') ZenPackBase.upgrade(self, app) for d in self.dmd.Devices.getSubDevices(): d.os.buildRelations()
def remove( self, app, leaveObjects=False): # # On ZenPack remove, delete role ZenOperator # self.removeZenOperatorRole(app.zport) # # Remove ZenCommon role # self.removeZenCommonRole(app.zport) ZenPackBase.remove( self, app, leaveObjects=False )
def remove(self, app, leaveObjects=False): dc = app.zport.dmd.Devices.getOrganizer('Network/Router/Cisco') cpl = list(getattr(dc, 'zCollectorPlugins')) for plugin in self.newplugins: if plugin in cpl: cpl.remove(plugin) dc.zCollectorPlugins = list(cpl) ZenPackBase.remove(self, app, leaveObjects) if hasattr(self.dmd.Reports, 'Device Reports'): devReports = self.dmd.Reports['Device Reports'] if hasattr(devReports, 'Cisco Reports'): devReports._delObject('Cisco Reports')
def install(self, app): ZenPackBase.install(self, app) configFileName = zenPath("etc", "zeneval.conf") if not os.path.exists(configFileName): configFile = open(configFileName, "w") configFile.write("") configFile.close() self.dmd.zport.__setattr__("eval_expired", "false") self.modifyLoginForm( "tal:attributes=\"onload string:if (${here/eval_expired}) alert('Evaluation period is expired. Please, contact your distributor.');;" )
def upgrade(self, app): if hasattr(self.dmd.Reports, 'Device Reports'): devReports = self.dmd.Reports['Device Reports'] rClass = devReports.getReportClass() if not hasattr(devReports, 'Snmp Reports'): dc = rClass('Snmp Reports', None) devReports._setObject('Snmp Reports', dc) self.dmd.Events.createOrganizer("/Change/Set/Status") ZenPackBase.upgrade(self, app) for d in self.dmd.Devices.getSubDevices(): d.os.buildRelations()
def install(self, dmd): # Run migrate scripts ZenPackBase.install(self, dmd) log.info("Installing zenwebserver and nginx to $ZENHOME/bin") # Create zenwebserver symlink self._symlink(('zenwebserver', ), ('bin', 'zenwebserver')) self._executable('zenwebserver') # Create bin/nginx symlink self._symlink(('bin', 'nginx'), ('bin', 'nginx')) self._executable('bin', 'nginx') log.info("Installing nginx configuration to $ZENHOME/etc") zopeConfig = ZopeConfig() port = zopeConfig.http_base_port log.info("Detected Zope is using port %s" % port) # Replace strings in zenwebserver.conf with open(self.path('zenwebserver.conf'), 'r') as f, open(self.path('zenwebserver.conf.tmp'), 'w') as f2: f2.write(f.read().replace('<<INSTANCE_HOME>>', zenPath()).replace( '<<PORT>>', str(port))) # Create mime.types symlink self._symlink(('mime.types', ), ('etc', 'mime.types')) # make sure the html directory exists self._create_zenhome_dirs('html', 'etc/zope', 'log/nginx', 'var/nginx/cache', 'var/nginx/tmp') # copy 50x page self._copy(('zenwebserver_50x.html', ), ('html', 'zenwebserver_50x.html')) #copy nginx config template to etc self._copy(('nginx.conf.template', ), ('etc', 'nginx.conf.template'), backup=True) # Copy in nginx configs, does not replace existing configs self._copy(('zenwebserver.conf.tmp', ), ('etc', 'zenwebserver.conf')) self._copy(('nginx-zope.conf', ), ('etc', 'nginx-zope.conf')) # Clean up os.remove(self.path('zenwebserver.conf.tmp')) if is_using_many_zopes(): log.warn( "Already using multiple Zopes; not switching to use zenwebserver by default." ) else: replace_zopectl_in_daemons_txt() use_zenwebserver() log.info("Attempting to shut down running zopectl") subprocess.call([zenPath('bin', 'zopectl'), 'stop']) time.sleep(4) # Wait for it to shut down log.info("Configuring zenwebserver") subprocess.call([zenPath('bin', 'zenwebserver'), 'configure']) log.info( "Installed successfully. Run 'zenwebserver start' to start the UI server." )
def upgrade(self, app): ZenPackBase.upgrade(self, app) self.installMenuItems(app.zport.dmd)
def upgrade(self, app): ZenPackBase.upgrade(self, app) self.setupCollectorPlugins(app.zport.dmd)
def remove(self, app, leaveObjects=False): ZenPackBase.remove(self, app, leaveObjects)
def upgrade( self, app): ZenPackBase.upgrade( self, app )
def remove(self, app, leaveObjects=False): self.replaceString(zenPath('bin/zenoss'),' C="$C zenrender"',' #C="$C zenrender"') if os.path.exists(zenPath('etc/DAEMONS_TXT_ONLY')) and os.path.exists(zenPath('etc/daemons.txt')): self.replaceString(zenPath('etc/daemons.txt'),'zenrender','') self.removeMenuItems(app.zport.dmd) ZenPackBase.remove(self, app, leaveObjects)
def upgrade(self, app): if not hasattr(app.zport.dmd.Devices.Server, 'Zeus'): manage_addDeviceClass(app.zport.dmd.Devices.Server, 'Zeus') dc = app.zport.dmd.Devices.getOrganizer('Server/Zeus') dc.description = 'Zeus Load Balancers' ZenPackBase.upgrade(self, app)
def install(self, app): """ Initial installation of the ZenPack """ ZenPackBase.install(self, app) self._registerMyEventViewsPortlet(app)
def upgrade(self, app): """ Upgrading the ZenPack procedures """ ZenPackBase.upgrade(self, app) self._registerMyEventViewsPortlet(app)
def install(self, app): ZenPackBase.install(self, app) self.installMenuItems(app.zport.dmd) dc = app.zport.dmd.Devices.getOrganizer('Devices/Server/AIX')
def upgrade(self, app): ZenPackBase.upgrade(self, app) self._buildRelations() self._setupCollectorPlugins(app.zport.dmd)
def upgrade(self, app): """ Upgrading the ZenPack procedures """ ZenPackBase.upgrade(self, app) self._registermyDeviceIssuesPortlet(app)
def install(self, app): self.replaceString(zenPath('bin/zenoss'),' #C="$C zenrender"',' C="$C zenrender"') if os.path.exists(zenPath('etc/DAEMONS_TXT_ONLY')) and os.path.exists(zenPath('etc/daemons.txt')): self.replaceString(zenPath('etc/daemons.txt'),'','zenrender') ZenPackBase.install(self, app) self.installMenuItems(app.zport.dmd)
def install(self, app): ZenPackBase.install(self, app) self.enableDefaultServiceMonitoring(app.zport.dmd)
def install( self, app): ZenPackBase.install( self, app )
def upgrade(self, app): ZenPackBase.upgrade(self, app) self.enableDefaultServiceMonitoring(app.zport.dmd)
def upgrade(self, app): if not hasattr(app.zport.dmd.Devices, 'BladeChassis'): manage_addDeviceClass(app.zport.dmd.Devices, 'BladeChassis') dc = app.zport.dmd.Devices.getOrganizer('BladeChassis') dc.description = '' ZenPackBase.upgrade(self, app)
def install(self, app): ZenPackBase.install(self, app) self._registerOAControlPortlet(app)
def remove(self, app, leaveObjects=False): self.cleanupOurPlugins(app.zport.dmd) ZenPackBase.remove(self, app, leaveObjects)
def upgrade(self, app): ZenPackBase.upgrade(self, app) self._registerOAControlPortlet(app)
def install(self, app): ZenPackBase.install(self, app) self.installMenuItems(app.zport.dmd)
def remove(self, app, leaveObjects=False): ZenPackBase.remove(self, app, leaveObjects) zpm = app.zport.ZenPortletManager zpm.unregister_portlet('OAControlPortlet')
def remove(self, app, leaveObjects=False): self.removeMenuItems(app.zport.dmd) ZenPackBase.remove(self, app, leaveObjects)
def install(self, app): ZenPackBase.install(self, app) self.buildProducts(app.zport.dmd)
def upgrade(self, app): if not hasattr(app.zport.dmd.Events.Status, 'Wbem'): app.zport.dmd.Events.createOrganizer("/Status/Wbem") ZenPackBase.upgrade(self, app)
def install(self, app): ZenPackBase.install(self, app) self._buildRelations() self._setupCollectorPlugins(app.zport.dmd)
def install(self, app): """ Initial installation of the ZenPack """ ZenPackBase.install(self, app) self._registerFavoriteReportsPortlet(app)
def install(self, app): """ Initial installation of the ZenPack """ ZenPackBase.install(self, app) self._registermyDeviceIssuesPortlet(app)
def upgrade(self, app): """ Upgrading the ZenPack procedures """ ZenPackBase.upgrade(self, app) self._registerFavoriteReportsPortlet(app)
def install(self, app): if not hasattr(app.zport.dmd.Events.Status, 'PyDBAPI'): app.zport.dmd.Events.createOrganizer("/Status/PyDBAPI") ZenPackBase.install(self, app)