Beispiel #1
0
 def __init__(self, dmd, instance):
     self.cimtransport = ['WBEM', 'CIM']
     deviceProxyAttributes = ('zWbemMonitorIgnore', 'zWbemUseSSL',
                              'zWbemPort', 'zWbemProxy', 'zWinUser',
                              'zWinPassword')
     CollectorConfigService.__init__(self, dmd, instance,
                                     deviceProxyAttributes)
 def __init__(self, dmd, instance):
     attributes = ()
     CollectorConfigService.__init__(self,
                                     dmd,
                                     instance,
                                     attributes)
     self._ds_errors = {}
 def __init__(self, dmd, instance):
     deviceProxyAttributes = ('zWmiMonitorIgnore',
                              'zWinUser',
                              'zWinPassword',
                              'zWinEventlogMinSeverity',
                              'zWinEventlogClause')
     CollectorConfigService.__init__(self, dmd, instance, deviceProxyAttributes)
 def __init__(self, dmd, instance):
     # Any additional attributes we want to send to daemon should be
     # added here
     deviceProxyAttributes = ()
     CollectorConfigService.__init__(self, dmd,
                                     instance,
                                     deviceProxyAttributes)
 def __init__(self, dmd, instance):
     self.uniqs = []
     deviceProxyAttributes = (
                              'zOpenTSDBServer',
                              'zOpenTSDBPort',
                              )
     CollectorConfigService.__init__(self, dmd, instance, deviceProxyAttributes)
 def __init__(self, dmd, instance):
     self.cimtransport = ['WMI', 'CIM']
     deviceProxyAttributes = ('zWmiMonitorIgnore',
                              'zWmiProxy',
                              'zWinUser',
                              'zWinPassword')
     CollectorConfigService.__init__(self, dmd, instance,
                                                     deviceProxyAttributes)
 def __init__(self, dmd, instance):
     deviceProxyAttributes = (
         "zCommandPort",
         "zCommandUsername",
         "zCommandPassword",
         "zCommandLoginTimeout",
         "zCommandCommandTimeout",
         "zKeyPath",
         "zSshConcurrentSessions",
     )
     CollectorConfigService.__init__(self, dmd, instance, deviceProxyAttributes)
 def __init__(self, dmd, instance):
     deviceProxyAttributes = ('zCommandPort',
                              'zCommandUsername',
                              'zCommandPassword',
                              'zCommandLoginTimeout',
                              'zCommandCommandTimeout',
                              'zKeyPath',
                              'zSshConcurrentSessions',
                             )
     CollectorConfigService.__init__(self, dmd, instance, 
                                     deviceProxyAttributes)
Beispiel #9
0
 def __init__(self, dmd, instance):
     deviceProxyAttributes = ('zCommandPort',
                              'zCommandUsername',
                              'zCommandPassword',
                              'zCommandLoginTimeout',
                              'zCommandCommandTimeout',
                              'zKeyPath',
                              'zSshConcurrentSessions',
                             )
     CollectorConfigService.__init__(self, dmd, instance, 
                                     deviceProxyAttributes)
 def __init__(self, dmd, instance):
     self.uniqs = []
     deviceProxyAttributes = (
                              'zPDZenossServer',
                              'zPDZenossUser',
                              'zPDZenossPass',
                              'zPDDomain',
                              'zPDToken',
                              'zPDUser',
                              )
     CollectorConfigService.__init__(self, dmd, instance, deviceProxyAttributes)
 def __init__(self, dmd, instance):
     self.cimtransport = ["WBEM", "CIM"]
     deviceProxyAttributes = (
         "zWbemMonitorIgnore",
         "zWbemUseSSL",
         "zWbemPort",
         "zWbemProxy",
         "zWinUser",
         "zWinPassword",
     )
     CollectorConfigService.__init__(self, dmd, instance, deviceProxyAttributes)
Beispiel #12
0
    def _filterDevice(self, device):
        # First use standard filtering.
        filter = CollectorConfigService._filterDevice(self, device)

        has_flag = False
        if filter:
            # Return only devices that have a valid
            # value for Power Data Point (Assigned by ServerMonitor ZenPack)
            try:
                if device.getRRDValue('Power') != None:
                    has_flag = True
            except Exception as e:
                print e

        return CollectorConfigService._filterDevice(self, device) and has_flag
    def _filterDevice(self, device):
        # First use standard filtering.
        filter = CollectorConfigService._filterDevice(self, device)

        has_flag = False
        if filter:
           # Return only devices that have a valid 
           # value for Power Data Point (Assigned by ServerMonitor ZenPack)
           try:
              if device.getRRDValue('Power') != None:
                 has_flag = True
           except Exception as e:
              print e

        return CollectorConfigService._filterDevice(self, device) and has_flag
