* Fixed a bug if Get->free_memory() where host_type was still being called from the old System->host_type method. * Added global support for '--log-secure' and '--log-db' switches to enable logging of secure data and DB transactions, respectively. * Created Database->get_tables_from_schema() that parses a SQL schema file and returns an array reference of tables found, in the order they were found. * Updated ScanCore->agent_startup() to no longer require manually defining database tables, using Database->get_tables_from_schema() when not manually set.. Updated all existing agents to use this. Signed-off-by: Digimer <digimer@alteeve.ca>main
parent
9c92b6bbb8
commit
51de6c721f
13 changed files with 2763 additions and 68 deletions
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,122 @@ |
||||
-- This is the database schema for the 'scan-ipmitool' Scan Agent. |
||||
|
||||
CREATE TABLE scan_ipmitool ( |
||||
scan_ipmitool_uuid uuid not null primary key, |
||||
scan_ipmitool_host_uuid uuid not null, |
||||
scan_ipmitool_sensor_host text not null, -- The hostname of the machine we pulled the sensor value from. We don't link this to a host_uuid because it is possible the host doesn't doesn't have an entry (yet) |
||||
scan_ipmitool_sensor_name text not null, |
||||
scan_ipmitool_sensor_units text not null, -- Temperature (°C), vDC, vAC, watt, amp, percent |
||||
scan_ipmitool_sensor_status text not null, |
||||
scan_ipmitool_sensor_high_critical numeric not null, |
||||
scan_ipmitool_sensor_high_warning numeric not null, |
||||
scan_ipmitool_sensor_low_critical numeric not null, |
||||
scan_ipmitool_sensor_low_warning numeric not null, |
||||
modified_date timestamp with time zone not null, |
||||
|
||||
FOREIGN KEY(scan_ipmitool_host_uuid) REFERENCES hosts(host_uuid) |
||||
); |
||||
ALTER TABLE scan_ipmitool OWNER TO admin; |
||||
|
||||
CREATE TABLE history.scan_ipmitool ( |
||||
history_id bigserial, |
||||
scan_ipmitool_uuid uuid, |
||||
scan_ipmitool_host_uuid uuid, |
||||
scan_ipmitool_sensor_host text, |
||||
scan_ipmitool_sensor_name text, |
||||
scan_ipmitool_sensor_units text, |
||||
scan_ipmitool_sensor_status text, |
||||
scan_ipmitool_sensor_high_critical numeric, |
||||
scan_ipmitool_sensor_high_warning numeric, |
||||
scan_ipmitool_sensor_low_critical numeric, |
||||
scan_ipmitool_sensor_low_warning numeric, |
||||
modified_date timestamp with time zone not null |
||||
); |
||||
ALTER TABLE history.scan_ipmitool OWNER TO admin; |
||||
|
||||
CREATE FUNCTION history_scan_ipmitool() RETURNS trigger |
||||
AS $$ |
||||
DECLARE |
||||
history_scan_ipmitool RECORD; |
||||
BEGIN |
||||
SELECT INTO history_scan_ipmitool * FROM scan_ipmitool WHERE scan_ipmitool_uuid=new.scan_ipmitool_uuid; |
||||
INSERT INTO history.scan_ipmitool |
||||
(scan_ipmitool_uuid, |
||||
scan_ipmitool_host_uuid, |
||||
scan_ipmitool_sensor_host, |
||||
scan_ipmitool_sensor_name, |
||||
scan_ipmitool_sensor_units, |
||||
scan_ipmitool_sensor_status, |
||||
scan_ipmitool_sensor_high_critical, |
||||
scan_ipmitool_sensor_high_warning, |
||||
scan_ipmitool_sensor_low_critical, |
||||
scan_ipmitool_sensor_low_warning, |
||||
modified_date) |
||||
VALUES |
||||
(history_scan_ipmitool.scan_ipmitool_uuid, |
||||
history_scan_ipmitool.scan_ipmitool_host_uuid, |
||||
history_scan_ipmitool.scan_ipmitool_sensor_host, |
||||
history_scan_ipmitool.scan_ipmitool_sensor_name, |
||||
history_scan_ipmitool.scan_ipmitool_sensor_units, |
||||
history_scan_ipmitool.scan_ipmitool_sensor_status, |
||||
history_scan_ipmitool.scan_ipmitool_sensor_high_critical, |
||||
history_scan_ipmitool.scan_ipmitool_sensor_high_warning, |
||||
history_scan_ipmitool.scan_ipmitool_sensor_low_critical, |
||||
history_scan_ipmitool.scan_ipmitool_sensor_low_warning, |
||||
history_scan_ipmitool.modified_date); |
||||
RETURN NULL; |
||||
END; |
||||
$$ |
||||
LANGUAGE plpgsql; |
||||
ALTER FUNCTION history_scan_ipmitool() OWNER TO admin; |
||||
|
||||
CREATE TRIGGER trigger_scan_ipmitool |
||||
AFTER INSERT OR UPDATE ON scan_ipmitool |
||||
FOR EACH ROW EXECUTE PROCEDURE history_scan_ipmitool(); |
||||
|
||||
|
||||
-- This contains the ever-changing sensor values. This is a separate table to keep the database as small as |
||||
-- possible. |
||||
CREATE TABLE scan_ipmitool_values ( |
||||
scan_ipmitool_value_uuid uuid not null primary key, |
||||
scan_ipmitool_value_scan_ipmitool_uuid uuid not null, |
||||
scan_ipmitool_value_sensor_value numeric not null, |
||||
modified_date timestamp with time zone not null, |
||||
|
||||
FOREIGN KEY(scan_ipmitool_value_scan_ipmitool_uuid) REFERENCES scan_ipmitool(scan_ipmitool_uuid) |
||||
); |
||||
ALTER TABLE scan_ipmitool_values OWNER TO admin; |
||||
|
||||
CREATE TABLE history.scan_ipmitool_values ( |
||||
history_id uuid, |
||||
scan_ipmitool_value_uuid uuid, |
||||
scan_ipmitool_value_scan_ipmitool_uuid uuid, |
||||
scan_ipmitool_value_sensor_value numeric, |
||||
modified_date timestamp with time zone not null |
||||
); |
||||
ALTER TABLE history.scan_ipmitool_values OWNER TO admin; |
||||
|
||||
CREATE FUNCTION history_scan_ipmitool_values() RETURNS trigger |
||||
AS $$ |
||||
DECLARE |
||||
history_scan_ipmitool_values RECORD; |
||||
BEGIN |
||||
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 |
||||
(scan_ipmitool_value_uuid, |
||||
scan_ipmitool_value_scan_ipmitool_uuid, |
||||
scan_ipmitool_value_sensor_value, |
||||
modified_date) |
||||
VALUES |
||||
(history_scan_ipmitool_values.scan_ipmitool_value_uuid, |
||||
history_scan_ipmitool_values.scan_ipmitool_value_scan_ipmitool_uuid, |
||||
history_scan_ipmitool_values.scan_ipmitool_value_sensor_value, |
||||
history_scan_ipmitool_values.modified_date); |
||||
RETURN NULL; |
||||
END; |
||||
$$ |
||||
LANGUAGE plpgsql; |
||||
ALTER FUNCTION history_scan_ipmitool_values() OWNER TO admin; |
||||
|
||||
CREATE TRIGGER trigger_scan_ipmitool_values |
||||
AFTER INSERT OR UPDATE ON scan_ipmitool_values |
||||
FOR EACH ROW EXECUTE PROCEDURE history_scan_ipmitool_values(); |
@ -0,0 +1,120 @@ |
||||
<?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_ipmitool_log_0001'. |
||||
--> |
||||
|
||||
<words> |
||||
<meta version="3.0.0" languages="en_CA,jp"/> |
||||
<!-- 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."> |
||||
|
||||
<!-- Messages entries --> |
||||
<key name="scan_ipmitool_message_0001">No IPMI BMC found on this host nor where any other machines with IPMI found or where accessible. Nothing to do.</key> |
||||
<key name="scan_ipmitool_message_0002">There was no IPMI sensor value units set for sensor: [#!variable!sensor!#] on the machine: [#!variable!machine!#].</key> |
||||
<key name="scan_ipmitool_message_0003">There was no IPMI sensor value set for sensor: [#!variable!sensor!#] on the machine: [#!variable!machine!#].</key> |
||||
<key name="scan_ipmitool_message_0004"> |
||||
The sensor: [#!variable!sensor_name!#] has changed. |
||||
- [#!variable!old_sensor_value!#] -> [#!variable!new_sensor_value!#] |
||||
</key> |
||||
<key name="scan_ipmitool_message_0005"> |
||||
The sensor: [#!variable!sensor_name!#] has changed. |
||||
- [#!variable!old_sensor_value!#] -> [#!variable!new_sensor_value!#] |
||||
- [#!variable!old_sensor_status!#] -> [#!variable!new_sensor_status!#] |
||||
- Thresholds: |
||||
- High critical: [#!variable!old_high_critical!#] -> [#!variable!new_high_critical!#] |
||||
- High warning: [#!variable!old_high_warning!#] -> [#!variable!new_high_warning!#] |
||||
- Low warning: [#!variable!old_low_warning!#] -> [#!variable!new_low_warning!#] |
||||
- Low critical: [#!variable!old_low_critical!#] -> [#!variable!new_low_critical!#] |
||||
</key> |
||||
<key name="scan_ipmitool_message_0006"> |
||||
The temperature sensor: [#!variable!sensor_name!#] has gone critically high! |
||||
- [#!variable!old_sensor_value!#] -> [#!variable!new_sensor_value!#] |
||||
Note: If enough sensors go critical, this node will withdraw and power off! |
||||
</key> |
||||
<key name="scan_ipmitool_message_0007"> |
||||
The temperature sensor: [#!variable!sensor_name!#] has entered a high warning state! |
||||
- [#!variable!old_sensor_value!#] -> [#!variable!new_sensor_value!#] |
||||
Note: If both nodes have enough thermal sensors go into 'warning' state, and |
||||
if load shedding is enabled, a node will power off to reduce thermal |
||||
output. If enough sensors reach critical levels, the node will withdraw |
||||
and power off. |
||||
</key> |
||||
<key name="scan_ipmitool_message_0008"> |
||||
The temperature sensor: [#!variable!sensor_name!#] has returned to normal levels. |
||||
- [#!variable!old_sensor_value!#] -> [#!variable!new_sensor_value!#] |
||||
</key> |
||||
<key name="scan_ipmitool_message_0009"> |
||||
The temperature sensor: [#!variable!sensor_name!#] has risen above critically low levels, but it is still in a warning state. |
||||
- [#!variable!old_sensor_value!#] -> [#!variable!new_sensor_value!#] |
||||
Note: If you are listening to 'critical' level alerts only, you will not get the alert telling you when the temperature is back to normal. |
||||
</key> |
||||
<key name="scan_ipmitool_message_0010"> |
||||
The temperature sensor: [#!variable!sensor_name!#] has jumped a large amount in a short period of time! |
||||
- [#!variable!old_sensor_value!#] -> [#!variable!new_sensor_value!#] |
||||
</key> |
||||
<key name="scan_ipmitool_message_0011"> |
||||
The temperature sensor: [#!variable!sensor_name!#] has gone critically low! |
||||
- [#!variable!old_sensor_value!#] -> [#!variable!new_sensor_value!#] |
||||
Note: If enough sensors go critical, this node will withdraw and power off! |
||||
</key> |
||||
<key name="scan_ipmitool_message_0012"> |
||||
The temperature sensor: [#!variable!sensor_name!#] has entered a low warning state! |
||||
- [#!variable!old_sensor_value!#] -> [#!variable!new_sensor_value!#] |
||||
Note: If the temperature continues to drop, the sensor will go critical. If enough sensors go critical, the node will withdraw and power off. |
||||
</key> |
||||
<key name="scan_ipmitool_message_0013"> |
||||
The temperature sensor: [#!variable!sensor_name!#] has returned to normal levels. |
||||
- [#!variable!old_sensor_value!#] -> [#!variable!new_sensor_value!#] |
||||
</key> |
||||
<key name="scan_ipmitool_message_0014"> |
||||
The temperature sensor: [#!variable!sensor_name!#] has risen blow critically high levels, but it is still in a warning state. |
||||
- [#!variable!old_sensor_value!#] -> [#!variable!new_sensor_value!#] |
||||
Note: If you are listening to 'critical' level alerts only, you will not get the alert telling you when the temperature is back to normal. |
||||
</key> |
||||
<key name="scan_ipmitool_message_0015">There was no IPMI sensor value units set for sensor: [#!variable!sensor!#] on the machine: [#!variable!machine!#].</key> |
||||
<key name="scan_ipmitool_message_0016"> |
||||
The sensor: [#!variable!sensor_name!#] has changed. |
||||
- [#!variable!old_sensor_value!#] -> [#!variable!new_sensor_value!#] |
||||
- [#!variable!old_sensor_status!#] -> [#!variable!new_sensor_status!#] |
||||
- Thresholds: |
||||
- High critical: [#!variable!old_high_critical!#] -> [#!variable!new_high_critical!#] |
||||
- High warning: [#!variable!old_high_warning!#] -> [#!variable!new_high_warning!#] |
||||
- Low warning: [#!variable!old_low_warning!#] -> [#!variable!new_low_warning!#] |
||||
- Low critical: [#!variable!old_low_critical!#] -> [#!variable!new_low_critical!#] |
||||
</key> |
||||
<key name="scan_ipmitool_message_0017">There was no IPMI sensor value units set for sensor: [#!variable!sensor!#] on the machine: [#!variable!machine!#].</key> |
||||
<key name="scan_ipmitool_message_0018">There was no IPMI sensor value set for sensor: [#!variable!sensor!#] on the machine: [#!variable!machine!#].</key> |
||||
<key name="scan_ipmitool_message_0019"> |
||||
The new sensor: [#!variable!sensor_name!#] has been found on the machine: [#!variable!machine!#]. |
||||
- Value: [#!variable!sensor_value!#], Status: [#!variable!sensor_status!#] |
||||
- Thresholds: |
||||
- High critical: [#!variable!high_critical!#] |
||||
- High warning: [#!variable!high_warning!#] |
||||
- Low warning: [#!variable!low_warning!#] |
||||
- Low critical: [#!variable!low_critical!#] |
||||
</key> |
||||
<key name="scan_ipmitool_message_0020"> |
||||
The new sensor: [#!variable!sensor_name!#] has been found on the machine: [#!variable!machine!#]. |
||||
Warning: It is not in an OK state! |
||||
- Value: [#!variable!sensor_value!#], Status: [#!variable!sensor_status!#] |
||||
- Thresholds: |
||||
- High critical: [#!variable!high_critical!#] |
||||
- High warning: [#!variable!high_warning!#] |
||||
- Low warning: [#!variable!low_warning!#] |
||||
- Low critical: [#!variable!low_critical!#] |
||||
</key> |
||||
|
||||
<!-- Log entries --> |
||||
<key name="scan_ipmitool_log_0001">Starting to read the IPMI sensor values for: [#!variable!machine!#]</key> |
||||
<key name="scan_ipmitool_log_0002">Failed to query node: [#!variable!machine!#]'s IPMI interface using the call: [#!variable!call!#]. Is the password correct?</key> |
||||
<key name="scan_ipmitool_log_0003">IPMI sensor values read from: [#!variable!machine!#] in: [#!variable!time!#].</key> |
||||
<key name="scan_ipmitool_log_0004">The sensor named: [#!variable!sensor_name!#] appears to have vanished, but this is the first scan that it vanished. This is generally harmless and just a sensor read issue.</key> |
||||
<key name="scan_ipmitool_log_0005">The sensor named: [#!variable!sensor_name!#] has returned.</key> |
||||
|
||||
</language> |
||||
</words> |
Loading…
Reference in new issue