def process(self, device, results, log):
        '''
        process oid
        '''

        log = log
        device = device
        temp_sensors = results[1].get('hmmFanTable', {})

        relmap = self.relMap()
        for snmpindex, row in temp_sensors.items():
            name = 'Fan_' + str(row.get('fanIndex'))
            if not name:
                log.warn('Skipping temperature sensor with no name')
                continue
            if 1 != int(row.get('fanPresence')):
                continue

            relmap.append(
                self.objectMap({
                    'id':
                    self.prepId(name),
                    'title':
                    name,
                    'snmpindex':
                    snmpindex.strip('.'),
                    'hfpresence':
                    HMMPRESENCE.get(row.get('fanPresence'), 'unknown'),
                    'hfspeed':
                    row.get('fanSpeed'),
                    'hfstatus':
                    HMMSTATUS.get(row.get('fanStatus'), 'unknown'),
                }))

        return relmap
Ejemplo n.º 2
0
    def process(self, device, results, log):
        '''
        process oid
        '''

        log = log
        device = device
        getdata = results[0]

        verstr = getdata.get('softwareVersion')
        verstrlist = verstr.split('\r\n')
        softwareversion = ''
        ubootversion = ''
        cpldversion = ''
        fpgaversion = ''

        for idx in verstrlist:
            if idx.find('Uboot    Version :') != -1:
                ubootversion = idx[idx.find('Uboot    Version :') + 18:]
            if idx.find('CPLD     Version :') != -1:
                cpldversion = idx[idx.find('CPLD     Version :') + 18:]
            if idx.find('FPGA     Version :') != -1:
                fpgaversion = idx[idx.find('FPGA     Version :') + 18:]
            if idx.find('Software Version :') != -1:
                softwareversion = idx[idx.find('Software Version :') + 18:]
        relmap = self.relMap()
        relmap.append(
            self.objectMap({
                'id':
                self.prepId('SMM_1'),
                'title':
                'SMM_1',
                'hsProductName':
                getdata.get('smmProductName'),
                'hsSoftwareVersion':
                softwareversion,
                'hsUbootVersion':
                ubootversion,
                'hsCPLDVersion':
                cpldversion,
                'hsFPGAVersion':
                fpgaversion,
                'hsPresence':
                HMMPRESENCE.get(getdata.get('smmPresence'), 'unknown'),
                'hsHostname':
                getdata.get('smmHostname'),
                'hsHealth':
                HMMHEALTH.get(getdata.get('smmHealth'), 'unknown'),
            }))
        return relmap
    def process(self, device, results, log):
        '''
        process oid
        '''

        log = log
        device = device
        temp_sensors = results[1].get('hmmPowerSupplyTable', {})

        getdata = results[0]
        psumap = {}

        #         psu_tables = results[1].get('hmmPSUTable', {})
        #         for snmpindex, row in psu_tables.items():
        #             name = str(row.get('psuIndex'))
        #             if not name:
        #                 log.warn('Skipping hmmPowerSupplyTable with no name')
        #                 continue
        #
        #             psumap[int(name)] = [HMMLOCATION.get(row.get('psuLocation'), ''),
        #                                  HMMSTATUS.get(row.get('psuHealth'), 'normal')]

        for row in range(1, 7):
            rindex = 'psuIndex' + str(row)
            rlocation = 'psuLocation' + str(row)
            rhealth = 'psuHealth' + str(row)
            psumap[row] = [
                HMMLOCATION.get(getdata.get(rlocation), ''),
                HMMSTATUS.get(getdata.get(rhealth), 'normal')
            ]

        relmap = self.relMap()
        for snmpindex, row in temp_sensors.items():
            name = str(row.get('powerIndex'))
            if not name:
                log.warn('Skipping hmmPSUTable with no name')
                continue
            if 1 != int(row.get('powerPresence')):
                continue

            psustatus = ''
            psulocation = ''
            # 2018-01-12 djg fixed psu[1... and powersuperly[0... in same row.
            psuidx = int(name) + 1
            if (psuidx) in psumap:
                psulocation = psumap[psuidx][0]
                psustatus = psumap[psuidx][1]

            relmap.append(
                self.objectMap({
                    'id':
                    self.prepId('PS_' + name),
                    'title':
                    'PS_' + name,
                    'snmpindex':
                    snmpindex.strip('.'),
                    'hpspresence':
                    HMMPRESENCE.get(row.get('powerPresence'), 'unknown'),
                    'hpsratingPower':
                    row.get('powerRatingPower'),
                    'hpsruntimePower':
                    row.get('powerRuntimePower'),
                    'hpsstatus':
                    psustatus,
                    'hpslocation':
                    psulocation,
                    'hpspowerMode':
                    HMMPOWERMODE.get(row.get('powerMode'),
                                     row.get('powerMode')),
                }))

        return relmap