fix service state timeline key error and change scrape interval

This commit is contained in:
Jonathan Math 2022-01-04 11:02:22 -05:00
parent 6189dd4c01
commit ad5d7ba1e9
3 changed files with 6 additions and 4 deletions

View file

@ -240,5 +240,6 @@ scrape_configs:
- job_name: 'haproxy state'
static_configs:
- targets: ['localhost:5569']:
metrics_path: /state/
- targets: ['localhost:5569']
metrics_path: /state/
scrape_interval: 30s

View file

@ -236,4 +236,5 @@ scrape_configs:
metrics_path: /state/
scheme: http
tls_config:
insecure_skip_verify: true
insecure_skip_verify: true
scrape_interval: 30s

View file

@ -36,7 +36,7 @@ def format_state_data(label, data):
formatted_data = {}
for k, v in data.items():
if v:
formatted_data[k] = f'{label}{{servername="{k}"}} {STATUS_MAPPING[v]}'
formatted_data[k] = f'{label}{{servername="{k}"}} {STATUS_MAPPING[v.strip()]}'
return formatted_data
def get_state():