Skip to content
This repository has been archived by the owner on Apr 28, 2024. It is now read-only.

Commit

Permalink
Fix protocol summary view when 'timeformat protocol iso long' is conf…
Browse files Browse the repository at this point in the history
…igured.

'timeformat protocol iso long' is a requirement for using bird_exporter with prometheus.
  • Loading branch information
Simon Marsh committed Jan 12, 2019
1 parent 2649faf commit a9ce70b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lg.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,16 @@ def summary(hosts, proto="ipv4"):
props["table"] = split[2]
props["state"] = split[3]
props["since"] = split[4]
props["info"] = ' '.join(split[5:]) if len(split) > 5 else ""
if len(split) > 5:
# if bird is configured for 'timeformat protocol iso long'
# then the 5th column contains the time, rather than info
match = re.match(r'\d\d:\d\d:\d\d', split[5])
if match:
props["info"] = ' '.join(split[6:]) if len(split) > 6 else ""
else:
props["info"] = ' '.join(split[5:])
else:
props["info"] = ""
data.append(props)
else:
app.logger.warning("couldn't parse: %s", line)
Expand Down

0 comments on commit a9ce70b

Please sign in to comment.