* Fixed a bug in System->collect_ipmi_data() where double-quoted passwords were preventing reading of the sensor data.

* Added a new table to the main SQL schema to allow for more dynamic tracking of which Anvil! node pairs can use which DR hosts.

Signed-off-by: Digimer <digimer@alteeve.ca>
main
Digimer 2 years ago
parent 4fa8d7a446
commit f6cbe7d1d2
  1. 8
      Anvil/Tools/ScanCore.pm
  2. 6
      Anvil/Tools/System.pm
  3. 49
      share/anvil.sql

@ -2488,7 +2488,12 @@ LIMIT 1;";
} }
} }
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { check_power => $check_power }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
check_power => $check_power,
short_host_name => $short_host_name,
host_ipmi => $host_ipmi,
host_status => $host_status,
}});
if (not $check_power) if (not $check_power)
{ {
next; next;
@ -2681,7 +2686,6 @@ LIMIT 1;";
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0672", variables => { host_name => $host_name }}); $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0672", variables => { host_name => $host_name }});
# Check power # Check power
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0567", variables => { host_name => $host_name }});
my ($power_health, $shortest_time_on_batteries, $highest_charge_percentage, $estimated_hold_up_time) = $anvil->ScanCore->check_power({ my ($power_health, $shortest_time_on_batteries, $highest_charge_percentage, $estimated_hold_up_time) = $anvil->ScanCore->check_power({
debug => $debug, debug => $debug,
anvil_uuid => $anvil_uuid, anvil_uuid => $anvil_uuid,

@ -1458,6 +1458,12 @@ sub collect_ipmi_data
return('!!error!!'); return('!!error!!');
} }
# Take the double-quotes off the password.
$ipmi_password =~ s/^"(.*)"$/$1/;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
ipmi_password => $anvil->Log->is_secure($ipmi_password),
}});
my $read_start_time = time; my $read_start_time = time;
# If there is a password, write it to a temp file. # If there is a password, write it to a temp file.

@ -408,6 +408,55 @@ CREATE TRIGGER trigger_anvils
FOR EACH ROW EXECUTE PROCEDURE history_anvils(); FOR EACH ROW EXECUTE PROCEDURE history_anvils();
-- This is the new method of tracking DR hosts and while Anvil! node pairs they can back up. This allows DR
-- hosts to protect multiple nodes, and allow multiple DRs to protect one node pair.
CREATE TABLE dr_links (
dr_link_uuid uuid not null primary key,
dr_link_host_uuid uuid not null,
dr_link_anvil_uuid uuid not null,
modified_date timestamp with time zone not null,
FOREIGN KEY(dr_link_host_uuid) REFERENCES hosts(host_uuid),
FOREIGN KEY(dr_link_anvil_uuid) REFERENCES anvils(anvil_uuid)
);
ALTER TABLE dr_links OWNER TO admin;
CREATE TABLE history.dr_links (
history_id bigserial,
dr_link_uuid uuid,
dr_link_host_uuid uuid,
dr_link_anvil_uuid uuid,
modified_date timestamp with time zone not null
);
ALTER TABLE history.dr_links OWNER TO admin;
CREATE FUNCTION history_dr_links() RETURNS trigger
AS $$
DECLARE
history_dr_links RECORD;
BEGIN
SELECT INTO history_dr_links * FROM dr_links WHERE dr_link_uuid = new.dr_link_uuid;
INSERT INTO history.dr_links
(dr_link_uuid,
dr_link_host_uuid,
dr_link_anvil_uuid,
modified_date)
VALUES
(history_dr_links.dr_link_uuid,
history_dr_links.dr_link_host_uuid,
history_dr_links.dr_link_anvil_uuid,
history_dr_links.modified_date);
RETURN NULL;
END;
$$
LANGUAGE plpgsql;
ALTER FUNCTION history_dr_links() OWNER TO admin;
CREATE TRIGGER trigger_dr_links
AFTER INSERT OR UPDATE ON dr_links
FOR EACH ROW EXECUTE PROCEDURE history_dr_links();
-- This stores alerts coming in from various sources -- This stores alerts coming in from various sources
CREATE TABLE alerts ( CREATE TABLE alerts (
alert_uuid uuid not null primary key, alert_uuid uuid not null primary key,

Loading…
Cancel
Save