geerlingguy / airgradient-prometheus

AirGradient Prometheus exporter.
MIT License
176 stars 59 forks source link

Error in Prometheus Exporter docker "Undefined array key "rco2"" #36

Closed LimesKey closed 1 year ago

LimesKey commented 1 year ago

My CO2 Sensor isn't working right now due to this issue. I am using the Prometheus Node Exporter in the docker hub, then when I pass the data to Prometheus I get the error message strconv.ParseFloat: parsing "<br": invalid syntax.

I get this because the air-gradient-Prometheus exporter is sending an error message which includes HTML tags that Prometheus doesn't like. The data it sends to Promethus is below, and it doesn't like the HTML <br> tag.

# HELP instance The ID of the AirGradient sensor.
# instance f83da0
# HELP wifi Current WiFi signal strength, in dB
# TYPE wifi gauge
wifi -41
# HELP pm02 Particulat Matter PM2.5 value
# TYPE pm02 gauge
pm02 1
# HELP rc02 CO2 value, in ppm
# TYPE rc02 gauge
rco2 <br />
<b>Warning</b>:  Undefined array key "rco2" in <b>/var/www/html/metrics</b> on line <b>45</b><br />

# HELP atmp Temperature, in degrees Celsius
# TYPE atmp gauge
atmp 23.8
# HELP rhum Relative humidity, in percent
# TYPE rhum gauge
rhum 43
LimesKey commented 1 year ago

I tested this with my working board that has CO2 readings correctly, and I still get this error so it cannot be caused by that. This must be some issue with inside the docker file or using the default AirGradient-supplied Arduino INO File. They are probably not compatible. I cannot use Jeff Gerling's INO file since I have the AirGradient Pro with the SGP30 (TVOC) sensor.

LimesKey commented 1 year ago

I have no idea how or what, but I was just fiddling around with it more and it got fixed.

I set my string API root to, String APIROOT = "http://192.168.1.100:9982/"; Then I set my Prometheus Exporter docker to use port 9982 and I set the network to Bridge.

github-actions[bot] commented 1 year ago

This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!

Please read this blog post to see the reasons why I mark issues as stale.

github-actions[bot] commented 1 year ago

This issue has been closed due to inactivity. If you feel this is in error, please reopen the issue or file a new issue with the relevant details.