Beispiel #14
0
    def _createDeviceProxy(self, device, manage_ip=None, components=(), components_only=False):
        proxy = SnmpDeviceProxy()
        proxy = CollectorConfigService._createDeviceProxy(self, device, proxy)
        proxy.snmpConnInfo = device.getSnmpConnInfo()
        if manage_ip is not None and manage_ip != device.manageIp:
            proxy._config_id = device.id + "_" + manage_ip
            proxy.snmpConnInfo.manageIp = manage_ip
        # framework expects a value for this attr but snmp task uses cycleInterval defined below
        proxy.configCycleInterval = getattr(device, 'zSnmpCollectionInterval', 300)
        # this is the attr zenperfsnmp actually uses
        proxy.cycleInterval = proxy.configCycleInterval

        proxy.name = device.id
        proxy.device = device.id
        proxy.lastmodeltime = device.getLastChangeString()
        proxy.lastChangeTime = float(device.getLastChange())

        # Gather the datapoints to retrieve
        perfServer = device.getPerformanceServer()
        proxy.oids = {}
        proxy.thresholds = []
        if not components_only:
            # First for the device....
            threshs = self._getComponentConfig(device, perfServer, proxy.oids)
            if threshs:
                proxy.thresholds.extend(threshs)
        # And now for its components
        for comp in components:
            threshs = self._getComponentConfig(comp, perfServer, proxy.oids)
            if threshs:
                proxy.thresholds.extend(threshs)

        if proxy.oids:
            return proxy
    def _createDeviceProxy(self, device):
        proxy = CollectorConfigService._createDeviceProxy(self, device)

        proxy.configCycleInterval = self._prefs.perfsnmpCycleInterval
        proxy.name = device.id
        proxy.device = device.id
        proxy.lastmodeltime = device.getLastChangeString()
        proxy.lastChangeTime = float(device.getLastChange())

        perfServer = device.getPerformanceServer()
        datasources = set()

        # First for the device....
        proxy.thresholds = []
        self._safeGetComponentConfig(device, device, perfServer,
                                datasources, proxy.thresholds)

        # And now for its components
        for comp in device.getMonitoredComponents():
            self._safeGetComponentConfig(comp, device, perfServer,
                                datasources, proxy.thresholds)

        if datasources:
            proxy.datasources = list(datasources)
            return proxy
        return None
 def _filterDevice(self, device):
     include = CollectorConfigService._filterDevice(self, device)
     zIgnore = "z%s%sMonitorIgnore" % (self.cimtransport[0][0].upper(), self.cimtransport[0][1:].lower())
     if getattr(device, zIgnore, False):
         log.debug("Device %s skipped because %s is True", device.id, zIgnore)
         include = False
     return include
Beispiel #17
0
    def _createDeviceProxy(self, device):
        proxy = CollectorConfigService._createDeviceProxy(self, device)

        proxy.configCycleInterval = self._prefs.perfsnmpCycleInterval
        proxy.name = device.id
        proxy.device = device.id
        proxy.lastmodeltime = device.getLastChangeString()
        proxy.lastChangeTime = float(device.getLastChange())

        perfServer = device.getPerformanceServer()
        datasources = set()

        # First for the device....
        proxy.thresholds = []
        self._safeGetComponentConfig(device, device, perfServer, datasources,
                                     proxy.thresholds)

        # And now for its components
        for comp in device.getMonitoredComponents():
            self._safeGetComponentConfig(comp, device, perfServer, datasources,
                                         proxy.thresholds)

        if datasources:
            proxy.datasources = list(datasources)
            return proxy
        return None
    def _createDeviceProxy(self, device, manage_ip=None, components=(), components_only=False):
        proxy = SLADeviceProxy()
        proxy = CollectorConfigService._createDeviceProxy(self, device, proxy)
        proxy.snmpConnInfo = device.getSnmpConnInfo()
        if manage_ip is not None and manage_ip != device.manageIp:
            proxy._config_id = device.id + "_" + manage_ip
            proxy.snmpConnInfo.manageIp = manage_ip
        proxy.configCycleInterval = self._prefs.perfsnmpCycleInterval
        proxy.cycleInterval = getattr(device, "zSnmpCollectionInterval", 300)
        proxy.name = device.id
        proxy.device = device.id
        proxy.lastmodeltime = device.getLastChangeString()
        proxy.lastChangeTime = float(device.getLastChange())

        # Gather the datapoints to retrieve
        perfServer = device.getPerformanceServer()
        proxy.oids = {}
        proxy.thresholds = []
        if not components_only:
            # First for the device....
            threshs = self._getComponentConfig(device, perfServer, proxy.oids)
            if threshs:
                proxy.thresholds.extend(threshs)
        # And now for its components
        for comp in components:
            threshs = self._getComponentConfig(comp, perfServer, proxy.oids)
            if threshs:
                proxy.thresholds.extend(threshs)

        if proxy.oids:
            return proxy
    def _createDeviceProxy(self, device):
        proxy = CollectorConfigService._createDeviceProxy(self, device)
        
        # for now, every device gets a single configCycleInterval based upon
        # the collector's winCycleInterval configuration which is typically
        # located at dmd.Monitors.Performance._getOb('localhost').
        # TODO: create a zProperty that allows for individual device schedules
        proxy.configCycleInterval = self._prefs.winCycleInterval
        
        proxy.services = {}
        for service in genServices(device):
            if service.isMonitored:
                running = None
                if service.getStatus() > 0:
                    running = False
                else:
                    running = True

                proxy.services[service.name] = (
                    running, service.severity, None,
                    service.getMonitoredStartModes())
                
        # don't bother adding this device proxy if there aren't any services
        # to monitor
        if not proxy.services:
            log.debug("Device %s skipped because there are no services",
                      proxy.id)
            return None
            
        return proxy
Beispiel #20
0
    def _createDeviceProxy(self, device):
        proxy = CollectorConfigService._createDeviceProxy(self, device)

        # Framework expects a default value but zencommand uses cycles per datasource instead
        proxy.configCycleInterval = 0

        proxy.name = device.id
        proxy.device = device.id
        proxy.lastmodeltime = device.getLastChangeString()
        proxy.lastChangeTime = float(device.getLastChange())

        # Only send one event per warning type
        self._sentNoUsernameSetWarning = False
        self._sentNoUsernameSetClear = False

        perfServer = device.getPerformanceServer()
        commands = set()

        # First for the device....
        proxy.thresholds = []
        self._safeGetComponentConfig(device, device, perfServer, commands,
                                     proxy.thresholds)

        # And now for its components
        for comp in device.getMonitoredComponents(collector='zencommand'):
            self._safeGetComponentConfig(comp, device, perfServer, commands,
                                         proxy.thresholds)

        if commands:
            proxy.datasources = list(commands)
            return proxy
        return None
    def _createDeviceProxy(self, device):
        proxy = CollectorConfigService._createDeviceProxy(self, device)

        # Framework expects a default value but zencommand uses cycles per datasource instead
        proxy.configCycleInterval = 0

        proxy.name = device.id
        proxy.device = device.id
        proxy.lastmodeltime = device.getLastChangeString()
        proxy.lastChangeTime = float(device.getLastChange())

        # Only send one event per warning type
        self._sentNoUsernameSetWarning = False
        self._sentNoUsernameSetClear = False

        perfServer = device.getPerformanceServer()
        commands = set()

        # First for the device....
        proxy.thresholds = []
        self._safeGetComponentConfig(device, device, perfServer,
                                commands, proxy.thresholds)

        # And now for its components
        for comp in device.getMonitoredComponents(collector='zencommand'):
            self._safeGetComponentConfig(comp, device, perfServer,
                                commands, proxy.thresholds)

        if commands:
            proxy.datasources = list(commands)
            return proxy
        return None
Beispiel #22
0
    def _createDeviceProxy(self, device):
        proxy = CollectorConfigService._createDeviceProxy(self, device)

        proxy.configCycleInterval = max(device.zWinPerfCycleSeconds, 1)
        proxy.cyclesPerConnection = max(device.zWinPerfCyclesPerConnection, 2)
        proxy.timeoutSeconds = max(device.zWinPerfTimeoutSeconds, 1)

        proxy.dpInfo = []
        proxy.thresholds = []

        perfServer = device.getPerformanceServer()

        # get the datapoints & thresholds first for the device itself
        self._getDataPointInfo(proxy, device, device.id, None, perfServer)
        proxy.thresholds += device.getThresholdInstances(WINPERF_DSTYPE)

        # and then for all of the monitored components that have them
        for comp in device.getMonitoredComponents():
            self._getDataPointInfo(proxy, comp, comp.device().id, comp.id,
                                   perfServer)
            proxy.thresholds += comp.getThresholdInstances(WINPERF_DSTYPE)

        # if there are no datapoints to be monitored then we don't need a
        # proxy to monitor this device
        if not proxy.dpInfo:
            self.log.debug("Device %s has no datapoints to be monitored",
                           device.id)
            return None

        return proxy
