2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00

newznab/nn_: use label instead of all-numeric name

This way clean_fieldname works, since an clean_fieldname reduces
all-numeric input to a single underscore.

This change has not been tested, so testing and feedback (especially
pull requests) are welcome.

Reference: https://github.com/munin-monitoring/contrib/pull/113
This commit is contained in:
Kenyon Ralph 2013-03-07 23:27:06 -08:00
parent ccaeefff42
commit 5fbf46aa9a

View File

@ -232,10 +232,10 @@ sub config {
if ($k eq 'draw' && $v eq 'AREASTACK') { if ($k eq 'draw' && $v eq 'AREASTACK') {
printf("%s.%s %s\n", printf("%s.%s %s\n",
clean_fieldname($ds->{name}), $k, ($i ? 'STACK' : 'AREA')); clean_fieldname($ds->{label}), $k, ($i ? 'STACK' : 'AREA'));
} }
else { else {
printf("%s.%s %s\n", clean_fieldname($ds->{name}), $k, $v); printf("%s.%s %s\n", clean_fieldname($ds->{label}), $k, $v);
} }
$i++; $i++;
} }
@ -265,7 +265,7 @@ sub show {
my $graph = $graphs{$graph_name}; my $graph = $graphs{$graph_name};
run_queries($graph_name); run_queries($graph_name);
for my $ds (@{$graph->{data_sources}}) { for my $ds (@{$graph->{data_sources}}) {
printf "%s.value %s\n", clean_fieldname($ds->{name}), ($data->{$ds->{name}} ? $data->{$ds->{name}} : '0'); printf "%s.value %s\n", clean_fieldname($ds->{label}), ($data->{$ds->{name}} ? $data->{$ds->{name}} : '0');
} }
return 0; return 0;
} }