def cutover(self, dmd): from Products.ZenModel.MonitorClass import manage_addMonitorClass if not hasattr(dmd.Monitors, 'Performance'): manage_addMonitorClass(dmd.Monitors, 'Performance') from Products.ZenModel.PerformanceConf import manage_addPerformanceConf if hasattr(dmd.Monitors, 'Cricket'): for c in dmd.Monitors.Cricket.objectValues(): if not hasattr(dmd.Monitors.Performance, c.id): manage_addPerformanceConf(dmd.Monitors.Performance, c.id) p = dmd.Monitors.Performance._getOb(c.id) p.renderurl = c.cricketurl p.renderuser = c.cricketuser p.renderpass = c.cricketpass if hasattr(dmd.Monitors.Cricket, 'localhost'): dmd.Monitors.Cricket._delObject('localhost') dmd.Monitors._delObject("Cricket") for dev in dmd.Devices.getSubDevices(): dev.buildRelations() if hasattr(dev, 'cricket') and dev.cricket.getRelatedId(): dev.setPerformanceMonitor(dev.cricket.getRelatedId()) if hasattr(dev, '_snmpUpTime'): delattr(dev, '_snmpUpTime') for fs in dev.os.filesystems(): if not callable(fs.totalBytes): delattr(fs, 'totalBytes') if not callable(fs.usedBytes): delattr(fs, 'usedBytes') if not callable(fs.availBytes): delattr(fs, 'availBytes') if not callable(fs.availFiles): delattr(fs, 'availFiles') if not callable(fs.capacity): delattr(fs, 'capacity') if not callable(fs.inodeCapacity): delattr(fs, 'inodeCapacity') for dc in dmd.Devices.getSubOrganizers(): self.convert(dc) self.convert(dmd.Devices) if not hasattr(dmd.Devices, 'zProdStateThreshold'): dmd.Devices._setProperty("zProdStateThreshold", 500, type="int") if getattr(dmd.Devices.rrdTemplates, 'Device', None) is None: from Products.ZenRelations.ImportRM import ImportRM imp = ImportRM(noopts=True, app=dmd.getPhysicalRoot()) imp.options.noCommit = True imp.options.infile = zenPath('Products', 'ZenModel', 'data', 'rrdconfig.update') imp.loadDatabase()
def cutover(self, dmd): from Products.ZenModel.MonitorClass import manage_addMonitorClass if not hasattr(dmd.Monitors, 'Performance'): manage_addMonitorClass(dmd.Monitors, 'Performance') from Products.ZenModel.PerformanceConf import manage_addPerformanceConf if hasattr(dmd.Monitors, 'Cricket'): for c in dmd.Monitors.Cricket.objectValues(): if not hasattr(dmd.Monitors.Performance, c.id): manage_addPerformanceConf(dmd.Monitors.Performance, c.id) p = dmd.Monitors.Performance._getOb(c.id) p.renderurl = c.cricketurl p.renderuser = c.cricketuser p.renderpass = c.cricketpass if hasattr(dmd.Monitors.Cricket, 'localhost'): dmd.Monitors.Cricket._delObject('localhost') dmd.Monitors._delObject("Cricket") for dev in dmd.Devices.getSubDevices(): dev.buildRelations() if hasattr(dev, 'cricket') and dev.cricket.getRelatedId(): dev.setPerformanceMonitor(dev.cricket.getRelatedId()) if hasattr(dev, '_snmpUpTime'): delattr(dev, '_snmpUpTime') for fs in dev.os.filesystems(): if not callable(fs.totalBytes): delattr(fs, 'totalBytes') if not callable(fs.usedBytes): delattr(fs, 'usedBytes') if not callable(fs.availBytes): delattr(fs, 'availBytes') if not callable(fs.availFiles): delattr(fs, 'availFiles') if not callable(fs.capacity): delattr(fs, 'capacity') if not callable(fs.inodeCapacity): delattr(fs, 'inodeCapacity') for dc in dmd.Devices.getSubOrganizers(): self.convert(dc) self.convert(dmd.Devices) if not hasattr(dmd.Devices, 'zProdStateThreshold'): dmd.Devices._setProperty("zProdStateThreshold", 500, type="int") if getattr(dmd.Devices.rrdTemplates, 'Device', None) is None: from Products.ZenRelations.ImportRM import ImportRM imp = ImportRM(noopts=True, app=dmd.getPhysicalRoot()) imp.options.noCommit = True imp.options.infile = zenPath( 'Products', 'ZenModel', 'data', 'rrdconfig.update') imp.loadDatabase()
def loadDatabase(self): # This is an initial load, so we can forgo incremental commits self.options.chunk_size = 0 datadir = os.path.join(os.path.dirname(__file__),"data") self.log.info("loading data from:%s", datadir) for path, dirname, filenames in os.walk(datadir): filenames.sort() for filename in filter(lambda f: f.endswith(".xml"), filenames): self.options.infile = os.path.join(path,filename) self.log.info("loading: %s", self.options.infile) ImportRM.loadDatabase(self) # Reindex ProductKeys and EventClassKeys after XML load self.dmd.Manufacturers.reIndex() self.dmd.Events.reIndex() transaction.commit()
def cutover(self, dmd): if hasattr(dmd, 'Processes'): if not dmd.Processes.hasProperty('zFailSeverity'): dmd.Processes._setProperty("zFailSeverity", 4, type="int") return from Products.ZenModel.OSProcessOrganizer \ import manage_addOSProcessOrganizer manage_addOSProcessOrganizer(dmd, 'Processes') if getattr(dmd.Devices.rrdTemplates, 'OSProcess', None) is None: from Products.ZenRelations.ImportRM import ImportRM imp = ImportRM(noopts=True, app=dmd.getPhysicalRoot()) imp.options.noCommit = True imp.options.noindex = True imp.options.infile = zenPath('Products', 'ZenModel', 'data', 'osproc.update') imp.loadDatabase()
def cutover(self, dmd): if hasattr(dmd, 'Processes'): if not dmd.Processes.hasProperty('zFailSeverity'): dmd.Processes._setProperty("zFailSeverity", 4, type="int") return from Products.ZenModel.OSProcessOrganizer \ import manage_addOSProcessOrganizer manage_addOSProcessOrganizer(dmd, 'Processes') if getattr(dmd.Devices.rrdTemplates, 'OSProcess', None) is None: from Products.ZenRelations.ImportRM import ImportRM imp = ImportRM(noopts=True, app=dmd.getPhysicalRoot()) imp.options.noCommit = True imp.options.noindex = True imp.options.infile = zenPath( 'Products', 'ZenModel', 'data', 'osproc.update') imp.loadDatabase()