Beispiel #23
0
    def _createDeviceProxy(self, device):
        proxy = CollectorConfigService._createDeviceProxy(self, device)

        proxy.configCycleInterval = max(
            device.getProperty('zWinPerfCycleSeconds', 1), 1)
        proxy.cyclesPerConnection = max(
            device.getProperty('zWinPerfCyclesPerConnection', 2), 2)
        proxy.timeoutSeconds = max(
            device.getProperty('zWinPerfTimeoutSeconds', 1), 1)

        proxy.dpInfo = []
        proxy.thresholds = []

        perfServer = device.getPerformanceServer()

        # get the datapoints & thresholds first for the device itself
        self._getDataPointInfo(proxy, device, device.id, None, perfServer)
        proxy.thresholds += device.getThresholdInstances(WINPERF_DSTYPE)

        # and then for all of the monitored components that have them
        for comp in device.getMonitoredComponents():
            self._getDataPointInfo(proxy, comp,
                                   comp.device().id, comp.id, perfServer)
            proxy.thresholds += comp.getThresholdInstances(WINPERF_DSTYPE)

        # if there are no datapoints to be monitored then we don't need a
        # proxy to monitor this device
        if not proxy.dpInfo:
            self.log.debug("Device %s has no datapoints to be monitored",
                           device.id)
            return None

        return proxy
Beispiel #24
0
    def _createDeviceProxy(self, device):
        proxy = CollectorConfigService._createDeviceProxy(self, device)

        # for now, every device gets a single configCycleInterval based upon
        # the collector's winCycleInterval configuration which is typically
        # located at dmd.Monitors.Performance._getOb('localhost').
        # TODO: create a zProperty that allows for individual device schedules
        proxy.configCycleInterval = self._prefs.winCycleInterval

        proxy.services = {}
        for service in genServices(device):
            if service.isMonitored:
                running = None
                if service.getStatus() > 0:
                    running = False
                else:
                    running = True

                proxy.services[service.name] = (
                    running, service.severity, None,
                    service.getMonitoredStartModes())

        # don't bother adding this device proxy if there aren't any services
        # to monitor
        if not proxy.services:
            log.debug("Device %s skipped because there are no services",
                      proxy.id)
            return None

        return proxy
    def _createDeviceProxy(self, device):
        proxy = CollectorConfigService._createDeviceProxy(self, device)
        proxy.configCycleInterval = 3600
        proxy.name = "SEF Configuration"
        proxy.device = device.id

        return proxy
    def _createDeviceProxy(self, device):
        procs = device.getMonitoredComponents(collector='zenprocess')
        if not procs:
            log.debug("Device %s has no monitored processes -- ignoring",
                      device.titleOrId())
            return None

        proxy = CollectorConfigService._createDeviceProxy(self, device)
        proxy.configCycleInterval = self._prefs.processCycleInterval

        proxy.name = device.id
        proxy.lastmodeltime = device.getLastChangeString()
        proxy.thresholds = []
        proxy.processes = {}
        proxy.snmpConnInfo = device.getSnmpConnInfo()
        for p in procs:
            # Find out which datasources are responsible for this process
            # if SNMP is not responsible, then do not add it to the list
            snmpMonitored = False
            for rrdTpl in p.getRRDTemplates():
                if len(rrdTpl.getRRDDataSources("SNMP")) > 0:
                    snmpMonitored = True
                    break

            # In case the process is not SNMP monitored
            if not snmpMonitored:
                log.debug(
                    "Skipping process %r - not an SNMP monitored process", p)
                continue
            # In case the catalog is out of sync above
            if not p.monitored():
                log.debug("Skipping process %r - zMonitor disabled", p)
                continue
            regex = getattr(p.osProcessClass(), 'regex', False)
            if regex:
                try:
                    re.compile(regex)
                except sre_constants.error, ex:
                    log.warn(
                        "OS process class %s has an invalid regex (%s): %s",
                        p.getOSProcessClass(), regex, ex)
                    continue
            else:
                log.warn(
                    "OS process class %s has no defined regex, this process not being monitored",
                    p.getOSProcessClass())
                continue

            proc = ProcessProxy()
            proc.regex = regex
            proc.name = p.id
            proc.originalName = p.name()
            proc.ignoreParameters = (getattr(p.osProcessClass(),
                                             'ignoreParameters', False))
            proc.restart = p.alertOnRestart()
            proc.severity = p.getFailSeverity()
            proc.processClass = p.getOSProcessClass()
            proxy.processes[p.id] = proc
            proxy.thresholds.extend(p.getThresholdInstances('SNMP'))
 def __init__(self, dmd, instance):
     deviceProxyAttributes = (
         "zMaxOIDPerRequest",
         "zSnmpMonitorIgnore",
         "zSnmpAuthPassword",
         "zSnmpAuthType",
         "zSnmpCommunity",
         "zSnmpPort",
         "zSnmpPrivPassword",
         "zSnmpPrivType",
         "zSnmpSecurityName",
         "zSnmpTimeout",
         "zSnmpTries",
         "zSnmpVer",
         "zSnmpCollectionInterval",
     )
     CollectorConfigService.__init__(self, dmd, instance, deviceProxyAttributes)
