Skip to content

Commit ba07f54

Browse files
author
Igor Živković
committed
fix regex to catch values from either the default stats file or hardcoded basic page
1 parent 359f107 commit ba07f54

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tinyproxy_exporter

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class TinyproxyCollector(object):
1919
opener = urllib.request.build_opener(handler)
2020
urllib.request.install_opener(opener)
2121
response = urllib.request.urlopen('http://{0}'.format(self.stathost))
22-
values = [float(x) for x in re.findall(b': (\d+)', response.read())]
22+
values = [float(x) for x in re.findall(b'(?:<td>|: )(\d+)(?:</td>|<br />|\n</p>)', response.read())]
2323
yield GaugeMetricFamily('tinyproxy_connections_open', 'Number of open connections', values[0])
2424
yield CounterMetricFamily('tinyproxy_requests_total', 'Number of requests', values[1])
2525
yield CounterMetricFamily('tinyproxy_connections_bad_total', 'Number of bad connections', values[2])

0 commit comments

Comments
 (0)