Skip to content

Instantly share code, notes, and snippets.

@patagonaa
Last active December 3, 2024 23:52
Show Gist options
  • Save patagonaa/6bcf957175f5c296af5ad2aa803b9d8f to your computer and use it in GitHub Desktop.
Save patagonaa/6bcf957175f5c296af5ad2aa803b9d8f to your computer and use it in GitHub Desktop.
Prometheus textfile collector script for Mellanox Connect-X temperature (for getting temperature of Mellanox SFP+ Ethernet cards)
#!/bin/bash
echo '# HELP node_mlx_temperature Mellanox networking card temperature.'
echo '# TYPE node_mlx_temperature gauge'
temperature=`mget_temp -d $1 | tr -d '[[:space:]]'`
echo "node_mlx_temperature{device=\"$1\"} $temperature"
@patagonaa
Copy link
Author

Update: this is completely unnecessary, there's a mellanox exporter in the debian package, you only have to install the firmware tools and then reinstall the prometheus-node-exporter package to enable the timer which runs the exporter

@gufpewga
Copy link

gufpewga commented Dec 3, 2024

Hi, can you please explain more how did you set it up with node-exporter with your script? To be honest I'm new into this and little bit confused. Thank you and great job 👍

@patagonaa
Copy link
Author

as I said, this thing is pretty much unnecessary as there already is a mellanox exporter included with node exporter (at least on debian).

If you still want to use it, basically the script just outputs the prometheus values to stdout. The cronjob I've posted periodically calls the script and pushes the output to a file that node_exporter reads.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment