示例#1
0
 def update_info(self, line):
     match = self._metric_source._METRIC_INFO_PATTERN.search(line)
     if match is None:
         raise parseexception.ParseException('could not parse metric pattern from line: {0}'.format(line))
     key = match.groupdict()['key']
     value = match.groupdict()['value']
     self._status[key] = value
示例#2
0
 def _readLines(self):
     line = self._lineReader.readline()
     match = self._FIRST_LINE_PATTERN.search(line)
     if match is None:
         raise parseexception.ParseException(
             'could not parse first line of response from collectd: {0}'.
             format(line))
     howManyLines = int(match.groupdict()['lines'])
     return [self._lineReader.readline() for _ in range(howManyLines)]
示例#3
0
 def update(self):
     response = self._collectd.query(
         'GETVAL "{metric}"'.format(metric=self._symbol))
     for line in response:
         match = self._METRIC_INFO_PATTERN.search(line)
         if match is None:
             raise parseexception.ParseException(
                 'could not parse metric pattern from line: {0}'.format(
                     line))
         key = match.groupdict()['key']
         value = match.groupdict()['value']
         self._status[key] = value
示例#4
0
 def update(self):
     response = self._metric_source.query_val(self._symbol)
     if response is None:
         self.markAbsent()
         return
     for line in response:
         match = self._metric_source._METRIC_INFO_PATTERN.search(line)
         if match is None:
             raise parseexception.ParseException(
                 'could not parse metric pattern from line: {0}'.format(
                     line))
         key = match.groupdict()['key']
         value = match.groupdict()['value']
         self._status[key] = value
         logging.debug('update {}: {}'.format(self.symbol, line.strip()))