* Got anvil-manage-alerts managing alert overrides.
* Created, but for now commented out, the new 'audit' table.
Signed-off-by: Digimer <digimer@alteeve.ca>
anvil-manage-alerts \- This program manages alerts; Email servers, recipients, notification overrides, and generating test alerts.
anvil-manage-alerts \- This program manages alerts; Email servers, recipients, alert-override overrides, and generating test alerts.
.SHSYNOPSIS
.SHSYNOPSIS
.Banvil-manage-alerts
.Banvil-manage-alerts
\fI\,<command> \/\fR
\fI\,<command> \/\fR
.SHDESCRIPTION
.SHDESCRIPTION
The program allows you to add, edit and delete email servers, alert recipients, and notification overrides. You can also use it to generate a test alert.
The program allows you to add, edit and delete email servers, alert recipients, and alert-override overrides. You can also use it to generate a test alert.
If run without any switches, the list of mail servers and recipients are returned.
If run without any switches, the list of mail servers and recipients are returned.
When called without any switches, the list of currect mail servers, alert recipients and notification overrides are shown, along with all known hosts.
When called without any switches, the list of currect mail servers, alert recipients and alert-override overrides are shown, along with all known hosts.
This is where an alert recipient can have notification overrides. Typically this is used so that a given user can ignore alerts from a specific Anvil! node pair.
This is where an alert recipient can have alert-override overrides. Typically this is used so that a given user can ignore alerts from a specific Anvil! node pair.
.TP
.TP
\fB\-\-notification-uuid\fR <uuid>
\fB\-\-alert-override-uuid\fR <uuid>
This is required for \fB\-\-edit\fR and \fB\-\-delete\fR. It is the existing notification override being worked on.
This is required for \fB\-\-edit\fR and \fB\-\-delete\fR. It is the existing alert-override override being worked on.
.TP
.TP
\fB\-\-notification-recipient-uuid\fR <uuid>
\fB\-\-alert-override-recipient-uuid\fR <uuid>
This is the recipients -> recipient_uuid who we are creating the override for.
This is the recipients -> recipient_uuid who we are creating the override for.
.TP
.TP
\fB\-\-notification-host-uuid\fR
\fB\-\-alert-override-host-uuid\fR
This is the hosts -> host_uuid of the machine that you are creating the alert
This is the hosts -> host_uuid of the machine that you are creating the alert
.TP
.TP
\fB\-\-notification-alert-level\fR <1, 2, 3 or 4>
\fB\-\-alert-override-alert-level\fR <1, 2, 3 or 4>
This is the desired override alert level.
This is the desired override alert level.
Valid values are:
Valid values are:
@ -121,7 +121,7 @@ Example: notaspy@example.com
In the future, languages will be added and this can be used to indicate what language the user will receive their alerts in. At the time of writing this man page, only 'en_CA' is supported.
In the future, languages will be added and this can be used to indicate what language the user will receive their alerts in. At the time of writing this man page, only 'en_CA' is supported.
.TP
.TP
\fB\-\-recipient-level\fR <1, 2, 3 or 4>
\fB\-\-recipient-level\fR <1, 2, 3 or 4>
This is the default alert level this recipient is interested in. It can be adjusted on a per-host basis via the 'notifications' over-rides.
This is the default alert level this recipient is interested in. It can be adjusted on a per-host basis via the 'alert-overrides' over-rides.
Valid values are:
Valid values are:
@ -137,6 +137,3 @@ Valid values are:
Written by Madison Kelly, Alteeve staff and the Anvil! project contributors.
Written by Madison Kelly, Alteeve staff and the Anvil! project contributors.
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_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_levelintegernotnull,-- This is the default alert level this recipient is interested in. It can be adjusted on a per-host basis via the 'alert_overrides' table.
-- This table is used when a user wants to set a custom alert level for a given machine. Typically this is
-- This table is used when a user wants to set a custom alert level for a given machine. Typically this is
-- used to ignore test Anvil! systems.
-- used to ignore test Anvil! systems.
CREATETABLEnotifications(
CREATETABLEalert_overrides(
notification_uuiduuidnotnullprimarykey,
alert_override_uuiduuidnotnullprimarykey,
notification_recipient_uuiduuidnotnull,-- The recipient we're linking.
alert_override_recipient_uuiduuidnotnull,-- The recipient we're linking.
notification_host_uuiduuidnotnull,-- This host_uuid of the referenced machine
alert_override_host_uuiduuidnotnull,-- This host_uuid of the referenced machine
notification_alert_levelintegernotnull,-- This is the alert level (at or above) that this user wants alerts from.
alert_override_alert_levelintegernotnull,-- This is the alert level (at or above) that this user wants alerts from. If set to '-1', the record is deleted.
@ -165,8 +165,8 @@ 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? The caller was: [#!variable!source!#:#!variable!line!#].]]></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? The caller was: [#!variable!source!#:#!variable!line!#].]]></key>
<keyname="error_0107">Failed to reconnect after reconfiguring the network. Will reboot in hopes of coming up cleanly.</key>
<keyname="error_0107">Failed to reconnect after reconfiguring the network. Will reboot in hopes of coming up cleanly.</key>
<keyname="error_0108">The 'recipient_level': [#!variable!recipient_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', '3', or '4'.</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', '3', or '4'.</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>
<keyname="error_0111">
<keyname="error_0111">
[ Error ] - The was a problem parsing the unified metadata:
[ Error ] - The was a problem parsing the unified metadata:
@ -553,6 +553,9 @@ The definition data passed in was:
<keyname="error_0386">[ Error ] - The email address: [#!variable!email!#] appears to be invalid.</key>
<keyname="error_0386">[ Error ] - The email address: [#!variable!email!#] appears to be invalid.</key>
<keyname="error_0387">[ Error ] - The switch: [--#!variable!switch!#] is required, but not provided.</key>
<keyname="error_0387">[ Error ] - The switch: [--#!variable!switch!#] is required, but not provided.</key>
<keyname="error_0388">[ Error ] - The mail server UUID: [#!variable!uuid!#] was not found.</key>
<keyname="error_0388">[ Error ] - The mail server UUID: [#!variable!uuid!#] was not found.</key>
<keyname="error_0389">[ Error ] - I was asked to delete a notification over-ride, but no 'notification_uuid' was provides.</key>
<keyname="error_0390">[ Error ] - The alert recipient UUID: [#!variable!uuid!#] wasn't found in the database.</key>
<keyname="error_0391">[ Error ] - The host UUID: [#!variable!uuid!#] wasn't found in the database.</key>
<!-- Files templates -->
<!-- Files templates -->
<!-- NOTE: Translating these files requires an understanding of which lines are translatable -->
<!-- NOTE: Translating these files requires an understanding of which lines are translatable -->
# This converts the old/broken 'notifications' tables with the more appropriately named 'alert-override'
if (1)
{
foreach my $uuid (sort {$a cmp $b} keys %{$anvil->data->{cache}{database_handle}})
{
my $query = "SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = 'public' AND table_catalog = 'anvil' AND table_name = 'notifications';";
$anvil->Log->variables({source => $THIS_FILE, uuid => $uuid, line => __LINE__, level => 2, list => { query => $query }});
my $count = $anvil->Database->query({query => $query, source => $THIS_FILE, line => __LINE__})->[0]->[0];
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { count => $count }});
if ($count)
{
my $queries = [];
push @{$queries}, "DROP FUNCTION history_notifications() CASCADE;";
alert_override_recipient_uuid uuid not null, -- The recipient we're linking.
alert_override_host_uuid uuid not null, -- This host_uuid of the referenced machine
alert_override_alert_level integer not null, -- This is the alert level (at or above) that this user wants alerts from. If set to '-1', the record is deleted.