def process(self, device, results, log):
        """collect snmp information from this device"""
        log.info('processing %s for device %s', self.name(), device.id)
        getdata, tabledata = results
        f_tbl = results[1].get('FanTable', {})

        # if no no comps found exit
        if not f_tbl:
            log.info('%s NOT found on device %s ---- skipping Model' % (self.relname, device.id))
            return None

        rm = self.relMap()

        for snmpindex, row in f_tbl.items():
            om = self.objectMap(row)

            # there are IOS bugs out there where sensors will not get names
            # guard against this condition
            if om.title == '':
                om.title = 'Unknown-(probable IOS bug)'

            if match_exclude_regex(device, om.title, self.maptype, log):
                continue

            om.id = self.prepId(om.title)
            om.state = decode_envmon_state(om.state)
            om.snmpindex = snmpindex.strip('.')
            rm.append(om)
        return rm
예제 #2
0
    def process(self, device, results, log):
        """collect snmp information from this device"""
        log.info('processing %s for device %s', self.name(), device.id)

        f_tbl = results[1].get('FanTable', {})

        # if no no comps found exit
        if not f_tbl:
            log.info('%s NOT found on device %s ---- skipping Model' % (self.relname, device.id))
            return None

        rm = self.relMap()

        for snmpindex, row in f_tbl.items():
            om = self.objectMap(row)

            # there are IOS bugs out there where sensors will not get names
            # guard against this condition
            if om.title == '':
                om.title = 'Unknown-(probable IOS bug)'

            if match_exclude_regex(device, om.title, self.maptype, log):
                continue

            om.id = self.prepId(om.title)
            om.state = decode_envmon_state(om.state)
            om.snmpindex = snmpindex.strip('.')
            rm.append(om)

        if rm.maps:
            log.info('Found %d CiscoEnvMonFans' % len(rm.maps))
        else:
            log.info('No CiscoEnvMonFans Found')

        return rm
    def process(self, device, results, log):
        """collect snmp information from this device"""
        log.info("processing %s for device %s", self.name(), device.id)
        getdata, tabledata = results
        p_tbl = results[1].get("PowerSupplyTable", {})

        # if no no comps found exit
        if not p_tbl:
            log.info("%s NOT found on device %s ---- skipping Model" % (self.relname, device.id))
            return None

        rm = self.relMap()

        for snmpindex, row in p_tbl.items():
            om = self.objectMap(row)

            # there are IOS bugs out there where sensors will not get names
            # guard against this condition
            if om.title == "":
                om.title = "Unknown-(probable IOS bug)"

            if match_exclude_regex(device, om.title, self.maptype, log):
                continue

            if hasattr(om, "supply_source"):
                om.supply_source = decode_ps_source(om.supply_source)
            else:
                om.supply_source = "Not Reported"
                om.snmpindex = snmpindex.strip(".")

            om.id = self.prepId(om.title)
            om.state = decode_envmon_state(om.state)
            om.snmpindex = snmpindex.strip(".")
            rm.append(om)
        return rm
예제 #4
0
def envmon_status_handler(device, component, evt, log=log):
    """
    Update status properties in the model based on build in
    Zenoss status thresholds
    """

    if not device or not component:
        return

    # prevent non min-max thresholds from triggering state change
    # and prevent tracebacks from newly discovered devices
    if not getattr(evt, 'current', None):
        return

    if not component.hasProperty('state'):
        return

    maybe_new_state = decode_envmon_state(int(float(evt.current)))

    if not getattr(component, 'state') == maybe_new_state:
        setattr(component, 'state', maybe_new_state)

    if device.zCiscoMonIgnoreNotPresent and component.state == 'notPresent':
        evt.severity = 2

    evt.summary = evt.message = "Cisco Hardware Alert, %s\
        Changed status to: %s" % (component.meta_type, maybe_new_state)
def envmon_status_handler(device, component, evt, log=log):
    '''
    Update status properties in the model based on build in
    Zenoss status thresholds
    '''

    if not device or not component:
        return

    # prevent non min-max thresholds from triggering state change
    # and prevent tracebacks from newly discovered devices
    if not getattr(evt, 'current', None):
        return

    if not component.hasProperty('state'):
        return

    maybe_new_state = decode_envmon_state(int(float(evt.current)))

    if not getattr(component, 'state') == maybe_new_state:
        setattr(component, 'state', maybe_new_state)

    if device.zCiscoMonIgnoreNotPresent and component.state == 'notPresent':
        evt.severity = 2

    evt.summary = evt.message = "Cisco Hardware Alert, %s\
        Changed status to: %s" % (component.meta_type, maybe_new_state)
    def process(self, device, results, log):
        """collect snmp information from this device"""

        log.info('processing %s for device %s', self.name(), device.id)

        # if no no comps found exit
        t_tbl = results[1].get('TemperatureTable', {})
        if not t_tbl:
            log.info('%s NOT found on device %s ---- skipping Model' %
                     (self.relname, device.id))
            return None

        rm = self.relMap()

        for snmpindex, row in t_tbl.items():
            om = self.objectMap(row)

            # there are IOS bugs out there where sensors will not get names
            # guard against this condition
            if om.title == '':
                om.title = 'Unknown-(probable IOS bug)'
                log.info(
                    'Not getting temperature sensor names correctly, may be IOS bug'
                )

            # for some reason Cisco appends the current status to the name of the component
            # strip this off as is makes attaching traps etc very difficult
            om.title = re.sub(r', (RED|YELLOW|GREEN)$', '', om.title)
            om.title = om.title.rstrip(', YELLOW').rstrip(', RED').rstrip(
                ', GREEN')

            if match_exclude_regex(device, om.title, self.maptype, log):
                continue

            om.id = self.prepId(om.title)
            om.state = decode_envmon_state(om.state)
            om.snmpindex = snmpindex.strip('.')

            # you can get some crazy values for this...do a sanity check
            ts = getattr(om, 'temperature_threshold', '')
            if not ts or ts <= 0 or ts >= 750:
                om.temperature_threshold = str(maxint / 2)

            rm.append(om)

        if rm.maps:
            log.info('Found %d CiscoEnvMonTemperaturSensors' % len(rm.maps))
        else:
            log.info('No CiscoEnvMonTemperaturSensors Found')

        return rm
