(self)
Overrides the Collector.collect method
Overrides the Collector.collect method
Overrides the Collector . collect method
def collect(self):
        """
        Overrides the Collector.collect method
        """

        if psutil is None:
            self.log.error('Unable to import module psutil')
            return {}

        for port_name, port_cfg in self.ports.iteritems():
            port = int(port_cfg['number'])
            stats = get_port_stats(port)

            for stat_name, stat_value in stats.iteritems():
                metric_name = '%s.%s' % (port_name, stat_name)
                self.publish(metric_name, stat_value)
def collect ( self ) : if psutil is None : self . log . error ( 'Unable to import module psutil' ) return { } for port_name , port_cfg in self . ports . iteritems ( ) : port = int ( port_cfg [ 'number' ] ) stats = get_port_stats ( port ) for stat_name , stat_value in stats . iteritems ( ) : metric_name = '%s.%s' % ( port_name , stat_name ) self . publish ( metric_name , stat_value )