Skip to content

Commit

Permalink
Define counter types
Browse files Browse the repository at this point in the history
  • Loading branch information
tomislacker committed Apr 11, 2019
1 parent 3e88003 commit f7d5e6a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion arrisparser/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@
app = Flask(__name__)


COUNTER_TYPES = [
'Correted',
'Uncorrectables',
]
"""Define counter type bits of data"""
# Ref: https://prometheus.io/docs/instrumenting/writing_exporters/


def clean_address(address):
return address.replace('.', '_')

Expand Down Expand Up @@ -39,7 +47,8 @@ def prometheus(prefix, address):
prefix=prefix,
address=address,
ch=str(int(ch["Channel"])),
name=numeric.lower(),
name=numeric.lower()
+ '_total' if numeric in COUNTER_TYPES else '',
val=ch[numeric],
))

Expand Down

0 comments on commit f7d5e6a

Please sign in to comment.