jakekeeys / hg612-exporter Goto Github PK
View Code? Open in Web Editor NEWA prometheus exporter for the HG612 modem
License: Apache License 2.0
A prometheus exporter for the HG612 modem
License: Apache License 2.0
It looks like in the collect()
loop the dsl_status
gauge is latched to 1 with the current status label set
c.status.WithLabelValues(
c.host, c.identifier, status.DSLCfg.Status, status.DSLCfg.Modulation, status.DSLCfg.DataPath).Set(1)
However, this means that all historically seen statuses are latched to 1 and never reset:
# HELP dsl_status
# TYPE dsl_status gauge
dsl_status{dataPath="",host="192.168.2.1",identifier="BT",modulation="",status="EstablishingLink"} 1
dsl_status{dataPath="",host="192.168.2.1",identifier="BT",modulation="",status="Initializing"} 1
dsl_status{dataPath="",host="192.168.2.1",identifier="BT",modulation="",status="NoSignal"} 1
Ideally in the collect()
loop it would loop over all known status values and set them to 0 for the ongoing publishes. Alternatively I think you could call .Reset()
on the gauge before you call your .Set(1)
and that would stop publishing the metric for the old statuses
Hi,
When running this on a Raspberry Pi running armhf, eg arm 32bit it breaks, with errors such as:
time="2022-10-24T23:50:51Z" level=error msg="error collecting dsl metrics: error getting dsl status: error converting numeric dsl stats value: strconv.Atoi: parsing "4294967290": value out of range"
It seems that strconv.Atoi returns an int, which is a platform dependent type, eg int32 on 32bit platforms and int64 on 64bit platforms. My modem has quite a few Upstream HEC errors (which I hope are from it's previous owner's setup or it could just be the odd webui: https://forum.kitz.co.uk/index.php?topic=16562.0):
WANDSLInterfaceConfig.Stats.Showtime","154","4294967290"
In my case 4,294,967,290 (but int32 maxes out at: 2,147,483,647), hence it can't store the value.
Hacking the code use int64 types seems to get it working.
Kind Regards
Tom
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.