(self)
Collector for getting count of consistancy points
Collector for getting count of consistancy points
Collector for getting count of consistancy points
def consistency_point(self):
        """ Collector for getting count of consistancy points
        """

        cp_delta = {}
        xml_path = 'instances/instance-data/counters'
        netapp_api = NaElement('perf-object-get-instances')
        netapp_api.child_add_string('objectname', 'wafl')
        instance = NaElement('instances')
        instance.child_add_string('instance', 'wafl')
        counter = NaElement('counters')
        counter.child_add_string('counter', 'cp_count')
        netapp_api.child_add(counter)
        netapp_api.child_add(instance)

        cp_1 = self.get_netapp_elem(netapp_api, xml_path)
        time.sleep(3)
        cp_2 = self.get_netapp_elem(netapp_api, xml_path)

        for element in cp_1:
            if element.find('name').text == 'cp_count':
                cp_1 = element.find('value').text.rsplit(',')
                break
        for element in cp_2:
            if element.find('name').text == 'cp_count':
                cp_2 = element.find('value').text.rsplit(',')
                break

        if not type(cp_2) is list or not type(cp_1) is list:
            log.error("consistency point data not available for filer: %s"
                      % self.device)
            return

        cp_1 = {
            'wafl_timer': cp_1[0],
            'snapshot': cp_1[1],
            'wafl_avail_bufs': cp_1[2],
            'dirty_blk_cnt': cp_1[3],
            'full_nv_log': cp_1[4],
            'b2b': cp_1[5],
            'flush_gen': cp_1[6],
            'sync_gen': cp_1[7],
            'def_b2b': cp_1[8],
            'con_ind_pin': cp_1[9],
            'low_mbuf_gen': cp_1[10],
            'low_datavec_gen': cp_1[11]
        }

        cp_2 = {
            'wafl_timer': cp_2[0],
            'snapshot': cp_2[1],
            'wafl_avail_bufs': cp_2[2],
            'dirty_blk_cnt': cp_2[3],
            'full_nv_log': cp_2[4],
            'b2b': cp_2[5],
            'flush_gen': cp_2[6],
            'sync_gen': cp_2[7],
            'def_b2b': cp_2[8],
            'con_ind_pin': cp_2[9],
            'low_mbuf_gen': cp_2[10],
            'low_datavec_gen': cp_2[11]
        }

        for item in cp_1:
            c1 = int(cp_1[item])
            c2 = int(cp_2[item])
            cp_delta[item] = c2 - c1

        for item in cp_delta:
            self.push(item + '_CP', 'system.system', cp_delta[item])
def consistency_point ( self ) : cp_delta = { } xml_path = 'instances/instance-data/counters' netapp_api = NaElement ( 'perf-object-get-instances' ) netapp_api . child_add_string ( 'objectname' , 'wafl' ) instance = NaElement ( 'instances' ) instance . child_add_string ( 'instance' , 'wafl' ) counter = NaElement ( 'counters' ) counter . child_add_string ( 'counter' , 'cp_count' ) netapp_api . child_add ( counter ) netapp_api . child_add ( instance ) cp_1 = self . get_netapp_elem ( netapp_api , xml_path ) time . sleep ( 3 ) cp_2 = self . get_netapp_elem ( netapp_api , xml_path ) for element in cp_1 : if element . find ( 'name' ) . text == 'cp_count' : cp_1 = element . find ( 'value' ) . text . rsplit ( ',' ) break for element in cp_2 : if element . find ( 'name' ) . text == 'cp_count' : cp_2 = element . find ( 'value' ) . text . rsplit ( ',' ) break if not type ( cp_2 ) is list or not type ( cp_1 ) is list : log . error ( "consistency point data not available for filer: %s" % self . device ) return cp_1 = { 'wafl_timer' : cp_1 [ 0 ] , 'snapshot' : cp_1 [ 1 ] , 'wafl_avail_bufs' : cp_1 [ 2 ] , 'dirty_blk_cnt' : cp_1 [ 3 ] , 'full_nv_log' : cp_1 [ 4 ] , 'b2b' : cp_1 [ 5 ] , 'flush_gen' : cp_1 [ 6 ] , 'sync_gen' : cp_1 [ 7 ] , 'def_b2b' : cp_1 [ 8 ] , 'con_ind_pin' : cp_1 [ 9 ] , 'low_mbuf_gen' : cp_1 [ 10 ] , 'low_datavec_gen' : cp_1 [ 11 ] } cp_2 = { 'wafl_timer' : cp_2 [ 0 ] , 'snapshot' : cp_2 [ 1 ] , 'wafl_avail_bufs' : cp_2 [ 2 ] , 'dirty_blk_cnt' : cp_2 [ 3 ] , 'full_nv_log' : cp_2 [ 4 ] , 'b2b' : cp_2 [ 5 ] , 'flush_gen' : cp_2 [ 6 ] , 'sync_gen' : cp_2 [ 7 ] , 'def_b2b' : cp_2 [ 8 ] , 'con_ind_pin' : cp_2 [ 9 ] , 'low_mbuf_gen' : cp_2 [ 10 ] , 'low_datavec_gen' : cp_2 [ 11 ] } for item in cp_1 : c1 = int ( cp_1 [ item ] ) c2 = int ( cp_2 [ item ] ) cp_delta [ item ] = c2 - c1 for item in cp_delta : self . push ( item + '_CP' , 'system.system' , cp_delta [ item ] )