* Created Convert->celsius_to_fahrenheit, ->fahrenheit_to_celsius and ->format_mmddyy_to_yymmdd.

* Created (but not yet finished) scan-apc-ups.

Signed-off-by: Digimer <digimer@alteeve.ca>
main
Digimer 4 years ago
parent 18eba9bb55
commit 7516047c15
  1. 172
      Anvil/Tools/Convert.pm
  2. 7
      scancore-agents/scan-apc-pdu/scan-apc-pdu
  3. 7
      scancore-agents/scan-apc-pdu/scan-apc-pdu.xml
  4. 4467
      scancore-agents/scan-apc-ups/scan-apc-ups
  5. 317
      scancore-agents/scan-apc-ups/scan-apc-ups.sql
  6. 158
      scancore-agents/scan-apc-ups/scan-apc-ups.xml
  7. 2
      share/words.xml

@ -14,7 +14,10 @@ my $THIS_FILE = "Convert.pm";
### Methods;
# add_commas
# bytes_to_human_readable
# celsius_to_fahrenheit
# cidr
# fahrenheit_to_celsius
# format_mmddyy_to_yymmdd
# host_name_to_ip
# human_readable_to_bytes
# round
@ -80,6 +83,7 @@ sub parent
# Public methods #
#############################################################################################################
=head2 add_commas
This takes an integer and inserts commas to make it more readable by people.
@ -138,6 +142,7 @@ sub add_commas
return ($number);
}
=head2 bytes_to_human_readable
This takes a number of bytes and converts it to a a human-readable format. Optionally, you can request the human readable size be returned using specific units.
@ -490,6 +495,61 @@ sub bytes_to_human_readable
return($human_readable_size);
}
=head3 celsius_to_fahrenheit
This takes value and converts it from celsius to fahrenheit. If there is a problem, C<< !!error!! >> is returned.
Parameters;
=head3 temperature (required)
This is the temperature to convert from fahrenheit to celsius.
=cut
sub celsius_to_fahrenheit
{
my $self = shift;
my $parameter = shift;
my $anvil = $self->parent;
my $debug = defined $parameter->{debug} ? $parameter->{debug} : 3;
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0125", variables => { method => "Convert->celsius_to_fahrenheit()" }});
# Now see if the user passed the values in a hash reference or directly.
my $temperature = defined $parameter->{temperature} ? $parameter->{temperature} : "";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { temperature => $temperature }});
if (not $temperature)
{
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 0, priority => "err", key => "log_0020", variables => { method => "Convert->celsius_to_fahrenheit()", parameter => "temperature" }});
return("!!error!!");
}
if ($temperature !~ /^\d/)
{
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 0, priority => "err", key => "error_0165", variables => { $temperature => temperature }});
return("!!error!!");
}
# Split off the value from the suffix, if any.
if ($temperature =~ /^(\d+\.\d+).*/)
{
$temperature = $1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { temperature => $temperature }});
}
elsif ($temperature =~ /^(\d+)(.*)/)
{
$temperature = $1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { temperature => $temperature }});
}
# Convert the temperature.
my $new_temperature = (($temperature * 1.8) + 32);
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { new_temperature => $new_temperature }});
return($new_temperature);
}
=head2 cidr
This takes an IPv4 CIDR notation and returns the dotted-decimal subnet mask, or the reverse.
@ -611,6 +671,115 @@ sub cidr
return($output);
}
=head3 fahrenheit_to_celsius
This takes value and converts it from fahrenheit to celsius. If there is a problem, C<< !!error!! >> is returned.
Parameters;
=head3 temperature (required)
This is the temperature to convert from celsius to fahrenheit.
=cut
sub fahrenheit_to_celsius
{
my $self = shift;
my $parameter = shift;
my $anvil = $self->parent;
my $debug = defined $parameter->{debug} ? $parameter->{debug} : 3;
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0125", variables => { method => "Convert->fahrenheit_to_celsius()" }});
# Now see if the user passed the values in a hash reference or directly.
my $temperature = defined $parameter->{temperature} ? $parameter->{temperature} : "";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { temperature => $temperature }});
if (not $temperature)
{
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 0, priority => "err", key => "log_0020", variables => { method => "Convert->fahrenheit_to_celsius()", parameter => "temperature" }});
return("!!error!!");
}
if ($temperature !~ /^\d/)
{
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 0, priority => "err", key => "error_0165", variables => { $temperature => temperature }});
return("!!error!!");
}
# Split off the value from the suffix, if any.
if ($temperature =~ /^(\d+\.\d+).*/)
{
$temperature = $1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { temperature => $temperature }});
}
elsif ($temperature =~ /^(\d+)(.*)/)
{
$temperature = $1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { temperature => $temperature }});
}
# Convert the temperature.
my $new_temperature = (($temperature - 32) / 1.8);
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { new_temperature => $new_temperature }});
return($new_temperature);
}
=head2 format_mmddyy_to_yymmdd
This converts a C<< mm/dd/yy >> or C<< mm/dd/yyyy >> string into the more sensible yy/mm/dd or yyyy/mm/dd string.
Returns C<< !!error!! >> if something goes wrong.
Parameters;
=head3 date (required)
This is the C<< mm/dd/yy >> or C<< mm/dd/yyyy >> format to be converted.
=cut
sub format_mmddyy_to_yymmdd
{
my $self = shift;
my $parameter = shift;
my $anvil = $self->parent;
my $debug = defined $parameter->{debug} ? $parameter->{debug} : 3;
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0125", variables => { method => "Convert->format_mmddyy_to_yymmdd()" }});
my $date = defined $parameter->{date} ? $parameter->{date} : "";
my $output = "";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
date => $date,
}});
if (not $date)
{
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 0, priority => "err", key => "log_0020", variables => { method => "Convert->host_name_to_ip()", parameter => "host_name" }});
return("!!error!!");
}
# Split off the value from the suffix, if any.
if ($date =~ /^(\d\d)\/(\d\d)\/(\d\d\d\d)/)
{
$date = "$3/$1/$2";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { date => $date }});
}
elsif ($date =~ /^(\d\d)\/(\d\d)\/(\d\d)/)
{
$date = "$3/$1/$2";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { date => $date }});
}
else
{
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 0, priority => "err", key => "error_0164", variables => { date => $date }});
return("!!error!!");
}
return($date);
}
=head2 host_name_to_ip
This method takes a host name and tries to convert it to an IP address. If it fails, it will return C<< 0 >>.
@ -664,6 +833,7 @@ sub host_name_to_ip
return($ip);
}
=head2 human_readable_to_bytes
This takes a "human readable" size with an ISO suffix and converts it back to a base byte size as accurately as possible.
@ -866,6 +1036,7 @@ sub human_readable_to_bytes
return ($bytes);
}
=head2 round
This takes a number and rounds it to a given number of places after the decimal (defaulting to an even integer). This does financial-type rounding.
@ -988,6 +1159,7 @@ sub round
return ($rounded_number);
}
=head2 time
This takes a number of seconds and converts it into a human readable string. Returns C<< #!error!# >> is an error is encountered.

