* Got a lot of work done in generating emails. Doesn't work yet, but the code to generate emails for recipients using their preferred language and alert level is done (though limited testing so far).
* Dropped support for supporting imperial measurements in generated emails.
* Created Database->get_alerts() to read in alert data and ->get_recipients() to get the list of alert recipients.
* SQL Schema changes;
** Added 'alert_processed' to 'alerts' to track what alerts have been processed.
** Changed 'recipient_new_level' to 'recipient_level' now that we're only using 'notifications' as a per-host override for user/hosts alert levels.
** Removed 'recipient_units' as we're no longer supporting non-metric values.
* Updated Alert->register() to take strings for the alert level (which gets translated to integers).
* Created Email->get_current_server() to returned the mail_server_uuid of the active mail server (if any). Created ->send_alerts() to process unprocessed alerts and send emails to recipients.
* Updated Words->parse_banged_string() to take the 'language' parameter.
Signed-off-by: Digimer <digimer@alteeve.ca>
Thisloadsallknownuser's SSH public keys and all known machine'spublickeysintothedatahash.Onsuccess,thismethodreturnsC<<0>>.Ifanyproblemsoccur,C<<1>>isreturned.
Thisloadsallknownuser's SSH public keys and all known machine'spublickeysintothedatahash.Onsuccess,thismethodreturnsC<<0>>.Ifanyproblemsoccur,C<<1>>isreturned.
@ -7960,7 +8136,7 @@ This is the language that alert emails are crafted using for this recipient. Thi
-- NOTE: This doesn't store the user's level, as it might be unique per Anvil!.
-- This is the list of alert recipients.
CREATETABLErecipients(
CREATETABLErecipients(
recipient_uuiduuidnotnullprimarykey,
recipient_uuiduuidnotnullprimarykey,
recipient_nametextnotnull,-- This is the recipient's name
recipient_nametextnotnull,-- This is the recipient's name
recipient_emailtextnotnull,-- This is the recipient's email address or the file name, depending.
recipient_emailtextnotnull,-- This is the recipient's email address or the file name, depending.
recipient_languagetextnotnull,-- If set, this is the language the user wants to receive alerts in. If not set, the default language is used.
recipient_languagetextnotnull,-- If set, this is the language the user wants to receive alerts in. If not set, the default language is used.
recipient_unitstextnotnull,-- This can be set to 'imperial' if the user prefers temperatures in °F
recipient_levelintegernotnull,-- This is the default alert level this recipient is interested in. It can be adjusted on a per-host basis via the 'notifications' table.
recipient_new_levelintegernotnull,-- This is the alert level to use when automatically adding watch links to new systems. '0' tells us to ignore new systems, 1 is critical, 2 is warning, and 3 is notice
@ -35,6 +35,23 @@ Author: Madison Kelly <mkelly@alteeve.ca>
<keyname="brand_0008">DR Host</key>
<keyname="brand_0008">DR Host</key>
<keyname="brand_0009">Unknown Type</key>
<keyname="brand_0009">Unknown Type</key>
<!-- Emails messages -->
<keyname="email_0001">[ #!string!brand_0004!# ] - Critical level alert from #!variable!host_name!#</key>
<keyname="email_0002">[ #!string!brand_0004!# ] - Warning level alert from #!variable!host_name!#</key>
<keyname="email_0003">[ #!string!brand_0004!# ] - Notice level alert from #!variable!host_name!#</key>
<keyname="email_0004">[ #!string!brand_0004!# ] - Informational level alert from #!variable!host_name!#</key>
<keyname="email_0005">
--
This alert email was sent from the machine:
- #!variable!host_name!#
It was generated by #!string!brand_0004!#, which is part of the #!string!brand_0002!# Intelligent Availability platform running on the host above.
This email was *not* sent by #!string!scancore_brand_0001!#. If you do not know why you are receiving this email, please speak to your system's administrator.
If you need any assistance, please feel free to contact #!string!brand_0001!# (https://alteeve.com) and we will do our best to assist.
</key>
<!-- Errors -->
<!-- Errors -->
<keyname="error_0001">There are not enough network interfaces on this machine. You have: [#!variable!interface_count!#] interface(s), and you need at least: [#!variable!required_interfaces_for_single!#] interfaces to connect to the requested networks (one for Back-Channel and one for each Internet-Facing network).</key>
<keyname="error_0001">There are not enough network interfaces on this machine. You have: [#!variable!interface_count!#] interface(s), and you need at least: [#!variable!required_interfaces_for_single!#] interfaces to connect to the requested networks (one for Back-Channel and one for each Internet-Facing network).</key>
<keyname="error_0002">The local system UUID can't be read yet. This might be because the system is brand new and/or ScanCore hasn't run yet. Please try again in a minute.</key>
<keyname="error_0002">The local system UUID can't be read yet. This might be because the system is brand new and/or ScanCore hasn't run yet. Please try again in a minute.</key>
@ -158,7 +175,7 @@ Failed to generate an RSA public key for the user: [#!variable!user!#]. The outp
<keyname="error_0105">The file: [#!variable!file!#] was not found.</key>
<keyname="error_0105">The file: [#!variable!file!#] was not found.</key>
<keyname="error_0106"><![CDATA[The method Network->find_matches() was given the hash key: [#!variable!key!#], but it does not reference a hash. Are any IPs associated with this target?]]></key>
<keyname="error_0106"><![CDATA[The method Network->find_matches() was given the hash key: [#!variable!key!#], but it does not reference a hash. Are any IPs associated with this target?]]></key>
<keyname="error_0107">Failed to reconnect after reconfiguring the network, exiting.</key>
<keyname="error_0107">Failed to reconnect after reconfiguring the network, exiting.</key>
<keyname="error_0108">The 'recipient_new_level': [#!variable!recipient_new_level!#] is invalid. It should be '0', '1', '2', or '3'.</key>
<keyname="error_0108">The 'recipient_level': [#!variable!recipient_level!#] is invalid. It should be '0', '1', '2', or '3'.</key>
<keyname="error_0109">The 'notification_alert_level': [#!variable!notification_alert_level!#] is invalid. It should be '0', '1', '2', or '3'.</key>
<keyname="error_0109">The 'notification_alert_level': [#!variable!notification_alert_level!#] is invalid. It should be '0', '1', '2', or '3'.</key>
<keyname="error_0110">The 'notification_uuid': [#!variable!notification_uuid!#] was not found in the database.</key>
<keyname="error_0110">The 'notification_uuid': [#!variable!notification_uuid!#] was not found in the database.</key>
</key><!-- Translation note: System->update_hosts() looks for '##] anvil-daemon [##' to know if this alert was added to /etc/hosts. As such, please retain that exact string in your translation. -->
</key><!-- Translation note: System->update_hosts() looks for '##] anvil-daemon [##' to know if this alert was added to /etc/hosts. As such, please retain that exact string in your translation. -->
<keyname="message_0178">Hosts added or updated by the #!string!brand_0002!# on: [#!variable!date!#]:</key>
<keyname="message_0178">Hosts added or updated by the #!string!brand_0002!# on: [#!variable!date!#]:</key>
<keyname="message_0179">ScanCore has started.</key>
<!-- Success messages shown to the user -->
<!-- Success messages shown to the user -->
<keyname="ok_0001">Saved the mail server information successfully!</key>
<keyname="ok_0001">Saved the mail server information successfully!</key>
@ -1699,8 +1718,8 @@ Here we will inject 't_0006', which injects 't_0001' which has a variable: [#!st