code: def collect(self):
          
          if not os.access(self.PROC, os.R_OK):
              return False
  
          # Open PROC file
          file = open(self.PROC, 'r')
  
          # Get data
          for line in file:
              if line.startswith('slabinfo'):
                  continue
  
              if line.startswith('#'):
                  keys = line.split()[1:]
                  continue
  
              data = line.split()
  
              for key in ['<active_objs>', '<num_objs>', '<objsize>',
                          '<objperslab>', '<pagesperslab>']:
                  i = keys.index(key)
                  metric_name = data[0] + '.' + key.replace(
                      '<', '').replace('>', '')
                  metric_value = int(data[i])
                  self.publish(metric_name, metric_value)
  
              for key in ['<limit>', '<batchcount>', '<sharedfactor>']:
                  i = keys.index(key)
                  metric_name = data[0] + '.tunables.' + key.replace(
                      '<', '').replace('>', '')
                  metric_value = int(data[i])
                  self.publish(metric_name, metric_value)
  
              for key in ['<active_slabs>', '<num_slabs>', '<sharedavail>']:
                  i = keys.index(key)
                  metric_name = data[0] + '.slabdata.' + key.replace(
                      '<', '').replace('>', '')
                  metric_value = int(data[i])
                  self.publish(metric_name, metric_value)
  
          # Close file
          file.close()
docs: Collect process stat data