From 796814531e42ef2c7a6cfbeaca85a87fe86688cc Mon Sep 17 00:00:00 2001 From: Digimer Date: Thu, 13 Jan 2022 21:07:25 -0500 Subject: [PATCH] Fixed a bug in Alert->check_condition_age() where, when the 'clear' parameter was set and the value was already 'clear', it would flip to 'set' erroniously. Signed-off-by: Digimer --- Anvil/Tools/Alert.pm | 5 +++-- scancore-agents/scan-network/scan-network | 8 +++++--- tools/striker-db-report | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Anvil/Tools/Alert.pm b/Anvil/Tools/Alert.pm index b49b0944..dc1d322f 100644 --- a/Anvil/Tools/Alert.pm +++ b/Anvil/Tools/Alert.pm @@ -295,6 +295,7 @@ sub check_condition_age # See if this variable has been set yet. my ($variable_value, $variable_uuid, $epoch_modified_date, $modified_date) = $anvil->Database->read_variable({ + debug => $debug, variable_name => $name, variable_source_table => $source_table, variable_source_uuid => $host_uuid, @@ -319,8 +320,8 @@ sub check_condition_age }); } - # if the value was 'clear', change it to 'set'. - if ($variable_value eq "clear") + # if the 'clear' parameter isn't set, and the value is 'clear', change it to 'set'. + if (($variable_value eq "clear") && (not $clear)) { # Set it. $variable_uuid = $anvil->Database->insert_or_update_variables({ diff --git a/scancore-agents/scan-network/scan-network b/scancore-agents/scan-network/scan-network index 7267fd8e..78c5a2f2 100755 --- a/scancore-agents/scan-network/scan-network +++ b/scancore-agents/scan-network/scan-network @@ -3457,9 +3457,11 @@ AND # Don't set / clear interfaces that appear down but aren't named ifn/bcn/sn as they're probably # unconfigured/unusued interfaces. - my $problem = 0; - my $check = 0; - if ($anvil->Network->is_our_interface({interface => $network_interface_name})) + my $problem = 0; + my $check = 0; + my $monitored = $anvil->Network->is_our_interface({interface => $network_interface_name}); + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { monitored => $monitored }}); + if ($monitored) { # One we monitor $check = 1; diff --git a/tools/striker-db-report b/tools/striker-db-report index ace40df5..b738c468 100755 --- a/tools/striker-db-report +++ b/tools/striker-db-report @@ -233,7 +233,7 @@ WHERE { foreach my $query (@{$queries}) { - $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 3, key => "log_0124", variables => { query => $query }}); + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, key => "log_0124", variables => { query => $query }}); my $results = $anvil->Database->query({query => $query, source => $THIS_FILE, line => __LINE__}); my $count = @{$results}; $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => {