only export response times on up monitors

This commit is contained in:
hnrd 2018-04-23 13:37:13 +02:00
parent abf87db604
commit b875ef4443
1 changed files with 7 additions and 6 deletions

View File

@ -29,12 +29,13 @@ def format_prometheus(data):
item.get('url'),
1 if item.get('status', 0) == 2 else 0,
)
result += 'uptimerobot_response_time{{name="{}",type="{}",url="{}"}} {}\n'.format(
item.get('friendly_name'),
item.get('type'),
item.get('url'),
item.get('response_times').pop().get('value'),
)
if item.get('status', 0) == 2:
result += 'uptimerobot_response_time{{name="{}",type="{}",url="{}"}} {}\n'.format(
item.get('friendly_name'),
item.get('type'),
item.get('url'),
item.get('response_times').pop().get('value'),
)
return result