IPMI sensors can have / and - in their name

This commit is contained in:
Daniel Berteaud 2020-10-26 18:22:54 +01:00
parent e8f9e75886
commit cf1dbfbba0

View File

@ -78,7 +78,7 @@ if ($ipmitool && -x $ipmitool){
chomp $l; chomp $l;
# Looks like # Looks like
# Inlet Temp | 04h | ok | 7.1 | 25 degrees C # Inlet Temp | 04h | ok | 7.1 | 25 degrees C
if ($l !~ m/^(\w+[\s\w]+?\w+)\s*\|.*\|\s*([\w\.\s]+)\s*\|.*\|\s*([\-\w\.\s]+)$/){ if ($l !~ m/^(\w+[\s\w\/\-]+?\w+)\s*\|.*\|\s*([\w\.\s]+)\s*\|.*\|\s*([\-\w\.\s]+)$/){
next SENSOR; next SENSOR;
} }
my $name = $1; my $name = $1;
@ -396,7 +396,7 @@ $cfg->write($output);
sub sensor_name{ sub sensor_name{
my $desc = shift; my $desc = shift;
my $id = lc $desc; my $id = lc $desc;
$id =~ s/\s/_/g; $id =~ s/[^\w]/_/g;
$id =~ s/%/percent/g; $id =~ s/%/percent/g;
$id =~ s/_rpm$//; $id =~ s/_rpm$//;
return $id; return $id;