Merge pull request #63 from ClusterLabs/webui_anvil_page

Webui anvil page
main
digimer-bot 4 years ago committed by GitHub
commit c2386fabd4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      Anvil/Tools/DRBD.pm
  2. 4
      Anvil/Tools/Database.pm
  3. 82
      Anvil/Tools/ScanCore.pm
  4. 7
      scancore-agents/Makefile.am
  5. 12
      scancore-agents/scan-drbd/scan-drbd.xml
  6. 2
      scancore-agents/scan-ipmitool/scan-ipmitool
  7. 4
      scancore-agents/scan-ipmitool/scan-ipmitool.sql
  8. 6
      share/anvil.sql
  9. 13
      share/words.xml
  10. 2
      tools/scancore

@ -456,12 +456,21 @@ sub gather_data
my $debug = defined $parameter->{debug} ? $parameter->{debug} : 3; my $debug = defined $parameter->{debug} ? $parameter->{debug} : 3;
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0125", variables => { method => "DRBD->gather_data()" }}); $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0125", variables => { method => "DRBD->gather_data()" }});
# Is DRBD even installed?
if (not -e $anvil->data->{path}{exe}{drbdadm})
{
# This is an error, but it happens a lot because we're called by scan_drbd from Striker
# dashboards often. As such, this log level is '2'.
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, key => "error_0251"});
return(1);
}
my ($drbd_xml, $return_code) = $anvil->System->call({shell_call => $anvil->data->{path}{exe}{drbdadm}." dump-xml"}); my ($drbd_xml, $return_code) = $anvil->System->call({shell_call => $anvil->data->{path}{exe}{drbdadm}." dump-xml"});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { drbd_xml => $drbd_xml, return_code => $return_code }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { drbd_xml => $drbd_xml, return_code => $return_code }});
if ($return_code) if ($return_code)
{ {
# Failed to dump the XML. # Failed to dump the XML.
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "scan_drbd_error_0002", variables => { return_code => $return_code }}); $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "error_0252", variables => { return_code => $return_code }});
return(1); return(1);
} }
else else
@ -470,7 +479,7 @@ sub gather_data
my $dom = eval { XML::LibXML->load_xml(string => $drbd_xml); }; my $dom = eval { XML::LibXML->load_xml(string => $drbd_xml); };
if ($@) if ($@)
{ {
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "scan_drbd_error_0003", variables => { $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "error_0253", variables => {
xml => $drbd_xml, xml => $drbd_xml,
error => $@, error => $@,
}}); }});

@ -14616,7 +14616,7 @@ sub resync_databases
$query .= " WHERE ".$host_column." = ".$anvil->Database->quote($anvil->data->{sys}{host_uuid}); $query .= " WHERE ".$host_column." = ".$anvil->Database->quote($anvil->data->{sys}{host_uuid});
} }
$query .= " ORDER BY utc_modified_date DESC;"; $query .= " ORDER BY utc_modified_date DESC;";
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0074", variables => { uuid => $anvil->data->{database}{$uuid}{host}, query => $query }}); $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0074", variables => { uuid => $uuid, query => $query }});
my $results = $anvil->Database->query({uuid => $uuid, query => $query, source => $THIS_FILE, line => __LINE__}); my $results = $anvil->Database->query({uuid => $uuid, query => $query, source => $THIS_FILE, line => __LINE__});
my $count = @{$results}; my $count = @{$results};
@ -15729,7 +15729,7 @@ ORDER BY
### the difference is more than 10 seconds. ### the difference is more than 10 seconds.
# Resync needed. # Resync needed.
my $difference = $anvil->data->{sys}{database}{table}{$table}{last_updated} - $anvil->data->{sys}{database}{table}{$table}{uuid}{$uuid}{last_updated}; my $difference = $anvil->data->{sys}{database}{table}{$table}{last_updated} - $anvil->data->{sys}{database}{table}{$table}{uuid}{$uuid}{last_updated};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
"s1:difference" => $anvil->Convert->add_commas({number => $difference }), "s1:difference" => $anvil->Convert->add_commas({number => $difference }),
"s2:sys::database::table::${table}::last_updated" => $anvil->data->{sys}{database}{table}{$table}{last_updated}, "s2:sys::database::table::${table}::last_updated" => $anvil->data->{sys}{database}{table}{$table}{last_updated},
"s3:sys::database::table::${table}::uuid::${uuid}::last_updated" => $anvil->data->{sys}{database}{table}{$table}{uuid}{$uuid}{last_updated}, "s3:sys::database::table::${table}::uuid::${uuid}::last_updated" => $anvil->data->{sys}{database}{table}{$table}{uuid}{$uuid}{last_updated},

