Skip to content

Instantly share code, notes, and snippets.

@arm2arm
Last active August 18, 2022 13:11
Show Gist options
  • Save arm2arm/e122928e2defde221e987e3ff1c727a3 to your computer and use it in GitHub Desktop.
Save arm2arm/e122928e2defde221e987e3ff1c727a3 to your computer and use it in GitHub Desktop.
simple ipmi power consumption collector for the node text exporter
#!/bin/bash
echo "
# HELP node_ipmi_get_power_watts Power sensor reading from ipmitool
# TYPE node_ipmi_get_power_watts gauge
" > /var/lib/node_exporter/textfile_collector/ipmitool_get_power.prom.$$
/usr/bin/ipmitool dcmi power reading| grep Instantaneous| awk '{printf"node_ipmi_get_power_watts{sensor=\"PW Consumption\"} %d\n",$4}' >> /var/lib/node_exporter/textfile_collector/ipmitool_power.prom.$$
/usr/bin/mv /var/lib/node_exporter/textfile_collector/ipmitool_power.prom.$$ /var/lib/node_exporter/textfile_collector/ipmitool_get_power.prom
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment