Skip to content

Commit

Permalink
Adds amp/current support to ipmitool (prometheus-community#36)
Browse files Browse the repository at this point in the history
Signed-off-by: Sung Park <shjpark92@gmail.com>
  • Loading branch information
shjpark92 committed May 30, 2023
1 parent fc283fe commit 4098ef9
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ipmitool
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@ BEGIN {
# Friendly description of the type of sensor for HELP.
help["temperature_celsius"] = "Temperature";
help["volts"] = "Voltage";
help["amps"] = "Current";
help["power_watts"] = "Power";
help["speed_rpm"] = "Fan";
help["percent"] = "Device";
help["status"] = "Chassis status";

temperature_celsius["metric_count"] = 0;
volts["metric_count"] = 0;
amps["metric_count"] = 0;
power_watts["metric_count"] = 0;
speed_rpm["metric_count"] = 0;
percent["metric_count"] = 0;
Expand Down Expand Up @@ -67,6 +69,11 @@ $3 ~ /Volts/ {
volts["metric_count"]++;
}

$3 ~ /Amps/ {
amps[$1] = $2;
amps["metric_count"]++;
}

$3 ~ /Watts/ {
power_watts[$1] = $2;
power_watts["metric_count"]++;
Expand All @@ -90,6 +97,7 @@ $3 ~ /discrete/ {
END {
export(temperature_celsius, "temperature_celsius");
export(volts, "volts");
export(amps, "amps");
export(power_watts, "power_watts");
export(speed_rpm, "speed_rpm");
export(percent, "percent");
Expand Down

0 comments on commit 4098ef9

Please sign in to comment.