Skip to content

Commit

Permalink
fix regex to catch values from either the default stats file or hardc…
Browse files Browse the repository at this point in the history
…oded basic page
  • Loading branch information
Igor Živković committed Jun 11, 2018
1 parent 359f107 commit ba07f54
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tinyproxy_exporter
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class TinyproxyCollector(object):
opener = urllib.request.build_opener(handler)
urllib.request.install_opener(opener)
response = urllib.request.urlopen('http://{0}'.format(self.stathost))
values = [float(x) for x in re.findall(b': (\d+)', response.read())]
values = [float(x) for x in re.findall(b'(?:<td>|: )(\d+)(?:</td>|<br />|\n</p>)', response.read())]
yield GaugeMetricFamily('tinyproxy_connections_open', 'Number of open connections', values[0])
yield CounterMetricFamily('tinyproxy_requests_total', 'Number of requests', values[1])
yield CounterMetricFamily('tinyproxy_connections_bad_total', 'Number of bad connections', values[2])
Expand Down

0 comments on commit ba07f54

Please sign in to comment.