jurkovic-nikola / OpenLinkHub

Open source interface for iCUE LINK Hub and other Corsair AIOs, Hubs for Linux
GNU General Public License v3.0
54 stars 4 forks source link

Prometheus metrics #10

Closed kondas closed 1 month ago

kondas commented 2 months ago

It would be a very useful feature to be able to monitor the fan speeds with Prometheus, plus the go application stats of OpenLinkHub. I am happy to help with creating a Grafana dashboard for the metrics.

jurkovic-nikola commented 2 months ago

You already have data exposed via JSON on http://127.0.0.1:27003/api/devices endpoint. I don't think much people run prometheus on their home machines and scrape metrics. You would need multiple exporters in order to do so, from node_exporter to others. Grafana can process JSON format that OpenLinkHub already provides back.

jurkovic-nikola commented 1 month ago

Its using standard prometheus client lib, so overall app stats are also included, but I didn't paste it here due to size of it.

Will be pushed out in 0.1.7 version.

# HELP openlinkhub Product information
# TYPE openlinkhub gauge
openlinkhub{firmware="1.4.62",product="iCUE COMMANDER CORE XT",serial="110b30408a4884ba1ab8c3265091005f"} 1
openlinkhub{firmware="2.8.458",product="iCUE LINK System Hub",serial="40027074EFEBF2568288ACE590128B30"} 1
# HELP openlinkhub_speed Current speed (RPM) of devices.
# TYPE openlinkhub_speed gauge
openlinkhub_speed{aio="false",channelId="0",description="Fan",label="Not Set",led="34",name="Fan 1",probe="false",profile="Normal",pump="false",rgb="static",serial="110b30408a4884ba1ab8c3265091005f"} 789
openlinkhub_speed{aio="false",channelId="1",description="Fan",label="Not Set",led="34",name="Fan 2",probe="false",profile="Normal",pump="false",rgb="static",serial="110b30408a4884ba1ab8c3265091005f"} 839
openlinkhub_speed{aio="false",channelId="1",description="Fan",label="Not Set",led="34",name="iCUE LINK QX RGB",probe="false",profile="Normal",pump="false",rgb="static",serial="40027074EFEBF2568288ACE590128B30"} 1071
openlinkhub_speed{aio="false",channelId="14",description="Fan",label="Not Set",led="34",name="iCUE LINK QX RGB",probe="false",profile="Normal",pump="false",rgb="static",serial="40027074EFEBF2568288ACE590128B30"} 1120
openlinkhub_speed{aio="false",channelId="15",description="Fan",label="Not Set",led="34",name="iCUE LINK QX RGB",probe="false",profile="Normal",pump="false",rgb="static",serial="40027074EFEBF2568288ACE590128B30"} 1119
openlinkhub_speed{aio="false",channelId="16",description="Fan",label="Not Set",led="34",name="iCUE LINK QX RGB",probe="false",profile="Normal",pump="false",rgb="static",serial="40027074EFEBF2568288ACE590128B30"} 1114
openlinkhub_speed{aio="false",channelId="2",description="Fan",label="Not Set",led="34",name="iCUE LINK QX RGB",probe="false",profile="Normal",pump="false",rgb="static",serial="40027074EFEBF2568288ACE590128B30"} 1103
openlinkhub_speed{aio="false",channelId="3",description="Fan",label="Not Set",led="34",name="iCUE LINK QX RGB",probe="false",profile="Normal",pump="false",rgb="static",serial="40027074EFEBF2568288ACE590128B30"} 1093
openlinkhub_speed{aio="false",channelId="4",description="Fan",label="Not Set",led="34",name="iCUE LINK QX RGB",probe="false",profile="Normal",pump="false",rgb="static",serial="40027074EFEBF2568288ACE590128B30"} 1104
openlinkhub_speed{aio="false",channelId="5",description="Fan",label="Not Set",led="34",name="iCUE LINK QX RGB",probe="false",profile="Normal",pump="false",rgb="static",serial="40027074EFEBF2568288ACE590128B30"} 1070
openlinkhub_speed{aio="false",channelId="6",description="Fan",label="Not Set",led="34",name="iCUE LINK QX RGB",probe="false",profile="Normal",pump="false",rgb="static",serial="40027074EFEBF2568288ACE590128B30"} 1117
openlinkhub_speed{aio="true",channelId="13",description="AIO",label="Not Set",led="44",name="iCUE LINK H150i LCD",probe="false",profile="Normal",pump="true",rgb="static",serial="40027074EFEBF2568288ACE590128B30"} 2393
# HELP openlinkhub_temperature Current temperature of devices.
# TYPE openlinkhub_temperature gauge
openlinkhub_temperature{aio="false",channelId="0",description="Fan",label="Not Set",led="34",name="Fan 1",probe="false",profile="Normal",pump="false",rgb="static",serial="110b30408a4884ba1ab8c3265091005f"} 0
openlinkhub_temperature{aio="false",channelId="1",description="Fan",label="Not Set",led="34",name="Fan 2",probe="false",profile="Normal",pump="false",rgb="static",serial="110b30408a4884ba1ab8c3265091005f"} 0
openlinkhub_temperature{aio="false",channelId="1",description="Fan",label="Not Set",led="34",name="iCUE LINK QX RGB",probe="false",profile="Normal",pump="false",rgb="static",serial="40027074EFEBF2568288ACE590128B30"} 28.5
openlinkhub_temperature{aio="false",channelId="14",description="Fan",label="Not Set",led="34",name="iCUE LINK QX RGB",probe="false",profile="Normal",pump="false",rgb="static",serial="40027074EFEBF2568288ACE590128B30"} 30.600000381469727
openlinkhub_temperature{aio="false",channelId="15",description="Fan",label="Not Set",led="34",name="iCUE LINK QX RGB",probe="false",profile="Normal",pump="false",rgb="static",serial="40027074EFEBF2568288ACE590128B30"} 33.20000076293945
openlinkhub_temperature{aio="false",channelId="16",description="Fan",label="Not Set",led="34",name="iCUE LINK QX RGB",probe="false",profile="Normal",pump="false",rgb="static",serial="40027074EFEBF2568288ACE590128B30"} 31.899999618530273
openlinkhub_temperature{aio="false",channelId="2",description="Fan",label="Not Set",led="34",name="iCUE LINK QX RGB",probe="false",profile="Normal",pump="false",rgb="static",serial="40027074EFEBF2568288ACE590128B30"} 28.600000381469727
openlinkhub_temperature{aio="false",channelId="3",description="Fan",label="Not Set",led="34",name="iCUE LINK QX RGB",probe="false",profile="Normal",pump="false",rgb="static",serial="40027074EFEBF2568288ACE590128B30"} 28.399999618530273
openlinkhub_temperature{aio="false",channelId="4",description="Fan",label="Not Set",led="34",name="iCUE LINK QX RGB",probe="false",profile="Normal",pump="false",rgb="static",serial="40027074EFEBF2568288ACE590128B30"} 28.799999237060547
openlinkhub_temperature{aio="false",channelId="5",description="Fan",label="Not Set",led="34",name="iCUE LINK QX RGB",probe="false",profile="Normal",pump="false",rgb="static",serial="40027074EFEBF2568288ACE590128B30"} 29.100000381469727
openlinkhub_temperature{aio="false",channelId="6",description="Fan",label="Not Set",led="34",name="iCUE LINK QX RGB",probe="false",profile="Normal",pump="false",rgb="static",serial="40027074EFEBF2568288ACE590128B30"} 29.200000762939453
openlinkhub_temperature{aio="true",channelId="13",description="AIO",label="Not Set",led="44",name="iCUE LINK H150i LCD",probe="false",profile="Normal",pump="true",rgb="static",serial="40027074EFEBF2568288ACE590128B30"} 36.599998474121094

serial should be your key factor when doing prom query to fetch all the devices from hub. You can iterate over device list and extract serial via regex in Grafana.

kondas commented 1 month ago

Hi! It looks promising, thanks for adding the feature. I'm sure many others will find it useful. And yes, many exporters needed indeed, OpenLinkHub will be the 9th scrape target on my system. I'm eager to try it out, and will provide a dashboard ASAP.

jurkovic-nikola commented 1 month ago

demo.json

demo.json included so you dont have to bother with regex stuff