예제 #7
0
    def process(self, device, results, log):
        """collect snmp information from this device"""
        log.info('processing %s for device %s', self.name(), device.id)

        v_tbl = results[1].get('VoltageStatusTable', {})

        # if no no comps found exit
        if not v_tbl:
            log.info('%s NOT found on device %s ---- skipping Model' %
                     (self.relname, device.id))
            return None

        rm = self.relMap()

        for snmpindex, row in v_tbl.items():
            om = self.objectMap(row)

            # there are IOS bugs out there where sensors will not get names
            # guard against this condition
            if om.title == '':
                om.title = 'Unknown-(probable IOS bug)'

            if match_exclude_regex(device, om.title, self.maptype, log):
                continue

            om.title = om.title.strip(' in mV')
            om.id = self.prepId(om.title)
            om.state = decode_envmon_state(om.state)
            om.snmpindex = snmpindex.strip('.')

            # you can get some crazy values for this...do a sanity check
            vsh = getattr(om, 'voltage_threshold_high', '')
            if not vsh or vsh <= 0 or vsh >= 10000:
                om.voltage_threshold_high = str(maxint / 2)

            # you can get some crazy values for this...do a sanity check
            vsl = getattr(om, 'voltage_threshold_low', '')
            if not vsl or vsl <= 0:
                om.voltage_threshold_low = str((-maxint - 1) / 2)

            rm.append(om)

        if rm.maps:
            log.info('Found %d CiscoEnvMonVoltageSensors' % len(rm.maps))
        else:
            log.info('No CiscoEnvMonFans Found')

        return rm
    def process(self, device, results, log):
        """collect snmp information from this device"""

        log.info("processing %s for device %s", self.name(), device.id)
        getdata, tabledata = results

        # if no no comps found exit
        t_tbl = results[1].get("TemperatureTable", {})
        if not t_tbl:
            log.info("%s NOT found on device %s ---- skipping Model" % (self.relname, device.id))
            return None

        rm = self.relMap()

        for snmpindex, row in t_tbl.items():
            om = self.objectMap(row)

            # there are IOS bugs out there where sensors will not get names
            # guard against this condition
            if om.title == "":
                om.title = "Unknown-(probable IOS bug)"
                log.info("Not getting temperature sensor names correctly, may be IOS bug")

            # for some reason Cisco appends the current status to the name of the component
            # strip this off as is makes attaching traps etc very difficult
            om.title = re.sub(r", (RED|YELLOW|GREEN)$", "", om.title)
            om.title = om.title.rstrip(", YELLOW").rstrip(", RED").rstrip(", GREEN")

            if match_exclude_regex(device, om.title, self.maptype, log):
                continue

            om.id = self.prepId(om.title)
            om.state = decode_envmon_state(om.state)
            om.snmpindex = snmpindex.strip(".")

            # you can get some crazy values for this...do a sanity check
            ts = getattr(om, "temperature_threshold", "")
            if not ts or ts <= 0 or ts >= 750:
                om.temperature_threshold = str(maxint / 2)

            rm.append(om)
        return rm
    def process(self, device, results, log):
        """collect snmp information from this device"""
        log.info('processing %s for device %s', self.name(), device.id)
        getdata, tabledata = results
        v_tbl = results[1].get('VoltageStatusTable', {})

        # if no no comps found exit
        if not v_tbl:
            log.info('%s NOT found on device %s ---- skipping Model' % (self.relname, device.id))
            return None

        rm = self.relMap()

        for snmpindex, row in v_tbl.items():
            om = self.objectMap(row)

            # there are IOS bugs out there where sensors will not get names
            # guard against this condition
            if om.title == '':
                om.title = 'Unknown-(probable IOS bug)'

            if match_exclude_regex(device, om.title, self.maptype, log):
                continue

            om.title = om.title.strip(' in mV')
            om.id = self.prepId(om.title)
            om.state = decode_envmon_state(om.state)
            om.snmpindex = snmpindex.strip('.')

            # you can get some crazy values for this...do a sanity check
            vsh = getattr(om, 'voltage_threshold_high', '')
            if not vsh or vsh <= 0 or vsh >= 10000:
               om.voltage_threshold_high = str(maxint/2)

            # you can get some crazy values for this...do a sanity check
            vsl = getattr(om, 'voltage_threshold_low', '')
            if not vsl or vsl <= 0:
               om.voltage_threshold_low = str((-maxint-1)/2)

            rm.append(om)
        return rm