Merge pull request #393 from bachandi/ipmi_map_whitespace_support

Add support to rename ipmi sensors with whitespaces in their name.
This commit is contained in:
Jordi Sanfeliu 2022-02-03 17:01:16 +01:00 committed by GitHub
commit e8d5572add
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View File

@ -385,6 +385,8 @@ sub ipmi_cgi {
}
}
}
my $whitespace_key_support = lc($ipmi->{whitespace_key_support} || "") eq "y" ? 1 : 0;
$n = 0;
while($n < scalar(@sensor_list)) {
@ -407,6 +409,9 @@ sub ipmi_cgi {
my $unit = $ipmi->{units}->{$n};
foreach my $i (split(',', $ipmi->{desc}->{$n})) {
$i = trim($i);
if ($whitespace_key_support) {
$i=~s/ /_/g;
}
$str = $ipmi->{map}->{$i} || $i;
$str = sprintf("%-40s", substr($str, 0, 40));
push(@tmp, "LINE2:s" . ($e + 1) . $LC[$e] . ":$str");

View File

@ -1180,7 +1180,7 @@ This is the type of sensor in each group. It's important to not mix different ty
.P
.BI map
.RS
This list complements the \fBdesc\fP option. It basically allows you to change the name that will appear in the graph, hiding the real name of the sensor. If no association is defined, then Monitorix will display the name specified in the \fBdesc\fP option. Note, this only works in names that don't include whitespaces.
This list complements the \fBdesc\fP option. It basically allows you to change the name that will appear in the graph, hiding the real name of the sensor. If no association is defined, then Monitorix will display the name specified in the \fBdesc\fP option. Note, this only works in names that don't include whitespaces unless you use the \fBwhitespace_key_support\fP option and replace whitespaces with underscores in the key.
.RE
.P
.BI alerts
@ -1222,6 +1222,12 @@ The external script will receive the following arguments:
.P
.RE
.RE
.BI whitespace_key_support
.RS
This list complements the \fBmap\fP option. It changes the handling of the key names. Without this option enabled you can't rename keys with whitespaces using the \fBmap\fP option. When enabled, whitespaces in the map key will be replaced by underscores(_) and enables you to specify the key names this way.
.P
Default value: \fIn\fP
.RE
.BI graphs_per_row
.RS
This is the number of graphs that will be put in a row.