Beispiel #28
0
    def _filterDevice(self, device):
        include = CollectorConfigService._filterDevice(self, device)
        hasTcpComponents = False
        for svc in device.getMonitoredComponents(collector='zenstatus'):
            if svc.getProtocol() == "tcp":
                hasTcpComponents = True

        return include and hasTcpComponents
    def _filterDevice(self, device):
        include = CollectorConfigService._filterDevice(self, device)
        hasTcpComponents = False
        for svc in device.getMonitoredComponents(collector='zenstatus'):
            if svc.getProtocol() == "tcp":
                hasTcpComponents = True

        return include and hasTcpComponents
Beispiel #30
0
    def _createDeviceProxy(self, device):
        proxy = CollectorConfigService._createDeviceProxy(self, device)
        proxy.configCycleInterval = 3600
        proxy.name = "Syslog Configuration"
        proxy.device = device.id

        proxy.defaultPriority = self.zem.defaultPriority
        return proxy
 def _filterDevice(self, device):
     include = CollectorConfigService._filterDevice(self, device)
     zIgnore = 'z%s%sMonitorIgnore'%(self.cimtransport[0][0].upper(),
                                     self.cimtransport[0][1:].lower()) 
     if getattr(device, zIgnore, False):
         log.debug("Device %s skipped because %s is True", device.id,zIgnore)
         include = False
     return include
Beispiel #32
0
 def __init__(self, dmd, instance):
     deviceProxyAttributes = ('zMaxOIDPerRequest',
                              'zSnmpMonitorIgnore',
                              'zSnmpAuthPassword',
                              'zSnmpAuthType',
                              'zSnmpCommunity',
                              'zSnmpPort',
                              'zSnmpPrivPassword',
                              'zSnmpPrivType',
                              'zSnmpSecurityName',
                              'zSnmpTimeout',
                              'zSnmpTries',
                              'zSnmpVer',
                              'zSnmpCollectionInterval',
                             )
     CollectorConfigService.__init__(self, dmd, instance, 
                                     deviceProxyAttributes)
 def _createDeviceProxy(self, device):
     proxy = CollectorConfigService._createDeviceProxy(self, device)
     log.debug("creating proxy for device %s" % device.id)
     proxy.configCycleInterval = 300
     proxy.device = device.id
     proxy.tsdbServer = device.zOpenTSDBServer
     proxy.tsdbPort = device.zOpenTSDBPort
     return proxy
Beispiel #34
0
    def _createDeviceProxy(self, device):
        proxy = CollectorConfigService._createDeviceProxy(self, device)

        # for now, every device gets a single configCycleInterval based upon
        # the collector's eventlogCycleInterval configuration.
        # TODO: create a zProperty that allows for individual device schedules
        proxy.configCycleInterval = self._prefs.eventlogCycleInterval

        return proxy
    def _createDeviceProxy(self, device):
        proxy = CollectorConfigService._createDeviceProxy(self, device)

        # for now, every device gets a single configCycleInterval based upon
        # the collector's eventlogCycleInterval configuration.
        # TODO: create a zProperty that allows for individual device schedules
        proxy.configCycleInterval = self._prefs.eventlogCycleInterval

        return proxy
 def _filterDevice(self, device):
     include = CollectorConfigService._filterDevice(self, device)
     
     if getattr(device, 'zWmiMonitorIgnore', False):
         self.log.debug("Device %s skipped because zWmiMonitorIgnore is True",
                        device.id)
         include = False
         
     return include
    def _createDeviceProxy(self, device):
        procs = device.getMonitoredComponents(collector='zenprocess')
        if not procs:
            log.debug("Device %s has no monitored processes -- ignoring",
                      device.titleOrId())
            return None

        proxy = CollectorConfigService._createDeviceProxy(self, device)
        proxy.configCycleInterval = self._prefs.processCycleInterval

        proxy.name = device.id
        proxy.lastmodeltime = device.getLastChangeString()
        proxy.thresholds = []
        proxy.processes = {}
        proxy.snmpConnInfo = device.getSnmpConnInfo()
        for p in procs:
            # Find out which datasources are responsible for this process
            # if SNMP is not responsible, then do not add it to the list
            snmpMonitored = False
            for rrdTpl in p.getRRDTemplates():
                if len(rrdTpl.getRRDDataSources("SNMP")) > 0:
                    snmpMonitored = True
                    break

            # In case the process is not SNMP monitored
            if not snmpMonitored:
                log.debug("Skipping process %r - not an SNMP monitored process", p)
                continue
            # In case the catalog is out of sync above
            if not p.monitored():
                log.debug("Skipping process %r - zMonitor disabled", p)
                continue
            regex = getattr(p.osProcessClass(), 'regex', False)
            if regex:
                try:
                    re.compile(regex)
                except sre_constants.error, ex:
                    log.warn("OS process class %s has an invalid regex (%s): %s",
                             p.getOSProcessClass(), regex, ex)
                    continue
            else:
                log.warn("OS process class %s has no defined regex, this process not being monitored",
                         p.getOSProcessClass())
                continue

            proc = ProcessProxy()
            proc.regex = regex
            proc.name = p.id
            proc.originalName = p.name()
            proc.ignoreParameters = (
                getattr(p.osProcessClass(), 'ignoreParameters', False))
            proc.restart = p.alertOnRestart()
            proc.severity = p.getFailSeverity()
            proc.processClass = p.getOSProcessClass()
            proxy.processes[p.id] = proc
            proxy.thresholds.extend(p.getThresholdInstances('SNMP'))
 def _filterDevice(self, device):
     '''only need config for one (or more if multiple tsdb servers)device'''
     log.debug("examining device %s" % device)
     filter = CollectorConfigService._filterDevice(self, device)
     #return filter
     dataset = device.zOpenTSDBServer
     if dataset not in self.uniqs and device.productionState!= -1:
         self.uniqs.append(dataset)
         log.debug("found device %s" % device)
         return filter
    def _filterDevice(self, device):
        include = CollectorConfigService._filterDevice(self, device)
        hasTcpComponents = False
        if include:
            for svc in device.getMonitoredComponents(collector='zenstatus'):
                if svc.getProtocol() in TCP_PROTOCOLS:
                    hasTcpComponents = True
                    break

        return include and hasTcpComponents
    def _filterDevice(self, device):
        include = CollectorConfigService._filterDevice(self, device)
        hasTcpComponents = False
        if include:
            for svc in device.getMonitoredComponents(collector='zenstatus'):
                if svc.getProtocol() in TCP_PROTOCOLS:
                    hasTcpComponents = True
                    break

        return include and hasTcpComponents