@ -117,6 +117,7 @@ sub agent_startup
tables => $tables, tables => $tables,
}}); }});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { tables => $tables }});
if ((not $tables) or (ref($tables) ne "ARRAY")) if ((not $tables) or (ref($tables) ne "ARRAY"))
{ {
my $schema_file = $anvil->data->{path}{directories}{scan_agents}."/".$agent."/".$agent.".sql"; my $schema_file = $anvil->data->{path}{directories}{scan_agents}."/".$agent."/".$agent.".sql";
@ -124,11 +125,19 @@ sub agent_startup
if (-e $schema_file) if (-e $schema_file)
{ {
$tables = $anvil->Database->get_tables_from_schema({debug => $debug, schema_file => $schema_file}); $tables = $anvil->Database->get_tables_from_schema({debug => $debug, schema_file => $schema_file});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { tables => $tables }});
if (($tables eq "!!error!!") or (ref($tables) ne "ARRAY")) if (($tables eq "!!error!!") or (ref($tables) ne "ARRAY"))
{ {
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 0, priority => "err", key => "log_0020", variables => { method => "ScanCore->agent_startup()", parameter => "tables" }}); $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 0, priority => "err", key => "log_0020", variables => { method => "ScanCore->agent_startup()", parameter => "tables" }});
return("!!error!!"); return("!!error!!");
} }
else
{
foreach my $table (@{$tables})
{
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { table => $table }});
}
}
} }
else else
{ {
@ -138,15 +147,6 @@ sub agent_startup
} }
} }
if ((ref($tables) ne "ARRAY") && (@{$tables} > 0))
{
# Append our tables
foreach my $table (@{$tables})
{
push @{$anvil->data->{sys}{database}{check_tables}}, $table;
}
}
# Connect to DBs. # Connect to DBs.
$anvil->Database->connect({debug => $debug}); $anvil->Database->connect({debug => $debug});
$anvil->Log->entry({source => $agent, line => __LINE__, level => $debug, secure => 0, key => "log_0132"}); $anvil->Log->entry({source => $agent, line => __LINE__, level => $debug, secure => 0, key => "log_0132"});
@ -375,10 +375,10 @@ sub check_power
my $estimated_hold_up_time = 0; my $estimated_hold_up_time = 0;
my $query = "SELECT manifest_uuid FROM manifests WHERE manifest_name = ".$anvil->Database->quote($anvil_name).";"; my $query = "SELECT manifest_uuid FROM manifests WHERE manifest_name = ".$anvil->Database->quote($anvil_name).";";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
my $results = $anvil->Database->query({query => $query, source => $THIS_FILE, line => __LINE__}); my $results = $anvil->Database->query({query => $query, source => $THIS_FILE, line => __LINE__});
my $count = @{$results}; my $count = @{$results};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
results => $results, results => $results,
count => $count, count => $count,
}}); }});
@ -393,7 +393,7 @@ sub check_power
} }
my $manifest_uuid = $results->[0]->[0]; my $manifest_uuid = $results->[0]->[0];
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { manifest_uuid => $manifest_uuid }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { manifest_uuid => $manifest_uuid }});
# Try to parse the manifest now. # Try to parse the manifest now.
if (not exists $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}) if (not exists $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid})
@ -402,7 +402,7 @@ sub check_power
debug => $debug, debug => $debug,
manifest_uuid => $manifest_uuid, manifest_uuid => $manifest_uuid,
}); });
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { problem => $problem }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { problem => $problem }});
if ($problem) if ($problem)
{ {
@ -421,7 +421,7 @@ sub check_power
foreach my $machine_type (sort {$a cmp $b} keys %{$anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{machine}}) foreach my $machine_type (sort {$a cmp $b} keys %{$anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{machine}})
{ {
my $machine_name = $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{machine}{$machine_type}{name}; my $machine_name = $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{machine}{$machine_type}{name};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
machine_type => $machine_type, machine_type => $machine_type,
machine_name => $machine_name, machine_name => $machine_name,
}}); }});
@ -432,7 +432,7 @@ sub check_power
my $ups_uuid = $anvil->data->{upses}{ups_name}{$ups_name}{ups_uuid}; my $ups_uuid = $anvil->data->{upses}{ups_name}{$ups_name}{ups_uuid};
my $ups_used = $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{machine}{$machine_type}{ups}{$ups_name}{used}; my $ups_used = $anvil->data->{manifests}{manifest_uuid}{$manifest_uuid}{parsed}{machine}{$machine_type}{ups}{$ups_name}{used};
my $power_uuid = $anvil->data->{upses}{ups_name}{$ups_name}{power_uuid}; my $power_uuid = $anvil->data->{upses}{ups_name}{$ups_name}{power_uuid};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
ups_name => $ups_name, ups_name => $ups_name,
ups_uuid => $ups_uuid, ups_uuid => $ups_uuid,
power_uuid => $power_uuid, power_uuid => $power_uuid,
@ -451,7 +451,7 @@ sub check_power
my $modified_date_unix = $anvil->data->{power}{power_uuid}{$power_uuid}{modified_date_unix}; my $modified_date_unix = $anvil->data->{power}{power_uuid}{$power_uuid}{modified_date_unix};
my $time_now = time; my $time_now = time;
my $last_updated = $time_now - $modified_date_unix; my $last_updated = $time_now - $modified_date_unix;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
ups_count => $ups_count, ups_count => $ups_count,
power_on_battery => $power_on_battery, power_on_battery => $power_on_battery,
power_seconds_left => $power_seconds_left." (".$anvil->Convert->time({'time' => $power_seconds_left, long => 1, translate => 1}).")", power_seconds_left => $power_seconds_left." (".$anvil->Convert->time({'time' => $power_seconds_left, long => 1, translate => 1}).")",
@ -468,12 +468,12 @@ sub check_power
{ {
# Set this to '2', if another UPS is on mains, it will change it to 1. # Set this to '2', if another UPS is on mains, it will change it to 1.
$power_health = 2; $power_health = 2;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { power_health => $power_health }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { power_health => $power_health }});
} }
if ($power_seconds_left > $estimated_hold_up_time) if ($power_seconds_left > $estimated_hold_up_time)
{ {
$estimated_hold_up_time = $power_seconds_left; $estimated_hold_up_time = $power_seconds_left;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { estimated_hold_up_time => $estimated_hold_up_time }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { estimated_hold_up_time => $estimated_hold_up_time }});
} }
# How long has it been on batteries? # How long has it been on batteries?
@ -492,7 +492,7 @@ LIMIT 1
;"; ;";
my $results = $anvil->Database->query({query => $query, source => $THIS_FILE, line => __LINE__}); my $results = $anvil->Database->query({query => $query, source => $THIS_FILE, line => __LINE__});
my $count = @{$results}; my $count = @{$results};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
results => $results, results => $results,
count => $count, count => $count,
}}); }});
@ -508,14 +508,14 @@ LIMIT 1
else else
{ {
my $time_on_batteries = $results->[0]->[0]; my $time_on_batteries = $results->[0]->[0];
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
time_on_batteries => $time_on_batteries." (".$anvil->Convert->time({'time' => $time_on_batteries, long => 1, translate => 1}).")", time_on_batteries => $time_on_batteries." (".$anvil->Convert->time({'time' => $time_on_batteries, long => 1, translate => 1}).")",
}}); }});
if ($time_on_batteries < $shorted_time_on_batteries) if ($time_on_batteries < $shorted_time_on_batteries)
{ {
$shorted_time_on_batteries = $shorted_time_on_batteries; $shorted_time_on_batteries = $shorted_time_on_batteries;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
shorted_time_on_batteries => $shorted_time_on_batteries." (".$anvil->Convert->time({'time' => $shorted_time_on_batteries, long => 1, translate => 1}).")", shorted_time_on_batteries => $shorted_time_on_batteries." (".$anvil->Convert->time({'time' => $shorted_time_on_batteries, long => 1, translate => 1}).")",
}}); }});
} }
@ -527,7 +527,7 @@ LIMIT 1
$power_health = 1; $power_health = 1;
$ups_with_mains_found = 1; $ups_with_mains_found = 1;
$shorted_time_on_batteries = 0; $shorted_time_on_batteries = 0;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
ups_with_mains_found => $ups_with_mains_found, ups_with_mains_found => $ups_with_mains_found,
shorted_time_on_batteries => $shorted_time_on_batteries, shorted_time_on_batteries => $shorted_time_on_batteries,
}}); }});
@ -535,7 +535,7 @@ LIMIT 1
if ($power_charge_percentage > $highest_charge_percentage) if ($power_charge_percentage > $highest_charge_percentage)
{ {
$highest_charge_percentage = $power_charge_percentage; $highest_charge_percentage = $power_charge_percentage;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { highest_charge_percentage => $highest_charge_percentage }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { highest_charge_percentage => $highest_charge_percentage }});
} }
} }
} }
@ -546,7 +546,7 @@ LIMIT 1
{ {
# No UPSes found. # No UPSes found.
$shorted_time_on_batteries = 0; $shorted_time_on_batteries = 0;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { shorted_time_on_batteries => $shorted_time_on_batteries }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { shorted_time_on_batteries => $shorted_time_on_batteries }});
} }
return($power_health, $shorted_time_on_batteries, $highest_charge_percentage, $estimated_hold_up_time); return($power_health, $shorted_time_on_batteries, $highest_charge_percentage, $estimated_hold_up_time);
@ -717,7 +717,7 @@ sub post_scan_analysis_striker
count => 3, count => 3,
ping => $ip_address, ping => $ip_address,
}); });
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
pinged => $pinged, pinged => $pinged,
average_time => $average_time, average_time => $average_time,
}}); }});
@ -729,7 +729,7 @@ sub post_scan_analysis_striker
user => "root", user => "root",
password => $password, password => $password,
}); });
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { access => $access }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { access => $access }});
if ($access) if ($access)
{ {
# It's up. # It's up.
@ -765,10 +765,10 @@ sub post_scan_analysis_striker
$shell_call .= " --action status"; $shell_call .= " --action status";
$shell_call =~ s/ --action/ --action/; $shell_call =~ s/ --action/ --action/;
my ($output, $return_code) = $anvil->System->call({debug => $debug, timeout => 30, shell_call => $shell_call}); my ($output, $return_code) = $anvil->System->call({debug => $debug, timeout => 30, shell_call => $shell_call});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { output => $output, return_code => $return_code }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { output => $output, return_code => $return_code }});
foreach my $line (split/\n/, $output) foreach my $line (split/\n/, $output)
{ {
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { line => $line }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { line => $line }});
} }
if ($return_code eq "2") if ($return_code eq "2")
@ -798,17 +798,17 @@ AND
AND AND
variable_source_uuid = ".$anvil->Database->quote($host_uuid)." variable_source_uuid = ".$anvil->Database->quote($host_uuid)."
;"; ;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
my $results = $anvil->Database->query({query => $query, source => $THIS_FILE, line => __LINE__}); my $results = $anvil->Database->query({query => $query, source => $THIS_FILE, line => __LINE__});
my $count = @{$results}; my $count = @{$results};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
results => $results, results => $results,
count => $count, count => $count,
}}); }});
if ($count) if ($count)
{ {
$stop_reason = $results->[0]->[0]; $stop_reason = $results->[0]->[0];
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { stop_reason => $stop_reason }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { stop_reason => $stop_reason }});
} }
if (not $stop_reason) if (not $stop_reason)
@ -834,7 +834,7 @@ AND
host_uuid => $host_uuid, host_uuid => $host_uuid,
host_name => $host_name, host_name => $host_name,
}); });
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
power_health => $power_health, power_health => $power_health,
shorted_time_on_batteries => $shorted_time_on_batteries, shorted_time_on_batteries => $shorted_time_on_batteries,
highest_charge_percentage => $highest_charge_percentage, highest_charge_percentage => $highest_charge_percentage,
@ -853,7 +853,7 @@ AND
"scancore::power::safe_boot_percentage" => $anvil->data->{scancore}{power}{safe_boot_percentage}, "scancore::power::safe_boot_percentage" => $anvil->data->{scancore}{power}{safe_boot_percentage},
}}); }});
} }
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
highest_charge_percentage => $highest_charge_percentage, highest_charge_percentage => $highest_charge_percentage,
"scancore::power::safe_boot_percentage" => $anvil->data->{scancore}{power}{safe_boot_percentage}, "scancore::power::safe_boot_percentage" => $anvil->data->{scancore}{power}{safe_boot_percentage},
}}); }});
@ -863,7 +863,7 @@ AND
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0574", variables => { host_name => $host_name }}); $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0574", variables => { host_name => $host_name }});
$shell_call =~ s/--action status/ --action on/; $shell_call =~ s/--action status/ --action on/;
my ($output, $return_code) = $anvil->System->call({debug => $debug, timeout => 30, shell_call => $shell_call}); my ($output, $return_code) = $anvil->System->call({debug => $debug, timeout => 30, shell_call => $shell_call});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { shell_call => $shell_call }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { shell_call => $shell_call }});
} }
} }
} }
@ -876,7 +876,7 @@ AND
debug => 2, debug => 2,
fence_ipmilan_command => $host_ipmi, fence_ipmilan_command => $host_ipmi,
}); });
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
ipmitool_command => $ipmitool_command, ipmitool_command => $ipmitool_command,
ipmi_password => $anvil->Log->is_secure($ipmi_password), ipmi_password => $anvil->Log->is_secure($ipmi_password),
}}); }});
@ -902,7 +902,7 @@ AND
my $current_value = $anvil->data->{ipmi}{$host_name}{scan_ipmitool_sensor_name}{$sensor_name}{scan_ipmitool_value_sensor_value}; my $current_value = $anvil->data->{ipmi}{$host_name}{scan_ipmitool_sensor_name}{$sensor_name}{scan_ipmitool_value_sensor_value};
my $units = $anvil->data->{ipmi}{$host_name}{scan_ipmitool_sensor_name}{$sensor_name}{scan_ipmitool_sensor_units}; my $units = $anvil->data->{ipmi}{$host_name}{scan_ipmitool_sensor_name}{$sensor_name}{scan_ipmitool_sensor_units};
my $status = $anvil->data->{ipmi}{$host_name}{scan_ipmitool_sensor_name}{$sensor_name}{scan_ipmitool_sensor_status}; my $status = $anvil->data->{ipmi}{$host_name}{scan_ipmitool_sensor_name}{$sensor_name}{scan_ipmitool_sensor_status};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
current_value => $current_value, current_value => $current_value,
sensor_name => $sensor_name, sensor_name => $sensor_name,
units => $units, units => $units,
@ -917,19 +917,19 @@ AND
{ {
# We've found at least one temperature sensor. # We've found at least one temperature sensor.
$sensor_found = 1; $sensor_found = 1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { sensor_found => $sensor_found }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { sensor_found => $sensor_found }});
} }
if ($status ne "ok") if ($status ne "ok")
{ {
# Sensor isn't OK yet. # Sensor isn't OK yet.
$temperatures_ok = 0; $temperatures_ok = 0;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { temperatures_ok => $temperatures_ok }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { temperatures_ok => $temperatures_ok }});
} }
} }
} }
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
sensor_found => $sensor_found, sensor_found => $sensor_found,
temperatures_ok => $temperatures_ok, temperatures_ok => $temperatures_ok,
}}); }});
@ -942,7 +942,7 @@ AND
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0575", variables => { host_name => $host_name }}); $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0575", variables => { host_name => $host_name }});
$shell_call =~ s/--action status/ --action on/; $shell_call =~ s/--action status/ --action on/;
my ($output, $return_code) = $anvil->System->call({debug => $debug, timeout => 30, shell_call => $shell_call}); my ($output, $return_code) = $anvil->System->call({debug => $debug, timeout => 30, shell_call => $shell_call});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { shell_call => $shell_call }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { shell_call => $shell_call }});
} }
} }
} }
@ -1006,7 +1006,7 @@ sub _scan_directory
# If I am still alive, I am looking at a scan agent! # If I am still alive, I am looking at a scan agent!
$anvil->data->{scancore}{agent}{$file} = $full_path; $anvil->data->{scancore}{agent}{$file} = $full_path;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
"scancore::agent::${file}" => $anvil->data->{scancore}{agent}{$file}, "scancore::agent::${file}" => $anvil->data->{scancore}{agent}{$file},
}}); }});
} }