@ -477,7 +477,7 @@ FROM
}
return($count);
return(0);
}
# This reads in the last scan data from one of the databases and compares it against the just-read data. If
@ -486,11 +486,6 @@ sub find_changes
{
my ($anvil) = @_;
# If we can't ping or can't connect to a PDU, these keys will be used to see how long that's been the
# case to decide when to send an alert.
#my $ping_condition_key = "scan-apc-pdu::".$fence_uuid."::no_ping";
#my $connection_condition_key = "scan-apc-pdu::".$fence_uuid."::no_connection";
# This stores all the queries so that they're committed in one transaction.
$anvil->data->{sys}{queries} = [];

@ -9,12 +9,9 @@ NOTE: All string keys MUST be prefixed with the agent name! ie: 'scan_apc_pdu_lo
-->
<words>
<meta version="3.0.0" languages="en_CA,jp"/>
<meta version="3.0.0" languages="en_CA"/>
<!-- Canadian English -->
<language name="en_CA" long_name="Canadian English" description="ScanCore scan agent that monitors hardware, like RAM modules, CSS LED status, CPU information, etc.">
<!-- Alert entries -->
<key name="scan_apc_pdu_alert_0001"></key>
<language name="en_CA" long_name="Canadian English" description="ScanCore scan agent that monitors APC-brand switched PDUs.">
<!-- Error entries -->
<key name="scan_apc_pdu_error_0001">Failed to read the number of phases for the PDU: [#!variable!name!#] at IP: [#!variable!ip!#] (sn: #!variable!serial_number!#).</key>

File diff suppressed because it is too large Load Diff

@ -0,0 +1,317 @@
-- This is the database schema for the 'APC UPS Scan Agent'.
CREATE TABLE scan_apc_upses (
scan_apc_ups_uuid uuid not null primary key,
scan_apc_ups_ups_uuid uuid not null,
scan_apc_ups_serial_number text not null,
scan_apc_ups_name text not null,
scan_apc_ups_ip text not null,
scan_apc_ups_ac_restore_delay numeric not null,
scan_apc_ups_shutdown_delay numeric not null,
scan_apc_ups_firmware_version text not null,
scan_apc_ups_health numeric not null,
scan_apc_ups_high_transfer_voltage numeric not null,
scan_apc_ups_low_transfer_voltage numeric not null,
scan_apc_ups_last_transfer_reason numeric not null,
scan_apc_ups_manufactured_date text not null,
scan_apc_ups_model text not null,
scan_apc_ups_temperature_units text not null,
scan_apc_ups_nmc_firmware_version text not null,
scan_apc_ups_nmc_serial_number text not null,
scan_apc_ups_nmc_mac_address text not null,
modified_date timestamp with time zone not null,
FOREIGN KEY(scan_apc_ups_ups_uuid) REFERENCES upses(ups_uuid)
);
ALTER TABLE scan_apc_upses OWNER TO admin;
CREATE TABLE history.scan_apc_upses (
history_id bigserial,
scan_apc_ups_uuid uuid,
scan_apc_ups_ups_uuid uuid,
scan_apc_ups_serial_number text,
scan_apc_ups_name text,
scan_apc_ups_ip text,
scan_apc_ups_ac_restore_delay numeric,
scan_apc_ups_shutdown_delay numeric,
scan_apc_ups_firmware_version text,
scan_apc_ups_health numeric,
scan_apc_ups_high_transfer_voltage numeric,
scan_apc_ups_low_transfer_voltage numeric,
scan_apc_ups_last_transfer_reason numeric,
scan_apc_ups_manufactured_date text,
scan_apc_ups_model text,
scan_apc_ups_temperature_units text,
scan_apc_ups_nmc_firmware_version text,
scan_apc_ups_nmc_serial_number text,
scan_apc_ups_nmc_mac_address text,
modified_date timestamp with time zone not null
);
ALTER TABLE history.scan_apc_upses OWNER TO admin;
CREATE FUNCTION history_scan_apc_upses() RETURNS trigger
AS $$
DECLARE
history_scan_apc_upses RECORD;
BEGIN
SELECT INTO history_scan_apc_upses * FROM scan_apc_upses WHERE scan_apc_ups_uuid=new.scan_apc_ups_uuid;
INSERT INTO history.scan_apc_upses
(scan_apc_ups_uuid,
scan_apc_ups_serial_number,
scan_apc_ups_name,
scan_apc_ups_ip,
scan_apc_ups_ac_restore_delay,
scan_apc_ups_shutdown_delay,
scan_apc_ups_firmware_version,
scan_apc_ups_health,
scan_apc_ups_high_transfer_voltage,
scan_apc_ups_low_transfer_voltage,
scan_apc_ups_last_transfer_reason,
scan_apc_ups_manufactured_date,
scan_apc_ups_model,
scan_apc_ups_temperature_units,
scan_apc_ups_nmc_firmware_version,
scan_apc_ups_nmc_serial_number,
scan_apc_ups_nmc_mac_address,
modified_date)
VALUES
(history_scan_apc_ups.scan_apc_ups_uuid,
history_scan_apc_ups.scan_apc_ups_serial_number,
history_scan_apc_ups.scan_apc_ups_name,
history_scan_apc_ups.scan_apc_ups_ip,
history_scan_apc_ups.scan_apc_ups_ac_restore_delay,
history_scan_apc_ups.scan_apc_ups_shutdown_delay,
history_scan_apc_ups.scan_apc_ups_firmware_version,
history_scan_apc_ups.scan_apc_ups_health,
history_scan_apc_ups.scan_apc_ups_high_transfer_voltage,
history_scan_apc_ups.scan_apc_ups_low_transfer_voltage,
history_scan_apc_ups.scan_apc_ups_last_transfer_reason,
history_scan_apc_ups.scan_apc_ups_manufactured_date,
history_scan_apc_ups.scan_apc_ups_model,
history_scan_apc_ups.scan_apc_ups_temperature_units,
history_scan_apc_ups.scan_apc_ups_nmc_firmware_version,
history_scan_apc_ups.scan_apc_ups_nmc_serial_number,
history_scan_apc_ups.scan_apc_ups_nmc_mac_address,
history_scan_apc_ups.modified_date);
RETURN NULL;
END;
$$
LANGUAGE plpgsql;
ALTER FUNCTION history_scan_apc_upses() OWNER TO admin;
CREATE TRIGGER trigger_scan_apc_upses
AFTER INSERT OR UPDATE ON scan_apc_upses
FOR EACH ROW EXECUTE PROCEDURE history_scan_apc_upses();
-- Battery stuff
CREATE TABLE scan_apc_ups_batteries (
scan_apc_ups_battery_uuid uuid not null primary key,
scan_apc_ups_battery_scan_apc_ups_uuid uuid not null,
scan_apc_ups_battery_number numeric not null,
scan_apc_ups_battery_replacement_date text not null,
scan_apc_ups_battery_health numeric not null,
scan_apc_ups_battery_model text not null,
scan_apc_ups_battery_percentage_charge numeric not null,
scan_apc_ups_battery_last_replacement_date text not null,
scan_apc_ups_battery_state numeric not null,
scan_apc_ups_battery_temperature numeric not null,
scan_apc_ups_battery_alarm_temperature numeric not null,
scan_apc_ups_battery_voltage numeric not null,
modified_date timestamp with time zone not null,
FOREIGN KEY(scan_apc_ups_battery_scan_apc_ups_uuid) REFERENCES scan_apc_upses(scan_apc_ups_uuid)
);
ALTER TABLE scan_apc_ups_battery OWNER TO admin;
CREATE TABLE history.scan_apc_ups_batteries (
history_id bigserial,
scan_apc_ups_battery_uuid uuid,
scan_apc_ups_battery_scan_apc_ups_uuid uuid,
scan_apc_ups_battery_number numeric,
scan_apc_ups_battery_replacement_date text,
scan_apc_ups_battery_health numeric,
scan_apc_ups_battery_model text,
scan_apc_ups_battery_percentage_charge numeric,
scan_apc_ups_battery_last_replacement_date text,
scan_apc_ups_battery_state numeric,
scan_apc_ups_battery_temperature numeric,
scan_apc_ups_battery_alarm_temperature numeric,
scan_apc_ups_battery_voltage numeric,
modified_date timestamp with time zone not null
);
ALTER TABLE history.scan_apc_ups_batteries OWNER TO admin;
CREATE FUNCTION history_scan_apc_ups_batteries() RETURNS trigger
AS $$
DECLARE
history_scan_apc_ups_batteries RECORD;
BEGIN
SELECT INTO history_scan_apc_ups_batteries * FROM scan_apc_ups_batteries WHERE scan_apc_ups_battery_uuid=new.scan_apc_ups_battery_uuid;
INSERT INTO history.scan_apc_ups_batteries
(scan_apc_ups_battery_uuid,
scan_apc_ups_battery_scan_apc_ups_uuid,
scan_apc_ups_battery_number,
scan_apc_ups_battery_replacement_date,
scan_apc_ups_battery_health,
scan_apc_ups_battery_model,
scan_apc_ups_battery_percentage_charge,
scan_apc_ups_battery_last_replacement_date,
scan_apc_ups_battery_state,
scan_apc_ups_battery_temperature,
scan_apc_ups_battery_alarm_temperature,
scan_apc_ups_battery_voltage,
modified_date)
VALUES
(history_scan_apc_ups_battery.scan_apc_ups_battery_uuid,
history_scan_apc_ups_battery.scan_apc_ups_battery_scan_apc_ups_uuid,
history_scan_apc_ups_battery.scan_apc_ups_battery_number,
history_scan_apc_ups_battery.scan_apc_ups_battery_replacement_date,
history_scan_apc_ups_battery.scan_apc_ups_battery_health,
history_scan_apc_ups_battery.scan_apc_ups_battery_model,
history_scan_apc_ups_battery.scan_apc_ups_battery_percentage_charge,
history_scan_apc_ups_battery.scan_apc_ups_battery_last_replacement_date,
history_scan_apc_ups_battery.scan_apc_ups_battery_state,
history_scan_apc_ups_battery.scan_apc_ups_battery_temperature,
history_scan_apc_ups_battery.scan_apc_ups_battery_alarm_temperature,
history_scan_apc_ups_battery.scan_apc_ups_battery_voltage,
history_scan_apc_ups_battery.modified_date);
RETURN NULL;
END;
$$
LANGUAGE plpgsql;
ALTER FUNCTION history_scan_apc_ups_batteries() OWNER TO admin;
CREATE TRIGGER trigger_scan_apc_ups_batteries
AFTER INSERT OR UPDATE ON scan_apc_ups_batteries
FOR EACH ROW EXECUTE PROCEDURE history_scan_apc_ups_batteries();
-- Input power
CREATE TABLE scan_apc_ups_input (
scan_apc_ups_input_uuid uuid not null primary key,
scan_apc_ups_input_scan_apc_ups_uuid uuid not null,
scan_apc_ups_input_frequency numeric not null,
scan_apc_ups_input_sensitivity numeric not null,
scan_apc_ups_input_voltage numeric not null,
scan_apc_ups_input_1m_maximum_input_voltage numeric not null,
scan_apc_ups_input_1m_minimum_input_voltage numeric not null,
modified_date timestamp with time zone not null,
FOREIGN KEY(scan_apc_ups_input_scan_apc_ups_uuid) REFERENCES scan_apc_upses(scan_apc_ups_uuid)
);
ALTER TABLE scan_apc_ups_input OWNER TO admin;
CREATE TABLE history.scan_apc_ups_input (
history_id bigserial,
scan_apc_ups_input_uuid uuid,
scan_apc_ups_input_scan_apc_ups_uuid uuid,
scan_apc_ups_input_frequency numeric,
scan_apc_ups_input_sensitivity numeric,
scan_apc_ups_input_voltage numeric,
scan_apc_ups_input_1m_maximum_input_voltage numeric,
scan_apc_ups_input_1m_minimum_input_voltage numeric
modified_date timestamp with time zone not null
);
ALTER TABLE history.scan_apc_ups_input OWNER TO admin;
CREATE FUNCTION history_scan_apc_ups_input() RETURNS trigger
AS $$
DECLARE
history_scan_apc_ups_input RECORD;
BEGIN
SELECT INTO history_scan_apc_ups_input * FROM scan_apc_ups_input WHERE scan_apc_ups_input_uuid=new.scan_apc_ups_input_uuid;
INSERT INTO history.scan_apc_ups_input
(scan_apc_ups_input_uuid,
scan_apc_ups_input_scan_apc_ups_uuid,
scan_apc_ups_input_frequency,
scan_apc_ups_input_sensitivity,
scan_apc_ups_input_voltage,
scan_apc_ups_input_1m_maximum_input_voltage,
scan_apc_ups_input_1m_minimum_input_voltage,
modified_date)
VALUES
(history_scan_apc_ups_input.scan_apc_ups_input_uuid,
history_scan_apc_ups_input.scan_apc_ups_input_scan_apc_ups_uuid,
history_scan_apc_ups_input.scan_apc_ups_input_frequency,
history_scan_apc_ups_input.scan_apc_ups_input_sensitivity,
history_scan_apc_ups_input.scan_apc_ups_input_voltage,
history_scan_apc_ups_input.scan_apc_ups_input_1m_maximum_input_voltage,
history_scan_apc_ups_input.scan_apc_ups_input_1m_minimum_input_voltage,
history_scan_apc_ups_input.modified_date);
RETURN NULL;
END;
$$
LANGUAGE plpgsql;
ALTER FUNCTION history_scan_apc_ups_input() OWNER TO admin;
CREATE TRIGGER trigger_scan_apc_ups_input
AFTER INSERT OR UPDATE ON scan_apc_ups_input
FOR EACH ROW EXECUTE PROCEDURE history_scan_apc_ups_input();
-- Output power
CREATE TABLE scan_apc_ups_output (
scan_apc_ups_output_uuid uuid not null primary key,
scan_apc_ups_output_scan_apc_ups_uuid uuid not null,
scan_apc_ups_output_load_percentage numeric not null,
scan_apc_ups_output_time_on_batteries numeric not null,
scan_apc_ups_output_estimated_runtime numeric not null,
scan_apc_ups_output_frequency numeric not null,
scan_apc_ups_output_voltage numeric not null,
scan_apc_ups_output_total_output numeric not null,
modified_date timestamp with time zone not null,
FOREIGN KEY(scan_apc_ups_output_scan_apc_ups_uuid) REFERENCES scan_apc_upses(scan_apc_ups_uuid)
);
ALTER TABLE scan_apc_ups_output OWNER TO admin;
CREATE TABLE history.scan_apc_ups_output (
history_id bigserial,
scan_apc_ups_output_uuid uuid,
scan_apc_ups_output_scan_apc_ups_uuid uuid,
scan_apc_ups_output_load_percentage numeric,
scan_apc_ups_output_time_on_batteries numeric,
scan_apc_ups_output_estimated_runtime numeric,
scan_apc_ups_output_frequency numeric,
scan_apc_ups_output_voltage numeric,
scan_apc_ups_output_total_output numeric,
modified_date timestamp with time zone not null
);
ALTER TABLE history.scan_apc_ups_output OWNER TO admin;
CREATE FUNCTION history_scan_apc_ups_output() RETURNS trigger
AS $$
DECLARE
history_scan_apc_ups_output RECORD;
BEGIN
SELECT INTO history_scan_apc_ups_output * FROM scan_apc_ups_output WHERE scan_apc_ups_output_uuid=new.scan_apc_ups_output_uuid;
INSERT INTO history.scan_apc_ups_output
(scan_apc_ups_output_uuid,
scan_apc_ups_output_scan_apc_ups_uuid,
scan_apc_ups_output_load_percentage,
scan_apc_ups_output_time_on_batteries,
scan_apc_ups_output_estimated_runtime,
scan_apc_ups_output_frequency,
scan_apc_ups_output_voltage,
scan_apc_ups_output_total_output,
modified_date)
VALUES
(history_scan_apc_ups_output.scan_apc_ups_output_uuid,
history_scan_apc_ups_output.scan_apc_ups_output_scan_apc_ups_uuid,
history_scan_apc_ups_output.scan_apc_ups_output_load_percentage,
history_scan_apc_ups_output.scan_apc_ups_output_time_on_batteries,
history_scan_apc_ups_output.scan_apc_ups_output_estimated_runtime,
history_scan_apc_ups_output.scan_apc_ups_output_frequency,
history_scan_apc_ups_output.scan_apc_ups_output_voltage,
history_scan_apc_ups_output.scan_apc_ups_output_total_output,
history_scan_apc_ups_output.modified_date);
RETURN NULL;
END;
$$
LANGUAGE plpgsql;
ALTER FUNCTION history_scan_apc_ups_output() OWNER TO admin;
CREATE TRIGGER trigger_scan_apc_ups_output
AFTER INSERT OR UPDATE ON scan_apc_ups_output
FOR EACH ROW EXECUTE PROCEDURE history_scan_apc_ups_output();

@ -0,0 +1,158 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Company: Alteeve's Niche, Inc.
License: GPL v2+
Author: Madison Kelly <mkelly@alteeve.ca>
NOTE: All string keys MUST be prefixed with the agent name! ie: 'scan_apc_ups_log_0001'.
-->
<words>
<meta version="3.0.0" languages="en_CA"/>
<!-- Canadian English -->
<language name="en_CA" long_name="Canadian English" description="ScanCore scan agent that monitors APC-brand UPSes with NMCs installed.">
<!-- Errors -->
<key name="scan_apc_ups_error_0001">The variable: [#!variable!name!#] should have been an integer, but it appears it was not. Read: [#!variable!value!#].</key>
<!-- Log entries -->
<key name="scan_apc_ups_log_0001">Starting: [#!variable!program!#].</key>
<!-- Message entries (usually meant to be alerts) -->
<key name="scan_apc_ups_message_0001">No APC UPSes found as configured UPSes, nothing to do.</key>
<key name="scan_apc_ups_message_0002">A new APC UPS has been found;
-=] UPS Information:
- UPS Name: ....... [#!variable!name!#]
- Model: .......... [#!variable!model!#] (may not be exact)
- Serial Number: .. [#!variable!serial_number!#]
- Manufactured: ... [#!variable!manufactured_date!#] (yyyy/mm/dd)
- Firmware Version: [#!variable!firmware_version!#]
-=] Network Interface Information:
- IP Address: ..... [#!variable!ip_address!#]
- Serial Number: .. [#!variable!nmc_serial_number!#]
- Firmware Version: [#!variable!nmc_firmware_version!#]
- MAC Address: .... [#!variable!nmc_mac_address!#]
-=] UPS Configuration:
- AC Restore Delay: .......... [#!variable!ac_restore_delay!#] second(s)
- Shutdown Delay: ............ [#!variable!shutdown_delay!#] second(s)
- Transfer to batteries above: [#!variable!high_transfer_voltage!#] vAC
- Transfer to batteries below: [#!variable!low_transfer_voltage!#] vAC
-=] UPS Health Information:
- #!variable!health!#
- #!variable!last_transfer_reason!#
- #!variable!battery_health!#
- #!variable!battery_state!#
- #!variable!say_time_on_batteries!#
- Delay between shutdown command received and actual shut down: [#!variable!shutdown_delay!#] second(s).
- #!variable!input_sensitivity!#
-=] Current Sensor Values:
- Battery Temperature: [#!variable!battery_temperature!#]°C (alarms at: [#!variable!battery_alarm_temperature!#]°C)
- Battery Voltage: [#!variable!battery_voltage!#] vDC
- Input Power Frequency: [#!variable!input_frequency!#] Hz
- Input Power Voltage: [#!variable!input_voltage!#] vAC
- In the last 60 seconds, the input voltage ranged from: [#!variable!input_1m_minimum_input_voltage!#] to: [#!variable!input_1m_maximum_input_voltage!#] vAC.
- Estimated Runtime: [#!variable!say_estimated_runtime!#]
- Output Load Percentage: [#!variable!output_load_percentage!#] %
- Output Power Frequency: [#!variable!output_frequency!#] Hz
- Output Power Voltage: [#!variable!output_voltage!#] vAC
- Lifetime Power Output: [#!variable!output_total_output!#] kWh
</key>
<!-- Units -->
<key name="scan_apc_ups_unit_0001">Unknown</key>
<!-- The UPS reports states as integers. These are used to translate those states into
strings that a human would understand. If we lose contact with the UPS entirely, we will
set this to '0'. See the MIB for OID .1.3.6.1.4.1.318.1.1.1.4.1.1.0 -->
<key name="scan_apc_ups_health_0000">Communication with the UPS has been lost.</key>
<key name="scan_apc_ups_health_0001">The UPS's health is in an unknown state.</key>
<key name="scan_apc_ups_health_0002">The UPS is operating normally.</key>
<key name="scan_apc_ups_health_0003">The UPS is running on its batteries. It is likely that the input power feeding the UPS has failed. Check for an input voltage alert.</key>
<key name="scan_apc_ups_health_0004">The UPS is compensating for low input power.</key>
<key name="scan_apc_ups_health_0005">The UPS is in a timed sleep. It will power back on when the timer has expired.</key>
<key name="scan_apc_ups_health_0006">The UPS is in bypass-mode and was placed in this mode by software. Power is passing to downstream devices through a radio frequency interference filter, but is not conditioned in any other way. Batter protection is not available.</key>
<key name="scan_apc_ups_health_0007">The UPS is off. No power is being provided to down-stream equipment.</key>
<key name="scan_apc_ups_health_0008">The UPS is currently rebooting.</key>
<key name="scan_apc_ups_health_0009">The UPS is in bypass-mode and was placed in this mode by a hardware switch. Power is passing to downstream devices through a radio frequency interference filter, but is not conditioned in any other way. Batter protection is not available.</key>
<key name="scan_apc_ups_health_0010">The UPS is in bypass-mode because of an internal failure. Power is passing to downstream devices through a radio frequency interference filter, but is not conditioned in any other way. Batter protection is not available.</key>
<key name="scan_apc_ups_health_0011">The UPS has lost input power and is sleeping. It will restore output power once input power has been restored.</key>
<key name="scan_apc_ups_health_0012">The UPS is compensating for high input voltage.</key>
<key name="scan_apc_ups_health_0013">The UPS is operating in low-power mode. In this mode, the UPS is in static bypass mode and it is drawing very little power. If a fault is detected, it will switch to either normal operation or forced static bypass mode.</key>
<key name="scan_apc_ups_health_0014">The UPS is operating in hot-standby mode.</key>
<key name="scan_apc_ups_health_0015">The UPS is performing a test of its batteries.</key>
<key name="scan_apc_ups_health_0016">The UPS has been placed in emergency static bypass mode. Power is passing to downstream devices through a radio frequency interference filter, but is not conditioned in any other way. Batter protection is not available.</key>
<key name="scan_apc_ups_health_0017">The UPS is in static bypass standby mode. It is not currently providing power to downstream devices.</key>
<key name="scan_apc_ups_health_0018">The UPS is in power saving mode. The front panel display will be off but the UPS is operating normally.</key>
<key name="scan_apc_ups_health_0019">The UPS is in SPoT (Self Power Test) operating mode.</key> <!-- http://www.apcmedia.com/salestools/COCR-9TZK8N/COCR-9TZK8N_R0_EN.pdf -->
<key name="scan_apc_ups_health_0020">The UPS is in ECOnversion mode. The UPS is providing power to the downstream devices via the bypass. The UPS's inverter is operational and ready to take over the output load if an input fault occurs.</key> <!-- http://www.apcmedia.com/salestools/MBPN-9HCLNT/MBPN-9HCLNT_R0_EN.pdf -->
<!-- These are fake levels used in our own logic -->
<key name="scan_apc_ups_health_0030">The UPS is running on its batteries. The input voltage has risen too high, so the UPS has switched to batteries to trim the output voltage.</key>
<key name="scan_apc_ups_health_0031">The UPS is running on its batteries. The input voltage has dropped too low, so the UPS has switched to batteries to boost the output voltage.</key>
<key name="scan_apc_ups_health_0032">The UPS is running on its batteries. The input voltage is nominal, though, so this is most likely just a self test and not a cause for concern.</key>
<!-- This is used to catch invalid returned values. -->
<key name="scan_apc_ups_health_0099">The UPS Reported a health value that isn't recognized. It should have reported an integer between 1~20, but: [#!variable!bad_value!#] was received..</key> <!-- http://www.apcmedia.com/salestools/MBPN-9HCLNT/MBPN-9HCLNT_R0_EN.pdf -->
<!-- The UPS reports the last transfer as integers. These are used to translate those states
into strings that a human would understand. See the MIB for OID
.1.3.6.1.4.1.318.1.1.1.3.2.5.0 -->
<key name="scan_apc_ups_last_transfer_0000">There is no information on when the UPS last transferred to battery.</key>
<key name="scan_apc_ups_last_transfer_0001">The UPS has not transferred to battery power since the last time it booted.</key>
<key name="scan_apc_ups_last_transfer_0002">The UPS last transferred to batteries because of high input voltage.</key>
<key name="scan_apc_ups_last_transfer_0003">The UPS last transferred to batteries because of a brown out. That is, a prolonged drop in input voltage from the mains circuit.</key>
<key name="scan_apc_ups_last_transfer_0004">The UPS last transferred to batteries because of a black out. That is, a prolonged loss of input voltage from the mains circuit.</key>
<key name="scan_apc_ups_last_transfer_0005">The UPS last transferred to batteries because of a brief, minor reduction of input voltage from the mains circuit.</key>
<key name="scan_apc_ups_last_transfer_0006">The UPS last transferred to batteries because of a brief, significant reduction of input voltage from the mains circuit.</key>
<key name="scan_apc_ups_last_transfer_0007">The UPS last transferred to batteries because of a brief, minor increase of input voltage from the mains circuit.</key>
<key name="scan_apc_ups_last_transfer_0008">The UPS last transferred to batteries because of a brief, significant spike of input voltage from the mains circuit.</key>
<key name="scan_apc_ups_last_transfer_0009">The UPS last transferred to batteries as part of a planned self-test.</key>
<key name="scan_apc_ups_last_transfer_0010">The UPS last transferred to batteries because of a significant change of input voltage from the mains circuit.</key>
<!-- This is used to catch invalid returned values. -->
<key name="scan_apc_ups_last_transfer_0099">The UPS Reported a last transfer value that isn't recognized.</key> <!-- http://www.apcmedia.com/salestools/MBPN-9HCLNT/MBPN-9HCLNT_R0_EN.pdf -->
<!-- The UPS reports the battery state as an integer. These are used to translate those
states into strings that a human would understand. See the MIB for OID
.1.3.6.1.4.1.318.1.1.1.2.1.1.0 -->
<key name="scan_apc_ups_battery_state_0000">The UPS battery state was not read.</key>
<key name="scan_apc_ups_battery_state_0001">The UPS battery is in an unknown state.</key>
<key name="scan_apc_ups_battery_state_0002">The UPS battery is operating normally.</key>
<key name="scan_apc_ups_battery_state_0003">The UPS battery is in a low voltage state.</key>
<key name="scan_apc_ups_battery_state_0004">The UPS battery is in a failed state and needs to be replaced.</key>
<!-- This is used to catch invalid returned values. -->
<key name="scan_apc_ups_battery_state_0099">The UPS battery's state isn't recognized. It should have reported an integer between 1~4, but: [#!variable!bad_value!#] was received..</key>
<!-- The UPS reports the battery overall health. These are used to translate those states
into strings that a human would understand. See the MIB for OID
.1.3.6.1.4.1.318.1.1.1.2.2.4.0 -->
<key name="scan_apc_ups_battery_health_0000">The UPS battery health is unknown.</key>
<key name="scan_apc_ups_battery_health_0001">The UPS battery is healthy.</key>
<key name="scan_apc_ups_battery_health_0002">The UPS battery has failed and needs to be replaced.</key>
<!-- This is used to catch invalid returned values. -->
<key name="scan_apc_ups_battery_health_0099">The UPS battery health value isn't recognized. It should have reported an integer between 1~2, but: [#!variable!bad_value!#] was received..</key> <!-- http://www.apcmedia.com/salestools/MBPN-9HCLNT/MBPN-9HCLNT_R0_EN.pdf -->
<!-- The UPS reports the input sensitive as an integer. These are used to translate those
levels into strings that a human would understand. See the MIB for OID
.1.3.6.1.4.1.318.1.1.1.5.2.7.0 (0 == OID not found, which is the case for online UPSes). -->
<key name="scan_apc_ups_sensitivity_0000">The UPS is an 'Online' (dual-conversion) UPS so input sensitivity is not used.</key>
<key name="scan_apc_ups_sensitivity_0001">The UPS is automatically determining the input power sensitivity.</key>
<key name="scan_apc_ups_sensitivity_0002">The UPS is set to have a low input sensitivity. It will not switch to batteries unless the input power degrades significantly. This mode should only be used if the downstream equipment can handle a wider range of input voltages and frequencies.</key>
<key name="scan_apc_ups_sensitivity_0003">The UPS is set to medium input sensitivity. This will cause the UPS to transfer to battery power under moderately distorted input.</key>
<key name="scan_apc_ups_sensitivity_0004">The UPS is set to high sensitivity. It will switch to battery power under minor input distortion, providing the best protection for downstream equipment, but will shorten the serviceable life of the batteries if input power distorts frequently.</key>
<!-- This is used to catch invalid returned values. -->
<key name="scan_apc_ups_sensitivity_0099">The UPS sensitivity value isn't recognized. It should have reported an integer between 1~2, but: [#!variable!bad_value!#] was received..</key> <!-- http://www.apcmedia.com/salestools/MBPN-9HCLNT/MBPN-9HCLNT_R0_EN.pdf -->
</language>
</words>

@ -236,6 +236,8 @@ The error was:
<key name="error_0161">Unable to mark the server with UUID: [#!variable!uuid!#] as "deleted" because it doesn't apprear to exist in the database in the first place.</key>
<key name="error_0162">The 'anvil_uuid': [#!variable!anvil_uuid!#] in invalid.</key>
<key name="error_0163">The MIB file: [#!variable!mib!#] doesn't exist or can't be read.</key>
<key name="error_0164">The date: [#!variable!date!#] is not in either the 'mm/dd/yy' or 'mm/dd/yyyy' formats. Can't convert to 'yyyy/mm/dd'.</key>
<key name="error_0165">The temperature: [#!variable!temperature!#] does not appear to be valid..</key>
<!-- Table headers -->
<key name="header_0001">Current Network Interfaces and States</key>

Loading…
Cancel
Save