(self, metric)
Process a metric by converting metric name to MQTT topic name;
        the payload is metric and timestamp.
Process a metric by converting metric name to MQTT topic name;
        the payload is metric and timestamp.
Process a metric by converting metric name to MQTT topic name ; the payload is metric and timestamp .
def process(self, metric):
        """
        Process a metric by converting metric name to MQTT topic name;
        the payload is metric and timestamp.
        """

        if not mosquitto:
            return

        line = str(metric)
        topic, value, timestamp = line.split()
        if len(self.prefix):
            topic = "%s/%s" % (self.prefix, topic)
        topic = topic.replace('.', '/')
        topic = topic.replace('#', '&')     # Topic must not contain wildcards

        if self.timestamp == 0:
            self.mqttc.publish(topic, "%s" % (value), self.qos)
        else:
            self.mqttc.publish(topic, "%s %s" % (value, timestamp), self.qos)
def process ( self , metric ) : if not mosquitto : return line = str ( metric ) topic , value , timestamp = line . split ( ) if len ( self . prefix ) : topic = "%s/%s" % ( self . prefix , topic ) topic = topic . replace ( '.' , '/' ) topic = topic . replace ( '#' , '&' ) # Topic must not contain wildcards if self . timestamp == 0 : self . mqttc . publish ( topic , "%s" % ( value ) , self . qos ) else : self . mqttc . publish ( topic , "%s %s" % ( value , timestamp ) , self . qos )