mirror of https://github.com/mikaku/Monitorix.git
Fixed the behavior of the options in the extra configuration file.
A configuration file can contain sections, subsections and even subsubsections in the form of: <gensens> <-- this is a section or module <list> <-- this is a subsection 0 = temp0 1 = cpu0 2 = bat0 </list> ... If you plan to create an extra configuration file in 'conf.d/', you must know that, from now on, you'll be forced to define the whole subsection even when you are changing only a single value of it. Otherwise your results might vary from what you expect. For instance, imagine you want to monitor a second CPU in the 'gensens' module. You will create an extra configuration file in 'conf.d/' to include a second CPU (cpu1) in the key '1' inside the subsection 'list'. In that case your extra configuration file should define the section 'gensens' as this: <gensens> <list> 0 = temp0 1 = cpu0, cpu1 2 = bat0 </list> </gensens> That is, you must include the whole subsection 'list' with all the rest of options. The rest of subsections of 'gensens' are not needed because they have not been changed. Monitorix will use the subsections configured in the main configuration file.
This commit is contained in:
parent
bc71c9351e
commit
43c2e93f1a
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# Monitorix - A lightweight system monitoring tool.
|
||||
#
|
||||
# Copyright (C) 2005-2020 by Jordi Sanfeliu <jordi@fibranet.cat>
|
||||
# Copyright (C) 2005-2021 by Jordi Sanfeliu <jordi@fibranet.cat>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
@ -581,10 +581,12 @@ if($config{include_dir} && opendir(DIR, $config{include_dir})) {
|
|||
my %config_inc = $conf_inc->getall;
|
||||
while(my ($key, $val) = each(%config_inc)) {
|
||||
if(ref($val) eq "HASH") {
|
||||
# two level options
|
||||
# two level options (a subsection)
|
||||
while(my ($key2, $val2) = each(%{$val})) {
|
||||
# delete first this whole subsection
|
||||
delete($config{$key}->{$key2});
|
||||
if(ref($val2) eq "HASH") {
|
||||
# three level options
|
||||
# three level options (a subsubsection)
|
||||
while(my ($key3, $val3) = each(%{$val2})) {
|
||||
$config{$key}->{$key2}->{$key3} = $val3;
|
||||
delete $config_inc{$key}->{$key2}->{$key3};
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# Monitorix - A lightweight system monitoring tool.
|
||||
#
|
||||
# Copyright (C) 2005-2020 by Jordi Sanfeliu <jordi@fibranet.cat>
|
||||
# Copyright (C) 2005-2021 by Jordi Sanfeliu <jordi@fibranet.cat>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
@ -266,10 +266,12 @@ if($config{include_dir} && opendir(DIR, $config{include_dir})) {
|
|||
my %config_inc = $conf_inc->getall;
|
||||
while(my ($key, $val) = each(%config_inc)) {
|
||||
if(ref($val) eq "HASH") {
|
||||
# two level options
|
||||
# two level options (a subsection)
|
||||
while(my ($key2, $val2) = each(%{$val})) {
|
||||
# delete first this whole subsection
|
||||
delete($config{$key}->{$key2});
|
||||
if(ref($val2) eq "HASH") {
|
||||
# three level options
|
||||
# three level options (a subsubsection)
|
||||
while(my ($key3, $val3) = each(%{$val2})) {
|
||||
$config{$key}->{$key2}->{$key3} = $val3;
|
||||
delete $config_inc{$key}->{$key2}->{$key3};
|
||||
|
|
Loading…
Reference in New Issue