Merge pull request #521 from ClusterLabs/anvil-tools-dev

Anvil tools dev
main
Digimer 1 year ago committed by GitHub
commit fe453ac51d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 34
      scancore-agents/scan-server/scan-server
  2. 12
      tools/anvil-version-changes

@ -822,18 +822,28 @@ sub collect_data
} }
if ($server_boot_time ne $old_server_boot_time) if ($server_boot_time ne $old_server_boot_time)
{ {
# Boot time changed (expected on shut down or boot up) # What's the difference? If it's only a few seconds, don't do anything.
my $variables = { $server_boot_time = 1 if not $server_boot_time;
server => $server_name, $old_server_boot_time = 1 if not $old_server_boot_time;
old_boot_time_date => $anvil->Get->date_and_time({use_time => $old_server_boot_time}), my $diffrerence = $server_boot_time - $old_server_boot_time;
old_boot_time_epoch => $anvil->Convert->add_commas({number => $old_server_boot_time}), $diffrerence =~ s/^-//;
new_boot_time_date => $anvil->Get->date_and_time({use_time => $server_boot_time}), $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { diffrerence => $diffrerence }});
new_boot_time_epoch => $anvil->Convert->add_commas({number => $server_boot_time}),
}; if ($diffrerence > 5)
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "scan_server_alert_0008", variables => $variables}); {
$anvil->Alert->register({alert_level => "notice", message => "scan_server_alert_0008", variables => $variables, set_by => $THIS_FILE}); # Boot time changed (expected on shut down or boot up)
$update = 1; my $variables = {
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { update => $update }}); server => $server_name,
old_boot_time_date => $anvil->Get->date_and_time({use_time => $old_server_boot_time}),
old_boot_time_epoch => $anvil->Convert->add_commas({number => $old_server_boot_time}),
new_boot_time_date => $anvil->Get->date_and_time({use_time => $server_boot_time}),
new_boot_time_epoch => $anvil->Convert->add_commas({number => $server_boot_time}),
};
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "scan_server_alert_0008", variables => $variables});
$anvil->Alert->register({alert_level => "notice", message => "scan_server_alert_0008", variables => $variables, set_by => $THIS_FILE});
$update = 1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { update => $update }});
}
} }
if ($server_anvil_uuid ne $old_server_anvil_uuid) if ($server_anvil_uuid ne $old_server_anvil_uuid)
{ {

@ -63,6 +63,10 @@ sub striker_checks
{ {
my ($anvil) = @_; my ($anvil) = @_;
# This checks to make sure that the new dr_links table exists, and that existing anvil_dr1_host_uuid
# entries are copied.
update_dr_links($anvil);
# This checks to make sure that the new 'file_locations' -> 'file_location_ready' column exists. # This checks to make sure that the new 'file_locations' -> 'file_location_ready' column exists.
update_file_location_ready($anvil); update_file_location_ready($anvil);
@ -80,10 +84,6 @@ sub striker_checks
# This checks to make sure that the 'audits' table exists (added late into M3.0 pre-release) # This checks to make sure that the 'audits' table exists (added late into M3.0 pre-release)
update_audits($anvil); update_audits($anvil);
# This checks to make sure that the new dr_links table exists, and that existing anvil_dr1_host_uuid
# entries are copied.
update_dr_links($anvil);
### TODO: Remove these later. This is here to clean up how we used to handle db_in_use and lock_request flags. ### TODO: Remove these later. This is here to clean up how we used to handle db_in_use and lock_request flags.
if (1) if (1)
{ {
@ -415,9 +415,9 @@ sub update_storage_group_members
foreach my $uuid (sort {$a cmp $b} keys %{$anvil->data->{cache}{database_handle}}) foreach my $uuid (sort {$a cmp $b} keys %{$anvil->data->{cache}{database_handle}})
{ {
my $query = "SELECT COUNT(*) FROM information_schema.columns WHERE table_schema = 'public' AND table_name = 'storage_group_members' AND column_name = 'storage_group_member_note';"; my $query = "SELECT COUNT(*) FROM information_schema.columns WHERE table_schema = 'public' AND table_name = 'storage_group_members' AND column_name = 'storage_group_member_note';";
$anvil->Log->variables({source => $THIS_FILE, uuid => $uuid, line => __LINE__, level => 2, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { query => $query }});
my $count = $anvil->Database->query({query => $query, source => $THIS_FILE, line => __LINE__})->[0]->[0]; my $count = $anvil->Database->query({uuid => $uuid, query => $query, source => $THIS_FILE, line => __LINE__})->[0]->[0];
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { count => $count }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { count => $count }});
if (not $count) if (not $count)

Loading…
Cancel
Save