* Finally finished scan-apc-ups! Proved way harder than anticipated... (over a solid week of work!) In M3, this agent is no longer host-bound, and the UPSes to scan based on entries in 'upses' using this scan agent.
* Fixed a bug in Database->insert_or_update_power() where the check to see if 'power_ups_uuid' was passed in was reversed. Also fixed a bug where the convertion of the value to TRUE/FALSE for the old value wasn't being set correctly.
* Updated Server->get_definition() to only translate the host name to a uuid if the host uuid wasn't passed in. Added a sanity check on the UUID as well.
* Cleaned up how existing UPSes are displayed in Striker when managing UPSes. Also renamed the form's scan agents to match the real agent names.
* Fixed alert sorting in scan-apc-pdu.
Signed-off-by: Digimer <digimer@alteeve.ca>
@ -30,7 +30,7 @@ NOTE: All string keys MUST be prefixed with the agent name! ie: 'scan_apc_pdu_lo
<keyname="scan_apc_pdu_message_0005">Able to now read the number of outlets for the PDU: [#!variable!name!#] at IP: [#!variable!ip!#] (sn: #!variable!serial_number!#).</key>
<keyname="scan_apc_pdu_message_0006">The PDU: [#!variable!name!#] with the serial number: [#!variable!serial_number!#] at the IP address: [#!variable!ip_address!#] has returned.</key>
<keyname="scan_apc_pdu_message_0007">The model of the PDU: [#!variable!name!#] has changed from; [#!variable!old_model_number!#] to: [#!variable!new_model_number!#]</key>
<keyname="scan_apc_pdu_message_0008">The serial number of the PDU: [#!variable!name!#] has changed from; [#!variable!old_model_number!#] to: [#!variable!new_model_number!#]. This is expected if the PDU was replaced.</key>
<keyname="scan_apc_pdu_message_0008">The serial number of the PDU: [#!variable!name!#] has changed from; [#!variable!old_serial_number!#] to: [#!variable!new_serial_number!#]. This is expected if the PDU was replaced.</key>
<keyname="scan_apc_pdu_message_0009">The manufacture date of the PDU: [#!variable!name!#] has changed from: [#!variable!old_manufacture_date!#] to: [#!variable!new_manufacture_date!#]. This is expected if the PDU was replaced.</key>
<keyname="scan_apc_pdu_message_0010">The firmware on the PDU: [#!variable!name!#] has changed from: [#!variable!old_firmware_version!#] to: [#!variable!new_firmware_version!#].</key>
<keyname="scan_apc_pdu_message_0011">The hardware version on the PDU: [#!variable!name!#] has changed from: [#!variable!old_hardware_version!#] to: [#!variable!new_hardware_version!#]. This is expected if the PDU was replaced.</key>
- 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.
<keyname="scan_apc_ups_message_0006">The UPS is not running on batteries.</key>
<keyname="scan_apc_ups_message_0007">The UPS has been running on batteries for: [#!variable!output_time_on_batteries!#]</key>
<keyname="scan_apc_ups_message_0008">The UPS: [#!variable!ups_name!#] battery number: [#!variable!battery_number!#]'s estimated replacement date has changed from: [#!variable!old_value!#] to: [#!variable!new_value!#] (yyyy/mm/dd).</key>
<keyname="scan_apc_ups_message_0009">The UPS: [#!variable!ups_name!#] battery number: [#!variable!battery_number!#] health has changed from: [#!variable!old_value!#] to: [#!variable!new_value!#].</key>
<keyname="scan_apc_ups_message_0010">
The UPS: [#!variable!ups_name!#] battery number: [#!variable!battery_number!#] has failed! The health changed from: [#!variable!old_value!#] to: [#!variable!new_value!#].
- Note: The battery will need to be replaced. Please order an APC brand: [#!variable!battery_model!#] battery.
</key>
<keyname="scan_apc_ups_message_0011">
The UPS: [#!variable!ups_name!#] battery number: [#!variable!battery_number!#] has been replaced. The health value changed from: [#!variable!old_value!#] to: [#!variable!new_value!#].
- Note: The battery appears to have been replaced with a: [#!variable!battery_model!#] model battery.
</key>
<keyname="scan_apc_ups_message_0012">The UPS: [#!variable!ups_name!#] battery number: [#!variable!battery_number!#] model has changed from: [#!variable!old_value!#] to: [#!variable!new_value!#].</key>
<keyname="scan_apc_ups_message_0013">The UPS: [#!variable!ups_name!#] battery number: [#!variable!battery_number!#] has finished charging. The charge percentage changed from: [#!variable!old_value!#%] to: [#!variable!new_value!#%].</key>
<keyname="scan_apc_ups_message_0014">The UPS: [#!variable!ups_name!#] battery number: [#!variable!battery_number!#] has charged to its "minimum good" charge percentage of: [#!variable!low_charge_clear!#%]. The charge level changed from: [#!variable!old_value!#%] to: [#!variable!new_value!#%].</key>
<keyname="scan_apc_ups_message_0015">The UPS: [#!variable!ups_name!#] battery number: [#!variable!battery_number!#] is discharging. The charge percent dropped from: [#!variable!old_value!#%] to: [#!variable!new_value!#%].</key>
<keyname="scan_apc_ups_message_0016">The UPS: [#!variable!ups_name!#] battery number: [#!variable!battery_number!#] has discharged below the warning threshold of: [#!variable!low_charge_alert!#]. The charge percent dropped from: [#!variable!old_value!#%] to: [#!variable!new_value!#%].</key>
<keyname="scan_apc_ups_message_0017">The UPS: [#!variable!ups_name!#] battery number: [#!variable!battery_number!#]'s last replacement date has changed from: [#!variable!old_value!#] to: [#!variable!new_value!#] (yyyy/mm/dd). This is most likely due to an administrator replacing the battery pack in the UPS.</key>
<keyname="scan_apc_ups_message_0018">The UPS: [#!variable!ups_name!#] battery number: [#!variable!battery_number!#] has entered a warning state! The status changed from: [#!variable!old_value!#] to: [#!variable!new_value!#].</key>
<keyname="scan_apc_ups_message_0019">The UPS: [#!variable!ups_name!#] battery number: [#!variable!battery_number!#] has recovered from a warning state. The status changed from: [#!variable!old_value!#] to: [#!variable!new_value!#].</key>
<keyname="scan_apc_ups_message_0020">The UPS: [#!variable!ups_name!#] battery number: [#!variable!battery_number!#] temperature has changed from: [#!variable!old_value!#ยฐC] to: [#!variable!new_value!#ยฐC].</key>
<keyname="scan_apc_ups_message_0021">The UPS: [#!variable!ups_name!#] battery number: [#!variable!battery_number!#] alarm temperature has changed from: [#!variable!old_value!#ยฐC] to: [#!variable!new_value!#ยฐC].</key>
<keyname="scan_apc_ups_message_0022">The UPS: [#!variable!ups_name!#] battery number: [#!variable!battery_number!#] voltage has changed from: [#!variable!old_value!# vDC] to: [#!variable!new_value!# vDC].</key>
<keyname="scan_apc_ups_message_0023">The UPS: [#!variable!ups_name!#] battery number: [#!variable!battery_number!#] temperature has jumped: [#!variable!difference!#ยฐC] in: [#!variable!time_span!#] seconds! The temperature rose from: [#!variable!old_value!#ยฐC] to: [#!variable!new_value!#ยฐC].</key>
<!-- Units -->
<keyname="scan_apc_ups_unit_0001">Unknown</key>
<!-- TODO: Entries below should have been messages... Rework this later. -->
<!-- Warnings -->
<keyname="scan_apc_ups_warning_0001">
-=] The temperature of: [#!variable!ups_name!#]'s, battery: [#!variable!battery_number!#] is now critically high!
- Current temperature: .................. [#!variable!temperature!#ยฐC]
Warning: If the UPS battery is the only high temperature, it could be a sign that the battery is failing. This can lead to battery swelling which could cause the battery to get stuck in the UPS. If this is the only high temperature, it is strongly advised that you check the battery is not swelling as soon as possible.
</key>
<keyname="scan_apc_ups_warning_0002">
-=] The temperature of: [#!variable!ups_name!#]'s battery: [#!variable!battery_number!#] has dropped and is no longer critically high.
- Current temperature: .................. [#!variable!temperature!#ยฐC]
-=] The temperature of: [#!variable!ups_name!#]'s, battery: [#!variable!battery_number!#] is above the warning temperature threshold. It is still under maximum allowed.
- Current temperature: .................. [#!variable!temperature!#ยฐC]
Warning: If the UPS battery is the only high temperature, it could be a sign that the battery is failing. This can lead to battery swelling which could cause the battery to get stuck in the UPS. If this is the only high temperature, it is strongly advised that you check the battery is not swelling as soon as possible.
</key>
<keyname="scan_apc_ups_warning_0004">
-=] The temperature of: [#!variable!ups_name!#]'s battery: [#!variable!battery_number!#] has dropped back down to nominal levels.
- Current temperature: .................. [#!variable!temperature!#ยฐC]
<keyname="scan_apc_ups_warning_0005">The UPS: [#!variable!old_ups_name!#] has been renamed to: [#!variable!new_ups_name!#]</key>
<keyname="scan_apc_ups_warning_0006">The UPS: [#!variable!ups_name!#]'s serial number has changed from: [#!variable!old_value!#] to: [#!variable!new_value!#]. Was the UPS replaced?</key>
<keyname="scan_apc_ups_warning_0007">The UPS: [#!variable!ups_name!#]'s IP address has changed from: [#!variable!old_value!#] to: [#!variable!new_value!#].</key>
<keyname="scan_apc_ups_warning_0008">The UPS: [#!variable!ups_name!#]'s model has changed from: [#!variable!old_value!#] to: [#!variable!new_value!#]. Was the UPS replaced?</key>
<keyname="scan_apc_ups_warning_0009">The UPS: [#!variable!ups_name!#]'s start time after input power is restored has changed from: [#!variable!old_value!#s] to: [#!variable!new_value!#s]. This controls how long the UPS will wait after the input power has returned until it starts providing output power.</key>
<keyname="scan_apc_ups_warning_0010">The UPS: [#!variable!ups_name!#]'s shutdown delay time has changed: from: [#!variable!old_value!#s] to [#!variable!new_value!#s]. This controls how long the UPS will wait after being asked to power down before actually disabling its output power.</key>
<keyname="scan_apc_ups_warning_0011">The UPS: [#!variable!ups_name!#]'s firmware has been updated from: [#!variable!old_value!#] to: [#!variable!new_value!#]. The firmware is software inside the UPS that controls how the UPS operates and how users interact with it. Typically a firmware is upgraded by an administrator to fix bugs or add new functionality.</key>
<keyname="scan_apc_ups_warning_0012">The UPS: [#!variable!ups_name!#]'s health status has changed from: [#!variable!old_value!#] to: [#!variable!new_value!#].</key>
<keyname="scan_apc_ups_warning_0013">The UPS: [#!variable!ups_name!#]'s low-voltage transfer voltage has increased from: [#!variable!old_value!# vAC] to: [#!variable!new_value!# vAC]. An administrator may have made this change in order to help protect more sensitive down-stream equipment from low input voltages. This will likely shorten the life of the UPSes as the UPS will switch to batteries earlier on low-input power.</key>
<keyname="scan_apc_ups_warning_0014">The UPS: [#!variable!ups_name!#]'s low-voltage transfer voltage has decreased from: [#!variable!old_value!# vAC] to: [#!variable!new_value!# vAC]. An administrator may have made this change in order to reduce how often the UPS switches to batteries. This may be done in cases where input power is often low and the down-stream equipment is known to be able to handle the lower voltage without issue. This change would help extend the life of the batteries.</key>
<keyname="scan_apc_ups_warning_0015">The UPS: [#!variable!ups_name!#]'s last transfer to batteries reason has changed from: [#!variable!old_value!#] to: [#!variable!new_value!#].</key>
<keyname="scan_apc_ups_warning_0016">The UPS: [#!variable!ups_name!#]'s manufacture data has changed from: [#!variable!old_value!#] to: [#!variable!new_value!#]. Was the UPS replaced?</key>
<keyname="scan_apc_ups_warning_0017">The UPS: [#!variable!ups_name!#]'s network interface's firmware has been updated from version: [#!variable!old_value!#] to: [#!variable!new_value!#]. The firmware is software inside the UPS's network interface card that controls how the card operates and how users interact with it. Typically a firmware is upgraded by an administrator to fix bugs or add new functionality.</key>
<keyname="scan_apc_ups_warning_0018">The UPS: [#!variable!ups_name!#]'s network interface's serial number has changed from: [#!variable!old_value!#] to: [#!variable!new_value!#]. Was the network card replaced?</key>
<keyname="scan_apc_ups_warning_0019">The UPS: [#!variable!ups_name!#]'s network interface's MAC address has changed from: [#!variable!old_value!#] to: [#!variable!new_value!#]. Was the network card replaced?</key>
<keyname="scan_apc_ups_warning_0020">The input sensitivity for the UPS: [#!variable!ups_name!#] has changed from: [#!variable!old_value!#] to: [#!variable!new_value!#].</key>
<keyname="scan_apc_ups_warning_0021">The UPS: [#!variable!ups_name!#] has input power again. The input voltage is now: [#!variable!new_value!# vAC].</key>
<keyname="scan_apc_ups_warning_0022">The input voltage for the UPS: [#!variable!ups_name!#] has gone above the high-voltage transfer level! The current input value rose from: [#!variable!old_value!# vAC] to: [#!variable!new_value!# vAC]. The high alert voltage threshold is: [#!variable!high_transfer_voltage!# vAC].</key>
<keyname="scan_apc_ups_warning_0023">The input voltage for the UPS: [#!variable!ups_name!#] has risen back above the low-voltage transfer level and is operating normally again. Rose from: [#!variable!old_value!# vAC] to: [#!variable!new_value!# vAC]. The low-voltage clear voltage threshold is: [#!variable!clear_low_transfer!# vAC]</key>
<keyname="scan_apc_ups_warning_0024">The input voltage for the UPS: [#!variable!ups_name!#] has risen from: [#!variable!old_value!# vAC] to: [#!variable!new_value!# vAC].</key>
<keyname="scan_apc_ups_warning_0025">The input voltage for the UPS: [#!variable!ups_name!#] has dropped from: [#!variable!old_value!# vAC] to: [#!variable!new_value!# vAC].</key>
<keyname="scan_apc_ups_warning_0026">The UPS: [#!variable!ups_name!#] has lost input power! The input voltage dropped from: [#!variable!old_value!# vAC] to: [#!variable!new_value!# vAC].</key>
<keyname="scan_apc_ups_warning_0027">The input voltage for the UPS: [#!variable!ups_name!#] has dropped below the low-voltage transfer level! The voltage dropped from: [#!variable!old_value!# vAC] to: [#!variable!new_value!# vAC]. The low-voltage transfer voltage is: [#!variable!low_transfer_voltage!#].</key>
<keyname="scan_apc_ups_warning_0028">The input voltage for the UPS: [#!variable!ups_name!#] has dropped back down below the high-voltage transfer level and is operating normally again. The voltage changed from: [#!variable!old_value!# vAC] to: [#!variable!new_value!# vAC]. The clear high-voltage threshold is: [#!variable!clear_high_transfer!#].</key>
<keyname="scan_apc_ups_warning_0029">The highest input voltage seen in the last 60 seconds for the UPS: [#!variable!ups_name!#] has changed from: [#!variable!old_value!# vAC] to: [#!variable!new_value!# vAC].</key>
<keyname="scan_apc_ups_warning_0030">The lowest input voltage seen in the last 60 seconds for the UPS: [#!variable!ups_name!#] has changed from: [#!variable!old_value!# vAC] to: [#!variable!new_value!# vAC].</key>
<keyname="scan_apc_ups_warning_0031">The load percentage on the UPS: [#!variable!ups_name!#] has changed from: [#!variable!old_value!#%] to [#!variable!new_value!#%].</key>
<keyname="scan_apc_ups_warning_0032">The load percentage on the UPS: [#!variable!ups_name!#] has risen above the high-load threashold of: [#!variable!high_load!#]. It changed from: [#!variable!old_value!#%] to [#!variable!new_value!#%]. With a high load on the UPS, the effective hold up time will be reduced, meaning that if power is lost, the UPS batteries will drain quickly, possibly faster than a graceful shutdown can be performed. It's advised to reduce load, if possible.</key>
<keyname="scan_apc_ups_warning_0033">The load percentage on the UPS: [#!variable!ups_name!#] has fallen below the high-load clear threashold of: [#!variable!high_clear!#]. It changed from: [#!variable!old_value!#%] to [#!variable!new_value!#%].</key>
<keyname="scan_apc_ups_warning_0034">The time on batteries for the UPS: [#!variable!ups_name!#] has changed from: [#!variable!old_value!#] to: [#!variable!new_value!#].</key>
<keyname="scan_apc_ups_warning_0035">The UPS: [#!variable!ups_name!#] has returned to running on mains power. The time on batteries has changed from: [#!variable!old_value!#] to: [#!variable!new_value!#].</key>
<keyname="scan_apc_ups_warning_0036">The UPS: [#!variable!ups_name!#] is now running on batteries. Its time on batteries has changed from: [#!variable!old_value!#] to: [#!variable!new_value!#].</key>
<keyname="scan_apc_ups_warning_0037">The estimated hold-up time for the UPS: [#!variable!ups_name!#] has changed from: [#!variable!old_value!#] to: [#!variable!new_value!#]. This is an *estimate* of how long the UPS can provide power should the input power be lost at the current load level. An increase in the average load will shorten the actual hold-up time.</key>
<keyname="scan_apc_ups_warning_0038">
-=] The estimated hold-up time for the UPS: [#!variable!ups_name!#] is low!
If power is lost, the UPSes may run out of power faster than the Anvil! can shed load and/or gracefully shut down the hosted server. If at all possible, please remove non-critical devices from this UPS. If not possible, please add extended runtime batteries to the UPS, or replace the UPS with higher capacity versions (ideally with extended runtime battery support).
- The estimated hold-up time changed from: [#!variable!old_value!#] to: [#!variable!new_value!#].
- This alert triggers below: ............. [#!variable!low_threshold!#]
- This alert clears above: ............... [#!variable!clear_threshold!#]
</key>
<keyname="scan_apc_ups_warning_0039">
-=] The estimated hold-up time for the UPS: [#!variable!ups_name!#] is now ok.
The estimated holdup time of this UPS is back up to a reasonable level. In a power loss event, the chances of successful load shed and/or clean shut down are reasonably high.
- The estimated hold-up time changed from: [#!variable!old_value!#] to: [#!variable!new_value!#].
- This alert triggers below: ............. [#!variable!low_threshold!#]
- This alert clears above: ............... [#!variable!clear_threshold!#]
</key>
<keyname="scan_apc_ups_warning_0040">The output frequency from the UPS: [#!variable!ups_name!#] has changed from: [#!variable!old_value!# Hz] to: [#!variable!new_value!# Hz].</key>
<keyname="scan_apc_ups_warning_0041">The output voltage from the UPS: [#!variable!ups_name!#] has changed from: [#!variable!old_value!# vAC] to: [#!variable!new_value!# vAC].</key>
<keyname="scan_apc_ups_warning_0042">The total lifetime power output from the UPS: [#!variable!ups_name!#] has increased from: [#!variable!old_value!# kWh] to: [#!variable!new_value!# kWh].</key>
<keyname="scan_apc_ups_warning_0043">A new battery the UPS: [#!variable!ups_name!#] has increased from: [#!variable!old_value!# kWh] to: [#!variable!new_value!# kWh].</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 -->
power_ups_uuiduuidnotnull,-- This is the 'upses' -> 'ups_uuid' of the UPS. This is used to map what UPSes are powering a given node.
power_on_batterybooleannotnull,-- TRUE == use "time_remaining" to determine if graceful power off is needed. FALSE == power loss NOT imminent, do not power off node.
power_seconds_leftnumeric,-- Should always be set, but not required *EXCEPT* when 'power_on_battery' is TRUE.
power_charge_percentagenumeric,-- Percentage charge in the UPS. Used to determine when the dashboard should boot the node after AC restore
power_seconds_leftnumericnotnull,-- Should always be set, but not required *EXCEPT* when 'power_on_battery' is TRUE.
power_charge_percentagenumericnotnull,-- Percentage charge in the UPS. Used to determine when the dashboard should boot the node after AC restore
"I'm sorry, but I don't want to be an emperor. That's not my business. I don't want to rule or conquer anyone. I should like to help everyone if possible - Jew, Gentile - black man - white.
We all want to help one another. Human beings are like that. We want to live by each other's happiness - not by each other's misery. We don't want to hate and despise one another. In this world there's room for everyone and the good earth is rich and can provide for everyone.
The way of life can be free and beautiful, but we have lost the way. Greed has poisoned men's souls - has barricaded the world with hate - has goose-stepped us into misery and bloodshed. We have developed speed, but we have shut ourselves in. Machinery that gives abundance has left us in want. Our knowledge has made us cynical; our cleverness, hard and unkind. We think too much and feel too little. More than machinery we need humanity. More than cleverness, we need kindness and gentleness. Without these qualities, life will be violent and all will be lost.
The aeroplane and the radio have brought us closer together. The very nature of these inventions cries out for the goodness in man - cries for universal brotherhood - for the unity of us all. Even now my voice is reaching millions throughout the world - millions of despairing men, women, and little children - victims of a system that makes men torture and imprison innocent people. To those who can hear me, I say: 'Do not despair.' The misery that is now upon us is but the passing of greed - the bitterness of men who fear the way of human progress. The hate of men will pass, and dictators die, and the power they took from the people will return to the people. And so long as men die, liberty will never perish.
Soldiers! Don't give yourselves to brutes - men who despise you and enslave you - who regiment your lives - tell you what to do - what to think and what to feel! Who drill you - diet you - treat you like cattle, use you as cannon fodder. Don't give yourselves to these unnatural men - machine men with machine minds and machine hearts! You are not machines! You are not cattle! You are men! You have the love of humanity in your hearts. You don't hate, only the unloved hate - the unloved and the unnatural!
Soldiers! Don't fight for slavery! Fight for liberty! In the seventeenth chapter of St Luke, it is written the kingdom of God is within man not one man nor a group of men, but in all men! In you! You, the people, have the power - the power to create machines. The power to create happiness! You, the people, have the power to make this life free and beautiful - to make this life a wonderful adventure. Then in the name of democracy - let us use that power - let us all unite. Let us fight for a new world - a decent world that will give men a chance to work - that will give youth a future and old age a security.
By the promise of these things, brutes have risen to power. But they lie! They do not fulfil that promise. They never will! Dictators free themselves but they enslave the people. Now let us fight to fulfil that promise! Let us fight to free the world - to do away with national barriers - to do away with greed, with hate and intolerance. Let us fight for a world of reason - a world where science and progress will lead to all men's happiness. Soldiers, in the name of democracy, let us unite!"
my$cib='<cibcrm_feature_set="3.3.0"validate-with="pacemaker-3.2"epoch="598"num_updates="3"admin_epoch="0"cib-last-written="Mon Oct 12 08:01:01 2020"update-origin="mk-a02n02"update-client="cibadmin"update-user="root"have-quorum="1"dc-uuid="2">