(self, s)
return metrics
Parse performance data from a perfdata string
Parse performance data from a perfdata string
Parse performance data from a perfdata string
def _parse_perfdata(self, s):
        """Parse performance data from a perfdata string
        """
        metrics = []
        counters = re.findall(self.TOKENIZER_RE, s)
        if counters is None:
            self.log.warning("Failed to parse performance data: {s}".format(
                s=s))
            return metrics

        for (key, value, uom, warn, crit, min, max) in counters:
            try:
                norm_value = self._normalize_to_unit(float(value), uom)
                metrics.append((key, norm_value))
            except ValueError:
                self.log.warning(
                    "Couldn't convert value '{value}' to float".format(
                        value=value))

        return metrics
def _parse_perfdata ( self , s ) : metrics = [ ] counters = re . findall ( self . TOKENIZER_RE , s ) if counters is None : self . log . warning ( "Failed to parse performance data: {s}" . format ( s = s ) ) return metrics for ( key , value , uom , warn , crit , min , max ) in counters : try : norm_value = self . _normalize_to_unit ( float ( value ) , uom ) metrics . append ( ( key , norm_value ) ) except ValueError : self . log . warning ( "Couldn't convert value '{value}' to float" . format ( value = value ) ) return metrics