Beispiel #41
0
    def _filterDevice(self, device):
        include = CollectorConfigService._filterDevice(self, device)

        if getattr(device, 'zWmiMonitorIgnore', False):
            self.log.debug(
                "Device %s skipped because zWmiMonitorIgnore is True",
                device.id)
            include = False

        return include
    def _filterDevice(self, device):
        # First use standard filtering.
        filter = CollectorConfigService._filterDevice(self, device)

        # If the standard filtering logic said the device shouldn't be filtered
        # we can setup some other contraint.
        if filter:
            # We only monitor devices that start with "z".
            return device.id.startswith('z')

        return filter
 def _filterDevice(self, device):
     ''''''
     log.debug("filtering for %s" % device.id)
     filter = CollectorConfigService._filterDevice(self, device)
     if filter:
         if len(device.os.siebelComponents()) > 0:
             log.debug("Device %s included for Siebel collection",device.id)
             return True
         else:
             return False
     return False
Beispiel #44
0
    def _createDeviceProxy(self, device):
        proxy = CollectorConfigService._createDeviceProxy(self, device)

        proxy.configCycleInterval = 5 * 60  # 5 minutes
        proxy.datapoints = []

        perfServer = device.getPerformanceServer()

        self._getPowerDp(proxy, device, device.id, None, perfServer)

        return proxy
    def _filterDevice(self, device):
        # First use standard filtering.
        filter = CollectorConfigService._filterDevice(self, device)

        # If the standard filtering logic said the device shouldn't be filtered
        # we can setup some other contraint.
        if filter:
            # We only monitor devices that start with "z".
            return device.id.startswith('z')

        return filter
    def _createDeviceProxy(self, device):
        proxy = CollectorConfigService._createDeviceProxy(self, device)
        
        proxy.configCycleInterval = 5 * 60 # 5 minutes
        proxy.datapoints = []

        perfServer = device.getPerformanceServer()

        self._getPowerDp(proxy, device, device.id, None, perfServer)

        return proxy
Beispiel #47
0
    def _createDeviceProxy(self, device):
        proxy = CollectorConfigService._createDeviceProxy(self, device)
        proxy.configCycleInterval = 3600
        proxy.name = "SNMP Trap Configuration"
        proxy.device = device.id

        # Gather all OID -> Name mappings from /Mibs catalog
        proxy.oidMap = dict(
            (b.oid, b.id) for b in self.dmd.Mibs.mibSearch() if b.oid)

        return proxy
Beispiel #48
0
    def _createDeviceProxy(self, device):
        proxy = CollectorConfigService._createDeviceProxy(self, device)
        proxy.datasources = []

        for template in device.getRRDTemplates():
            for ds in template.getRRDDataSources():
                if ds.sourcetype == 'MAILTX' and \
                   self._checkMailTxDs(device.id, template, ds):
                    proxy.datasources.append(Config(device, template, ds))

        if proxy.datasources:
            return proxy