@ -31,6 +31,13 @@ dist_drbd_DATA = \
dist_drbd_SCRIPTS = \ dist_drbd_SCRIPTS = \
scan-drbd/scan-drbd scan-drbd/scan-drbd
filesystemsdir = ${targetdir}/scan-filesystems
dist_filesystems_DATA = \
scan-filesystems/scan-filesystems.xml \
scan-filesystems/scan-filesystems.sql
dist_filesystems_SCRIPTS = \
scan-filesystems/scan-filesystems
hardwaredir = ${targetdir}/scan-hardware hardwaredir = ${targetdir}/scan-hardware
dist_hardware_DATA = \ dist_hardware_DATA = \
scan-hardware/scan-hardware.xml \ scan-hardware/scan-hardware.xml \

@ -18,18 +18,6 @@ NOTE: All string keys MUST be prefixed with the agent name! ie: 'scan_server_log
<!-- Error entries --> <!-- Error entries -->
<key name="scan_drbd_error_0001">DRBD is not configured on this host, exiting.</key> <key name="scan_drbd_error_0001">DRBD is not configured on this host, exiting.</key>
<key name="scan_drbd_error_0002">The call to 'drbdadm dump-xml' returned the exit code: [#!variable!return_code!#].</key>
<key name="scan_drbd_error_0003">[ Warning ] - Failed to parse the DRBD XML. The XML read was:
========
#!variable!xml!#
========
The error was:
========
#!variable!error!#
========
</key>
<!-- Error entries --> <!-- Error entries -->
<key name="scan_drbd_log_0001">Starting The: [#!variable!program!#] DRBD resource agent.</key> <key name="scan_drbd_log_0001">Starting The: [#!variable!program!#] DRBD resource agent.</key>

@ -877,11 +877,13 @@ INSERT INTO
scan_ipmitool_values scan_ipmitool_values
( (
scan_ipmitool_value_uuid, scan_ipmitool_value_uuid,
scan_ipmitool_value_host_uuid,
scan_ipmitool_value_scan_ipmitool_uuid, scan_ipmitool_value_scan_ipmitool_uuid,
scan_ipmitool_value_sensor_value, scan_ipmitool_value_sensor_value,
modified_date modified_date
) VALUES ( ) VALUES (
".$anvil->Database->quote($scan_ipmitool_value_uuid).", ".$anvil->Database->quote($scan_ipmitool_value_uuid).",
".$anvil->Database->quote($anvil->Get->host_uuid).",
".$anvil->Database->quote($scan_ipmitool_uuid).", ".$anvil->Database->quote($scan_ipmitool_uuid).",
".$anvil->Database->quote($new_scan_ipmitool_value_sensor_value).", ".$anvil->Database->quote($new_scan_ipmitool_value_sensor_value).",
".$anvil->Database->quote($anvil->data->{sys}{database}{timestamp})." ".$anvil->Database->quote($anvil->data->{sys}{database}{timestamp})."

@ -78,6 +78,7 @@ CREATE TRIGGER trigger_scan_ipmitool
-- possible. -- possible.
CREATE TABLE scan_ipmitool_values ( CREATE TABLE scan_ipmitool_values (
scan_ipmitool_value_uuid uuid not null primary key, scan_ipmitool_value_uuid uuid not null primary key,
scan_ipmitool_value_host_uuid uuid not null,
scan_ipmitool_value_scan_ipmitool_uuid uuid not null, scan_ipmitool_value_scan_ipmitool_uuid uuid not null,
scan_ipmitool_value_sensor_value numeric not null, scan_ipmitool_value_sensor_value numeric not null,
modified_date timestamp with time zone not null, modified_date timestamp with time zone not null,
@ -89,6 +90,7 @@ ALTER TABLE scan_ipmitool_values OWNER TO admin;
CREATE TABLE history.scan_ipmitool_values ( CREATE TABLE history.scan_ipmitool_values (
history_id uuid, history_id uuid,
scan_ipmitool_value_uuid uuid, scan_ipmitool_value_uuid uuid,
scan_ipmitool_value_host_uuid uuid,
scan_ipmitool_value_scan_ipmitool_uuid uuid, scan_ipmitool_value_scan_ipmitool_uuid uuid,
scan_ipmitool_value_sensor_value numeric, scan_ipmitool_value_sensor_value numeric,
modified_date timestamp with time zone not null modified_date timestamp with time zone not null
@ -103,11 +105,13 @@ BEGIN
SELECT INTO history_scan_ipmitool_values * FROM scan_ipmitool_values WHERE scan_ipmitool_value_uuid=new.scan_ipmitool_value_uuid; SELECT INTO history_scan_ipmitool_values * FROM scan_ipmitool_values WHERE scan_ipmitool_value_uuid=new.scan_ipmitool_value_uuid;
INSERT INTO history.scan_ipmitool_values INSERT INTO history.scan_ipmitool_values
(scan_ipmitool_value_uuid, (scan_ipmitool_value_uuid,
scan_ipmitool_value_host_uuid,
scan_ipmitool_value_scan_ipmitool_uuid, scan_ipmitool_value_scan_ipmitool_uuid,
scan_ipmitool_value_sensor_value, scan_ipmitool_value_sensor_value,
modified_date) modified_date)
VALUES VALUES
(history_scan_ipmitool_values.scan_ipmitool_value_uuid, (history_scan_ipmitool_values.scan_ipmitool_value_uuid,
history_scan_ipmitool_values.scan_ipmitool_value_host_uuid,
history_scan_ipmitool_values.scan_ipmitool_value_scan_ipmitool_uuid, history_scan_ipmitool_values.scan_ipmitool_value_scan_ipmitool_uuid,
history_scan_ipmitool_values.scan_ipmitool_value_sensor_value, history_scan_ipmitool_values.scan_ipmitool_value_sensor_value,
history_scan_ipmitool_values.modified_date); history_scan_ipmitool_values.modified_date);

@ -24,6 +24,10 @@
-- thing is on (as opposed to a record bound to a host_uuid), be sure to add the table name to the -- thing is on (as opposed to a record bound to a host_uuid), be sure to add the table name to the
-- excluded list in Database->_find_behind_databases(). -- excluded list in Database->_find_behind_databases().
-- --
-- NOTE: When developing Scan Agents; If an agent's data is tied to a host, all tables in the SQL schema for
-- that agent need to also be tied to the host so that resyncs of sub tables don't sync when they
-- shouldn't.
--
-- Most tables will want to have a matching table in the history schema with an additional -- Most tables will want to have a matching table in the history schema with an additional
-- 'history_id bigserial' column. Match the function and trigger seen elsewhere to copy your data from the -- 'history_id bigserial' column. Match the function and trigger seen elsewhere to copy your data from the
-- public schema to the history schema on UPDATE or INSERT. -- public schema to the history schema on UPDATE or INSERT.
@ -32,8 +36,6 @@
-- each that you plan to link, still use a '*_host_uuid' column (if the data is host-specific). This is -- each that you plan to link, still use a '*_host_uuid' column (if the data is host-specific). This is
-- needed by the resync method. -- needed by the resync method.
-- --
-- NOTE: If you add, rename or remove a table, remember to update the 'sys::database::core_tables' array!
--
SET client_encoding = 'UTF8'; SET client_encoding = 'UTF8';

@ -342,6 +342,19 @@ Output (if any):
<key name="error_0248">Failed to add the UPS: [#!variable!ups_name!#] at: [#!variable!aups_ip_address!#] using the agent: [#!variable!ups_agent!#]!</key> <key name="error_0248">Failed to add the UPS: [#!variable!ups_name!#] at: [#!variable!aups_ip_address!#] using the agent: [#!variable!ups_agent!#]!</key>
<key name="error_0249">Failed to add the fence device: [#!variable!fence_name!#] using the agent: [#!variable!fence_agent!#]!</key> <key name="error_0249">Failed to add the fence device: [#!variable!fence_name!#] using the agent: [#!variable!fence_agent!#]!</key>
<key name="error_0250">This machine is a an active cluster member, aborting job.</key> <key name="error_0250">This machine is a an active cluster member, aborting job.</key>
<key name="error_0251">We were asked to call 'drbdadm' but it doesn't exist. Is DRBD installed?</key>
<key name="error_0252">The call to 'drbdadm dump-xml' returned the exit code: [#!variable!return_code!#].</key>
<key name="error_0253">[ Warning ] - Failed to parse the DRBD XML. The XML read was:
========
#!variable!xml!#
========
The error was:
========
#!variable!error!#
========
</key>
<!-- Files templates --> <!-- Files templates -->
<!-- NOTE: Translating these files requires an understanding of which likes are translatable --> <!-- NOTE: Translating these files requires an understanding of which likes are translatable -->

@ -1,6 +1,6 @@
#!/usr/bin/perl #!/usr/bin/perl
# #
# This is the main ScanCore program. It is started/killed/recovered by anvil-daemon. # This is the main ScanCore program. It is managed by systemd
# #
# Examples; # Examples;
# #

Loading…
Cancel
Save