Beispiel #49
0
    def _filterDevice(self, device):
        include = CollectorConfigService._filterDevice(self, device)

        if getattr(device, 'zSnmpMonitorIgnore', False):
            self.log.debug("Device %s skipped because zSnmpMonitorIgnore is True",
                           device.id)
            include = False

        if not device.getManageIp():
            self.log.debug("Device %s skipped because its management IP address is blank.",
                           device.id)
            include = False

        return include
    def _filterDevice(self, device):
        include = CollectorConfigService._filterDevice(self, device)

        if not device.monitorDevice():
            include = False

        if device.zPingMonitorIgnore:
            include = False

        if not device.getManageIp():
            self.log.debug("Device %s skipped because its management IP address is blank.",
                           device.id)
            include = False

        return include
Beispiel #51
0
    def _createDeviceProxy(self, device):
        proxy = CollectorConfigService._createDeviceProxy(self, device)

        # for now, every device gets a single configCycleInterval based upon
        # the collector's winCycleInterval configuration which is typically
        # located at dmd.Monitors.Performance._getOb('localhost').
        # TODO: create a zProperty that allows for individual device schedules
        proxy.configCycleInterval = self._prefs.perfsnmpCycleInterval
        proxy.queries, proxy.datapoints, proxy.thresholds = getWbemDeviceConfig(
            self.cimtransport, device)
        if not proxy.queries:
            log.debug("Device %s skipped because there are no datasources",
                      device.getId())
            return None
        return proxy
Beispiel #52
0
    def _filterDevice(self, device):
        include = CollectorConfigService._filterDevice(self, device)

        # WMI ~= PerfMon, but eh
        if getattr(device, 'zWmiMonitorIgnore', False):
            self.log.debug("Device %s skipped because zWmiMonitorIgnore is on",
                           device.id)
            include = False

        # No credentials: we'll never login anyhow
        elif not device.zWinUser:
            self.log.debug("Device %s skipped because zWinUser is not set",
                           device.id)
            include = False

        return include
Beispiel #53
0
    def _createDeviceProxy(self, device):
        proxy = CollectorConfigService._createDeviceProxy(self, device)

        proxy.name = device.id
        proxy.device = device.id
        proxy.lastmodeltime = device.getLastChangeString()
        proxy.lastChangeTime = float(device.getLastChange())

        perfServer = device.getPerformanceServer()
        proxy.thresholds = []
        proxy.monitoredIps = []
        connectedIps = []
        for iface in device.os.interfaces():
            self._getComponentConfig(iface, perfServer, proxy.monitoredIps)
            threshs = iface.getThresholdInstances('PING')
            if threshs:
                proxy.thresholds.extend(threshs)

            for ipAddress in iface.ipaddresses():
                ip = ipAddress.id
                if ip and ip not in ('127.0.0.1', '0.0.0.0', '::',
                                     '::1') and ip != device.manageIp:
                    # tuple of ip, interface id
                    connectedIps.append((
                        ip,
                        iface.id,
                    ))
        proxy.connectedIps = connectedIps

        if not proxy.monitoredIps:
            log.debug(
                "%s has no interface templates -- just using management IP %s",
                device.titleOrId(), device.manageIp)
            self._addManageIp(device, perfServer, proxy)

        elif device.manageIp not in [x.ip for x in proxy.monitoredIps]:
            # Note: most commonly occurs for SNMP fakeout devices which replay
            #       data from real devices, but from a different IP address
            #       than what captured the data
            log.debug("%s doesn't have an interface for management IP %s",
                      device.titleOrId(), device.manageIp)
            self._addManageIp(device, perfServer, proxy)

        return proxy
Beispiel #54
0
    def _createDeviceProxy(self, device):
        collector = device.getPerformanceServer()

        proxy = CollectorConfigService._createDeviceProxy(self, device)
        proxy.datasources = []
        proxy.thresholds = []
        proxy.zOpenStackProcessEventTypes = device.zOpenStackProcessEventTypes
        proxy.zOpenStackIncrementalShortLivedSeconds = device.zOpenStackIncrementalShortLivedSeconds
        proxy.zOpenStackIncrementalBlackListSeconds = device.zOpenStackIncrementalBlackListSeconds
        proxy.zOpenStackIncrementalConsolidateSeconds = device.zOpenStackIncrementalConsolidateSeconds

        for component in device.getMonitoredComponents():
            proxy.datasources += list(
                self.component_datasources(component, collector))

            proxy.thresholds += component.getThresholdInstances(
                PerfAMQPDataSource.sourcetype)

        return proxy
Beispiel #55
0
    def _createDeviceProxy(self, device):
        collector = device.getPerformanceServer()

        proxy = CollectorConfigService._createDeviceProxy(self, device)
        proxy.datasources = list(self.device_datasources(device, collector))

        # getTresholdInstances needs the datasource sourcetype string.
        proxy.thresholds = self._thresholds(device)

        for component in device.getMonitoredComponents():
            proxy.datasources += list(
                self.component_datasources(component, collector))

            proxy.thresholds += self._thresholds(component)

        if len(proxy.datasources) > 0:
            return proxy

        return None
Beispiel #56
0
    def _createDeviceProxy(self, device):
        proxy = CollectorConfigService._createDeviceProxy(self, device)
        proxy.configCycleInterval = self._prefs.statusCycleInterval

        # add each component
        proxy.components = []
        for svc in device.getMonitoredComponents(collector='zenstatus'):
            if svc.getProtocol() == 'tcp':
                # get component status
                status = svc.getStatus(Status_IpService)
                proxy.components.append(ServiceProxy(svc, status))

        # don't bother adding this device proxy if there aren't any services
        # to monitor
        if not proxy.components:
            log.debug("Device %s skipped because there are no components",
                      proxy.id)
            return None

        return proxy
    def _createDeviceProxy(self, device, proxy=None):
        proxy = CollectorConfigService._createDeviceProxy(self,
                                                          device,
                                                          proxy=proxy)

        proxy.datapoints = []
        proxy.thresholds = []

        perfServer = device.getPerformanceServer()

        self._getDataPoints(proxy, device, device, perfServer)
        proxy.thresholds += device.getThresholdInstances('Example Protocol')

        for component in device.getMonitoredComponents():
            self._getDataPoints(proxy, device, component, perfServer)

            proxy.thresholds += component.getThresholdInstances(
                'Example Protocol')

        return proxy
Beispiel #58
0
    def _createDeviceProxy(self, device, proxy=None):
        procs = device.getMonitoredComponents(collector='zenprocess')
        if not procs:
            log.debug("Device %s has no monitored processes -- ignoring",
                      device.titleOrId())
            return None

        proxy = CollectorConfigService._createDeviceProxy(
            self, device, proxy=proxy)

        proxy.configCycleInterval = self._prefs.processCycleInterval

        proxy.name = device.id
        proxy.lastmodeltime = device.getLastChangeString()
        proxy.thresholds = []
        proxy.processes = {}
        proxy.snmpConnInfo = device.getSnmpConnInfo()
        for p in procs:
            tags = {}

            # Find out which datasources are responsible for this process
            # if SNMP is not responsible, then do not add it to the list
            snmpMonitored = False
            for rrdTpl in p.getRRDTemplates():
                for datasource in rrdTpl.getRRDDataSources("SNMP"):
                    snmpMonitored = True

                    # zenprocess doesn't consider each datapoint's
                    # configuration. It assumes a static list of datapoints. So
                    # we will combine tags from all datapoints and use them for
                    # all datapoints.
                    for datapoint in datasource.getRRDDataPoints():
                        tags.update(datapoint.getTags(p))

            # In case the process is not SNMP monitored
            if not snmpMonitored:
                log.debug("Skipping process %r - not an SNMP monitored process", p)
                continue
            # In case the catalog is out of sync above
            if not p.monitored():
                log.debug("Skipping process %r - zMonitor disabled", p)
                continue
            includeRegex = getattr(p.osProcessClass(), 'includeRegex', False)
            excludeRegex = getattr(p.osProcessClass(), 'excludeRegex', False)
            replaceRegex = getattr(p.osProcessClass(), 'replaceRegex', False)
            replacement  = getattr(p.osProcessClass(), 'replacement', False)
            generatedId  = getattr(p, 'generatedId', False)
            primaryUrlPath = getattr(p.osProcessClass(), 'processClassPrimaryUrlPath', False)
            if primaryUrlPath: primaryUrlPath = primaryUrlPath()

            if not includeRegex:
                log.warn("OS process class %s has no defined regex, this process not being monitored",
                         p.getOSProcessClass())
                continue
            bad_regex = False
            for regex in [includeRegex, excludeRegex, replaceRegex]:
                if regex:
                    try:
                        re.compile(regex)
                    except re.error as ex:
                        log.warn(
                            "OS process class %s has an invalid regex (%s): %s",
                            p.getOSProcessClass(), regex, ex)
                        bad_regex = True
                        break
            if bad_regex:
                continue

            proc = ProcessProxy()
            proc.metadata = p.getMetricMetadata()
            proc.tags = tags
            proc.includeRegex = includeRegex
            proc.excludeRegex = excludeRegex
            proc.replaceRegex = replaceRegex
            proc.replacement = replacement
            proc.primaryUrlPath = primaryUrlPath
            proc.generatedId = generatedId
            proc.name = p.id
            proc.originalName = p.name()
            proc.restart = p.alertOnRestart()
            proc.severity = p.getFailSeverity()
            proc.processClass = p.getOSProcessClass()
            proxy.processes[p.id] = proc
            proxy.thresholds.extend(p.getThresholdInstances('SNMP'))

        if proxy.processes:
            return proxy