1
0
mirror of https://github.com/Radarr/Radarr.git synced 2026-04-17 21:26:22 -04:00

New: On Health Restored notification

(cherry picked from commit 5fdc8514da7c7ad98192f2ecb2415b3a7b5d0d05)
This commit is contained in:
The Dark
2023-05-08 02:57:14 +01:00
committed by Bogdan
parent 164f9ca868
commit 8563ed0a20
37 changed files with 286 additions and 4 deletions

View File

@@ -84,6 +84,11 @@ namespace NzbDrone.Core.Test.NotificationTests
TestLogger.Info("OnHealthIssue was called");
}
public override void OnHealthRestored(Core.HealthCheck.HealthCheck healthCheck)
{
TestLogger.Info("OnHealthRestored was called");
}
public override void OnApplicationUpdate(ApplicationUpdateMessage updateMessage)
{
TestLogger.Info("OnApplicationUpdate was called");
@@ -127,6 +132,7 @@ namespace NzbDrone.Core.Test.NotificationTests
notification.SupportsOnMovieFileDelete.Should().BeTrue();
notification.SupportsOnMovieFileDeleteForUpgrade.Should().BeTrue();
notification.SupportsOnHealthIssue.Should().BeTrue();
notification.SupportsOnHealthRestored.Should().BeTrue();
notification.SupportsOnApplicationUpdate.Should().BeTrue();
}
@@ -144,6 +150,7 @@ namespace NzbDrone.Core.Test.NotificationTests
notification.SupportsOnMovieFileDelete.Should().BeFalse();
notification.SupportsOnMovieFileDeleteForUpgrade.Should().BeFalse();
notification.SupportsOnHealthIssue.Should().BeFalse();
notification.SupportsOnHealthRestored.Should().BeFalse();
notification.SupportsOnApplicationUpdate.Should().BeFalse();
}
}

View File

@@ -0,0 +1,14 @@
using FluentMigrator;
using NzbDrone.Core.Datastore.Migration.Framework;
namespace NzbDrone.Core.Datastore.Migration
{
[Migration(220)]
public class health_restored_notification : NzbDroneMigrationBase
{
protected override void MainDbUpgrade()
{
Alter.Table("Notifications").AddColumn("OnHealthRestored").AsBoolean().WithDefaultValue(false);
}
}
}

View File

@@ -93,6 +93,7 @@ namespace NzbDrone.Core.Datastore
.Ignore(i => i.SupportsOnMovieFileDelete)
.Ignore(i => i.SupportsOnMovieFileDeleteForUpgrade)
.Ignore(i => i.SupportsOnHealthIssue)
.Ignore(i => i.SupportsOnHealthRestored)
.Ignore(i => i.SupportsOnApplicationUpdate);
Mapper.Entity<MetadataDefinition>("Metadata").RegisterModel()

View File

@@ -0,0 +1,16 @@
using NzbDrone.Common.Messaging;
namespace NzbDrone.Core.HealthCheck
{
public class HealthCheckRestoredEvent : IEvent
{
public HealthCheck PreviousCheck { get; private set; }
public bool IsInStartupGracePeriod { get; private set; }
public HealthCheckRestoredEvent(HealthCheck previousCheck, bool isInStartupGracePeriod)
{
PreviousCheck = previousCheck;
IsInStartupGracePeriod = isInStartupGracePeriod;
}
}
}

View File

@@ -91,6 +91,13 @@ namespace NzbDrone.Core.HealthCheck
{
if (result.Type == HealthCheckResult.Ok)
{
var previous = _healthCheckResults.Find(result.Source.Name);
if (previous != null)
{
_eventAggregator.PublishEvent(new HealthCheckRestoredEvent(previous, !_hasRunHealthChecksAfterGracePeriod));
}
_healthCheckResults.Remove(result.Source.Name);
}
else

View File

@@ -652,6 +652,8 @@
"OnGrabHelpText": "On Grab",
"OnHealthIssue": "On Health Issue",
"OnHealthIssueHelpText": "On Health Issue",
"OnHealthRestored": "On Health Restored",
"OnHealthRestoredHelpText": "On Health Restored",
"OnImport": "On Import",
"OnLatestVersion": "The latest version of Radarr is already installed",
"OnMovieAdded": "On Movie Added",

View File

@@ -48,6 +48,11 @@ namespace NzbDrone.Core.Notifications.Apprise
_proxy.SendNotification(HEALTH_ISSUE_TITLE, healthCheck.Message, Settings);
}
public override void OnHealthRestored(HealthCheck.HealthCheck previousCheck)
{
_proxy.SendNotification(HEALTH_RESTORED_TITLE, $"The following issue is now resolved: {previousCheck.Message}", Settings);
}
public override void OnApplicationUpdate(ApplicationUpdateMessage updateMessage)
{
_proxy.SendNotification(APPLICATION_UPDATE_TITLE, updateMessage.Message, Settings);

View File

@@ -47,6 +47,11 @@ namespace NzbDrone.Core.Notifications.Boxcar
_proxy.SendNotification(HEALTH_ISSUE_TITLE, message.Message, Settings);
}
public override void OnHealthRestored(HealthCheck.HealthCheck previousCheck)
{
_proxy.SendNotification(HEALTH_RESTORED_TITLE, $"The following issue is now resolved: {previousCheck.Message}", Settings);
}
public override void OnApplicationUpdate(ApplicationUpdateMessage message)
{
_proxy.SendNotification(APPLICATION_UPDATE_TITLE, message.Message, Settings);

View File

@@ -248,6 +248,21 @@ namespace NzbDrone.Core.Notifications.CustomScript
ExecuteScript(environmentVariables);
}
public override void OnHealthRestored(HealthCheck.HealthCheck previousCheck)
{
var environmentVariables = new StringDictionary();
environmentVariables.Add("Radarr_EventType", "HealthRestored");
environmentVariables.Add("Radarr_InstanceName", _configFileProvider.InstanceName);
environmentVariables.Add("Radarr_ApplicationUrl", _configService.ApplicationUrl);
environmentVariables.Add("Radarr_Health_Restored_Level", Enum.GetName(typeof(HealthCheckResult), previousCheck.Type));
environmentVariables.Add("Radarr_Health_Restored_Message", previousCheck.Message);
environmentVariables.Add("Radarr_Health_Restored_Type", previousCheck.Source.Name);
environmentVariables.Add("Radarr_Health_Restored_Wiki", previousCheck.WikiUrl.ToString() ?? string.Empty);
ExecuteScript(environmentVariables);
}
public override void OnApplicationUpdate(ApplicationUpdateMessage updateMessage)
{
var environmentVariables = new StringDictionary();

View File

@@ -321,6 +321,29 @@ namespace NzbDrone.Core.Notifications.Discord
_proxy.SendPayload(payload, Settings);
}
public override void OnHealthRestored(HealthCheck.HealthCheck previousCheck)
{
var attachments = new List<Embed>
{
new Embed
{
Author = new DiscordAuthor
{
Name = Settings.Author.IsNullOrWhiteSpace() ? Environment.MachineName : Settings.Author,
IconUrl = "https://raw.githubusercontent.com/Radarr/Radarr/develop/Logo/256.png"
},
Title = "Health Issue Resolved: " + previousCheck.Source.Name,
Description = $"The following issue is now resolved: {previousCheck.Message}",
Timestamp = DateTime.UtcNow.ToString("yyyy-MM-ddTHH:mm:ss.fffZ"),
Color = (int)DiscordColors.Success
}
};
var payload = CreatePayload(null, attachments);
_proxy.SendPayload(payload, Settings);
}
public override void OnApplicationUpdate(ApplicationUpdateMessage updateMessage)
{
var attachments = new List<Embed>

View File

@@ -67,6 +67,11 @@ namespace NzbDrone.Core.Notifications.Email
SendEmail(Settings, HEALTH_ISSUE_TITLE_BRANDED, message.Message);
}
public override void OnHealthRestored(HealthCheck.HealthCheck previousMessage)
{
SendEmail(Settings, HEALTH_RESTORED_TITLE_BRANDED, $"The following issue is now resolved: {previousMessage.Message}");
}
public override void OnApplicationUpdate(ApplicationUpdateMessage updateMessage)
{
var body = $"{updateMessage.Message}";

View File

@@ -53,6 +53,11 @@ namespace NzbDrone.Core.Notifications.Gotify
SendNotification(HEALTH_ISSUE_TITLE, healthCheck.Message, null);
}
public override void OnHealthRestored(HealthCheck.HealthCheck previousCheck)
{
SendNotification(HEALTH_RESTORED_TITLE, $"The following issue is now resolved: {previousCheck.Message}", null);
}
public override void OnApplicationUpdate(ApplicationUpdateMessage message)
{
SendNotification(APPLICATION_UPDATE_TITLE, message.Message, null);

View File

@@ -16,6 +16,7 @@ namespace NzbDrone.Core.Notifications
void OnMovieDelete(MovieDeleteMessage deleteMessage);
void OnMovieAdded(Movie movie);
void OnHealthIssue(HealthCheck.HealthCheck healthCheck);
void OnHealthRestored(HealthCheck.HealthCheck previousCheck);
void OnApplicationUpdate(ApplicationUpdateMessage updateMessage);
void ProcessQueue();
bool SupportsOnGrab { get; }
@@ -27,6 +28,7 @@ namespace NzbDrone.Core.Notifications
bool SupportsOnMovieFileDelete { get; }
bool SupportsOnMovieFileDeleteForUpgrade { get; }
bool SupportsOnHealthIssue { get; }
bool SupportsOnHealthRestored { get; }
bool SupportsOnApplicationUpdate { get; }
}
}

View File

@@ -48,6 +48,11 @@ namespace NzbDrone.Core.Notifications.Join
_proxy.SendNotification(HEALTH_ISSUE_TITLE_BRANDED, message.Message, Settings);
}
public override void OnHealthRestored(HealthCheck.HealthCheck previousMessage)
{
_proxy.SendNotification(HEALTH_RESTORED_TITLE_BRANDED, $"The following issue is now resolved: {previousMessage.Message}", Settings);
}
public override void OnApplicationUpdate(ApplicationUpdateMessage updateMessage)
{
_proxy.SendNotification(APPLICATION_UPDATE_TITLE_BRANDED, updateMessage.Message, Settings);

View File

@@ -54,6 +54,11 @@ namespace NzbDrone.Core.Notifications.Mailgun
_proxy.SendNotification(HEALTH_ISSUE_TITLE, healthCheckMessage.Message, Settings);
}
public override void OnHealthRestored(HealthCheck.HealthCheck previousCheckMessage)
{
_proxy.SendNotification(HEALTH_RESTORED_TITLE_BRANDED, $"The following issue is now resolved: {previousCheckMessage.Message}", Settings);
}
public override void OnApplicationUpdate(ApplicationUpdateMessage updateMessage)
{
_proxy.SendNotification(APPLICATION_UPDATE_TITLE, updateMessage.Message, Settings);

View File

@@ -55,6 +55,14 @@ namespace NzbDrone.Core.Notifications.Emby
}
}
public override void OnHealthRestored(HealthCheck.HealthCheck previousMessage)
{
if (Settings.Notify)
{
_mediaBrowserService.Notify(Settings, HEALTH_RESTORED_TITLE_BRANDED, $"The following issue is now resolved: {previousMessage.Message}");
}
}
public override void OnApplicationUpdate(ApplicationUpdateMessage updateMessage)
{
if (Settings.Notify)

View File

@@ -57,6 +57,11 @@ namespace NzbDrone.Core.Notifications.Notifiarr
_proxy.SendNotification(BuildHealthPayload(healthCheck), Settings);
}
public override void OnHealthRestored(HealthCheck.HealthCheck previousCheck)
{
_proxy.SendNotification(BuildHealthRestoredPayload(previousCheck), Settings);
}
public override void OnApplicationUpdate(ApplicationUpdateMessage updateMessage)
{
_proxy.SendNotification(BuildApplicationUpdatePayload(updateMessage), Settings);

View File

@@ -17,6 +17,7 @@ namespace NzbDrone.Core.Notifications
protected const string MOVIE_DELETED_TITLE = "Movie Deleted";
protected const string MOVIE_FILE_DELETED_TITLE = "Movie File Deleted";
protected const string HEALTH_ISSUE_TITLE = "Health Check Failure";
protected const string HEALTH_RESTORED_TITLE = "Health Check Restored";
protected const string APPLICATION_UPDATE_TITLE = "Application Updated";
protected const string MOVIE_GRABBED_TITLE_BRANDED = "Radarr - " + MOVIE_GRABBED_TITLE;
@@ -25,6 +26,7 @@ namespace NzbDrone.Core.Notifications
protected const string MOVIE_DELETED_TITLE_BRANDED = "Radarr - " + MOVIE_DELETED_TITLE;
protected const string MOVIE_FILE_DELETED_TITLE_BRANDED = "Radarr - " + MOVIE_FILE_DELETED_TITLE;
protected const string HEALTH_ISSUE_TITLE_BRANDED = "Radarr - " + HEALTH_ISSUE_TITLE;
protected const string HEALTH_RESTORED_TITLE_BRANDED = "Radarr - " + HEALTH_RESTORED_TITLE;
protected const string APPLICATION_UPDATE_TITLE_BRANDED = "Radarr - " + APPLICATION_UPDATE_TITLE;
public abstract string Name { get; }
@@ -68,6 +70,10 @@ namespace NzbDrone.Core.Notifications
{
}
public virtual void OnHealthRestored(HealthCheck.HealthCheck previousCheck)
{
}
public virtual void OnApplicationUpdate(ApplicationUpdateMessage updateMessage)
{
}
@@ -85,6 +91,7 @@ namespace NzbDrone.Core.Notifications
public bool SupportsOnMovieFileDelete => HasConcreteImplementation("OnMovieFileDelete");
public bool SupportsOnMovieFileDeleteForUpgrade => SupportsOnMovieFileDelete;
public bool SupportsOnHealthIssue => HasConcreteImplementation("OnHealthIssue");
public bool SupportsOnHealthRestored => HasConcreteImplementation("OnHealthRestored");
public bool SupportsOnApplicationUpdate => HasConcreteImplementation("OnApplicationUpdate");
protected TSettings Settings => (TSettings)Definition.Settings;

View File

@@ -13,6 +13,7 @@ namespace NzbDrone.Core.Notifications
public bool OnMovieFileDelete { get; set; }
public bool OnMovieFileDeleteForUpgrade { get; set; }
public bool OnHealthIssue { get; set; }
public bool OnHealthRestored { get; set; }
public bool OnApplicationUpdate { get; set; }
public bool SupportsOnGrab { get; set; }
public bool SupportsOnDownload { get; set; }
@@ -23,9 +24,10 @@ namespace NzbDrone.Core.Notifications
public bool SupportsOnMovieFileDelete { get; set; }
public bool SupportsOnMovieFileDeleteForUpgrade { get; set; }
public bool SupportsOnHealthIssue { get; set; }
public bool SupportsOnHealthRestored { get; set; }
public bool IncludeHealthWarnings { get; set; }
public bool SupportsOnApplicationUpdate { get; set; }
public override bool Enable => OnGrab || OnDownload || (OnDownload && OnUpgrade) || OnMovieAdded || OnMovieDelete || OnMovieFileDelete || OnMovieFileDeleteForUpgrade || OnHealthIssue || OnApplicationUpdate;
public override bool Enable => OnGrab || OnDownload || (OnDownload && OnUpgrade) || OnMovieAdded || OnMovieDelete || OnMovieFileDelete || OnMovieFileDeleteForUpgrade || OnHealthIssue || OnHealthRestored || OnApplicationUpdate;
}
}

View File

@@ -17,6 +17,7 @@ namespace NzbDrone.Core.Notifications
List<INotification> OnMovieDeleteEnabled();
List<INotification> OnMovieFileDeleteEnabled();
List<INotification> OnHealthIssueEnabled();
List<INotification> OnHealthRestoredEnabled();
List<INotification> OnApplicationUpdateEnabled();
}
@@ -72,6 +73,11 @@ namespace NzbDrone.Core.Notifications
return GetAvailableProviders().Where(n => ((NotificationDefinition)n.Definition).OnHealthIssue).ToList();
}
public List<INotification> OnHealthRestoredEnabled()
{
return GetAvailableProviders().Where(n => ((NotificationDefinition)n.Definition).OnHealthRestored).ToList();
}
public List<INotification> OnApplicationUpdateEnabled()
{
return GetAvailableProviders().Where(n => ((NotificationDefinition)n.Definition).OnApplicationUpdate).ToList();
@@ -90,6 +96,7 @@ namespace NzbDrone.Core.Notifications
definition.SupportsOnMovieFileDelete = provider.SupportsOnMovieFileDelete;
definition.SupportsOnMovieFileDeleteForUpgrade = provider.SupportsOnMovieFileDeleteForUpgrade;
definition.SupportsOnHealthIssue = provider.SupportsOnHealthIssue;
definition.SupportsOnHealthRestored = provider.SupportsOnHealthRestored;
definition.SupportsOnApplicationUpdate = provider.SupportsOnApplicationUpdate;
}
}

View File

@@ -23,6 +23,7 @@ namespace NzbDrone.Core.Notifications
IHandle<MoviesImportedEvent>,
IHandle<MovieFileDeletedEvent>,
IHandle<HealthCheckFailedEvent>,
IHandle<HealthCheckRestoredEvent>,
IHandle<UpdateInstalledEvent>,
IHandleAsync<DeleteCompletedEvent>,
IHandleAsync<DownloadsProcessedEvent>,
@@ -311,6 +312,29 @@ namespace NzbDrone.Core.Notifications
}
}
public void Handle(HealthCheckRestoredEvent message)
{
if (message.IsInStartupGracePeriod)
{
return;
}
foreach (var notification in _notificationFactory.OnHealthRestoredEnabled())
{
try
{
if (ShouldHandleHealthFailure(message.PreviousCheck, ((NotificationDefinition)notification.Definition).IncludeHealthWarnings))
{
notification.OnHealthRestored(message.PreviousCheck);
}
}
catch (Exception ex)
{
_logger.Warn(ex, "Unable to send OnHealthRestored notification to: " + notification.Definition.Name);
}
}
}
public void HandleAsync(DeleteCompletedEvent message)
{
ProcessQueue();

View File

@@ -49,6 +49,11 @@ namespace NzbDrone.Core.Notifications.Ntfy
_proxy.SendNotification(HEALTH_ISSUE_TITLE_BRANDED, healthCheck.Message, Settings);
}
public override void OnHealthRestored(HealthCheck.HealthCheck previousCheck)
{
_proxy.SendNotification(HEALTH_RESTORED_TITLE_BRANDED, $"The following issue is now resolved: {previousCheck.Message}", Settings);
}
public override void OnApplicationUpdate(ApplicationUpdateMessage updateMessage)
{
_proxy.SendNotification(APPLICATION_UPDATE_TITLE_BRANDED, updateMessage.Message, Settings);

View File

@@ -47,6 +47,11 @@ namespace NzbDrone.Core.Notifications.Prowl
_prowlProxy.SendNotification(HEALTH_ISSUE_TITLE, message.Message, Settings);
}
public override void OnHealthRestored(HealthCheck.HealthCheck previousMessage)
{
_prowlProxy.SendNotification(HEALTH_RESTORED_TITLE, $"The following issue is now resolved: {previousMessage.Message}", Settings);
}
public override void OnApplicationUpdate(ApplicationUpdateMessage updateMessage)
{
_prowlProxy.SendNotification(APPLICATION_UPDATE_TITLE, updateMessage.Message, Settings);

View File

@@ -50,6 +50,11 @@ namespace NzbDrone.Core.Notifications.PushBullet
_proxy.SendNotification(HEALTH_ISSUE_TITLE_BRANDED, healthCheck.Message, Settings);
}
public override void OnHealthRestored(HealthCheck.HealthCheck previousCheck)
{
_proxy.SendNotification(HEALTH_RESTORED_TITLE_BRANDED, $"The following issue is now resolved: {previousCheck.Message}", Settings);
}
public override void OnApplicationUpdate(ApplicationUpdateMessage updateMessage)
{
_proxy.SendNotification(APPLICATION_UPDATE_TITLE_BRANDED, updateMessage.Message, Settings);

View File

@@ -47,6 +47,11 @@ namespace NzbDrone.Core.Notifications.Pushover
_proxy.SendNotification(HEALTH_ISSUE_TITLE, healthCheck.Message, Settings);
}
public override void OnHealthRestored(HealthCheck.HealthCheck previousCheck)
{
_proxy.SendNotification(HEALTH_RESTORED_TITLE, $"The following issue is now resolved: {previousCheck.Message}", Settings);
}
public override void OnApplicationUpdate(ApplicationUpdateMessage updateMessage)
{
_proxy.SendNotification(APPLICATION_UPDATE_TITLE, updateMessage.Message, Settings);

View File

@@ -50,6 +50,11 @@ namespace NzbDrone.Core.Notifications.SendGrid
_proxy.SendNotification(HEALTH_ISSUE_TITLE, healthCheck.Message, Settings);
}
public override void OnHealthRestored(HealthCheck.HealthCheck previousCheck)
{
_proxy.SendNotification(HEALTH_RESTORED_TITLE, $"The following issue is now resolved: {previousCheck.Message}", Settings);
}
public override void OnApplicationUpdate(ApplicationUpdateMessage updateMessage)
{
_proxy.SendNotification(APPLICATION_UPDATE_TITLE, updateMessage.Message, Settings);

View File

@@ -47,6 +47,11 @@ namespace NzbDrone.Core.Notifications.Simplepush
_proxy.SendNotification(HEALTH_ISSUE_TITLE, healthCheck.Message, Settings);
}
public override void OnHealthRestored(HealthCheck.HealthCheck previousCheck)
{
_proxy.SendNotification(HEALTH_RESTORED_TITLE, $"The following issue is now resolved: {previousCheck.Message}", Settings);
}
public override void OnApplicationUpdate(ApplicationUpdateMessage updateMessage)
{
_proxy.SendNotification(APPLICATION_UPDATE_TITLE, updateMessage.Message, Settings);

View File

@@ -123,6 +123,23 @@ namespace NzbDrone.Core.Notifications.Slack
_proxy.SendPayload(payload, Settings);
}
public override void OnHealthRestored(HealthCheck.HealthCheck previousCheck)
{
var attachments = new List<Attachment>
{
new Attachment
{
Title = previousCheck.Source.Name,
Text = $"The following issue is now resolved: {previousCheck.Message}",
Color = "good"
}
};
var payload = CreatePayload("Health Issue Resolved", attachments);
_proxy.SendPayload(payload, Settings);
}
public override void OnApplicationUpdate(ApplicationUpdateMessage updateMessage)
{
var attachments = new List<Attachment>

View File

@@ -55,6 +55,11 @@ namespace NzbDrone.Core.Notifications.Telegram
_proxy.SendNotification(HEALTH_ISSUE_TITLE, healthCheck.Message, Settings);
}
public override void OnHealthRestored(HealthCheck.HealthCheck previousCheck)
{
_proxy.SendNotification(HEALTH_RESTORED_TITLE, $"The following issue is now resolved: {previousCheck.Message}", Settings);
}
public override void OnApplicationUpdate(ApplicationUpdateMessage updateMessage)
{
_proxy.SendNotification(APPLICATION_UPDATE_TITLE, updateMessage.Message, Settings);

View File

@@ -49,6 +49,11 @@ namespace NzbDrone.Core.Notifications.Twitter
_twitterService.SendNotification($"Health Issue: {healthCheck.Message}", Settings);
}
public override void OnHealthRestored(HealthCheck.HealthCheck previousCheck)
{
_twitterService.SendNotification($"Health Issue Resolved: {previousCheck.Message}", Settings);
}
public override void OnApplicationUpdate(ApplicationUpdateMessage updateMessage)
{
_twitterService.SendNotification($"Application Updated: {updateMessage.Message}", Settings);

View File

@@ -55,6 +55,11 @@ namespace NzbDrone.Core.Notifications.Webhook
_proxy.SendWebhook(BuildHealthPayload(healthCheck), Settings);
}
public override void OnHealthRestored(HealthCheck.HealthCheck previousCheck)
{
_proxy.SendWebhook(BuildHealthRestoredPayload(previousCheck), Settings);
}
public override void OnApplicationUpdate(ApplicationUpdateMessage updateMessage)
{
_proxy.SendWebhook(BuildApplicationUpdatePayload(updateMessage), Settings);

View File

@@ -143,6 +143,19 @@ namespace NzbDrone.Core.Notifications.Webhook
};
}
protected WebhookHealthPayload BuildHealthRestoredPayload(HealthCheck.HealthCheck healthCheck)
{
return new WebhookHealthPayload
{
EventType = WebhookEventType.HealthRestored,
InstanceName = _configFileProvider.InstanceName,
Level = healthCheck.Type,
Message = healthCheck.Message,
Type = healthCheck.Source.Name,
WikiUrl = healthCheck.WikiUrl?.ToString()
};
}
protected WebhookApplicationUpdatePayload BuildApplicationUpdatePayload(ApplicationUpdateMessage updateMessage)
{
return new WebhookApplicationUpdatePayload

View File

@@ -16,6 +16,7 @@ namespace NzbDrone.Core.Notifications.Webhook
MovieFileDelete,
Health,
ApplicationUpdate,
MovieAdded
MovieAdded,
HealthRestored
}
}

View File

@@ -66,6 +66,11 @@ namespace NzbDrone.Core.Notifications.Xbmc
Notify(Settings, HEALTH_ISSUE_TITLE_BRANDED, healthCheck.Message);
}
public override void OnHealthRestored(HealthCheck.HealthCheck previousCheck)
{
Notify(Settings, HEALTH_RESTORED_TITLE_BRANDED, $"The following issue is now resolved: {previousCheck.Message}");
}
public override void OnApplicationUpdate(ApplicationUpdateMessage updateMessage)
{
Notify(Settings, APPLICATION_UPDATE_TITLE_BRANDED, updateMessage.Message);

View File

@@ -14,6 +14,7 @@ namespace Radarr.Api.V3.Notifications
public bool OnMovieFileDelete { get; set; }
public bool OnMovieFileDeleteForUpgrade { get; set; }
public bool OnHealthIssue { get; set; }
public bool OnHealthRestored { get; set; }
public bool OnApplicationUpdate { get; set; }
public bool SupportsOnGrab { get; set; }
public bool SupportsOnDownload { get; set; }
@@ -24,6 +25,7 @@ namespace Radarr.Api.V3.Notifications
public bool SupportsOnMovieFileDelete { get; set; }
public bool SupportsOnMovieFileDeleteForUpgrade { get; set; }
public bool SupportsOnHealthIssue { get; set; }
public bool SupportsOnHealthRestored { get; set; }
public bool SupportsOnApplicationUpdate { get; set; }
public bool IncludeHealthWarnings { get; set; }
public string TestCommand { get; set; }
@@ -49,6 +51,7 @@ namespace Radarr.Api.V3.Notifications
resource.OnMovieFileDelete = definition.OnMovieFileDelete;
resource.OnMovieFileDeleteForUpgrade = definition.OnMovieFileDeleteForUpgrade;
resource.OnHealthIssue = definition.OnHealthIssue;
resource.OnHealthRestored = definition.OnHealthRestored;
resource.OnApplicationUpdate = definition.OnApplicationUpdate;
resource.SupportsOnGrab = definition.SupportsOnGrab;
resource.SupportsOnDownload = definition.SupportsOnDownload;
@@ -59,6 +62,7 @@ namespace Radarr.Api.V3.Notifications
resource.SupportsOnMovieFileDelete = definition.SupportsOnMovieFileDelete;
resource.SupportsOnMovieFileDeleteForUpgrade = definition.SupportsOnMovieFileDeleteForUpgrade;
resource.SupportsOnHealthIssue = definition.SupportsOnHealthIssue;
resource.SupportsOnHealthRestored = definition.SupportsOnHealthRestored;
resource.IncludeHealthWarnings = definition.IncludeHealthWarnings;
resource.SupportsOnApplicationUpdate = definition.SupportsOnApplicationUpdate;
@@ -83,6 +87,7 @@ namespace Radarr.Api.V3.Notifications
definition.OnMovieFileDelete = resource.OnMovieFileDelete;
definition.OnMovieFileDeleteForUpgrade = resource.OnMovieFileDeleteForUpgrade;
definition.OnHealthIssue = resource.OnHealthIssue;
definition.OnHealthRestored = resource.OnHealthRestored;
definition.OnApplicationUpdate = resource.OnApplicationUpdate;
definition.SupportsOnGrab = resource.SupportsOnGrab;
definition.SupportsOnDownload = resource.SupportsOnDownload;
@@ -93,6 +98,7 @@ namespace Radarr.Api.V3.Notifications
definition.SupportsOnMovieFileDelete = resource.SupportsOnMovieFileDelete;
definition.SupportsOnMovieFileDeleteForUpgrade = resource.SupportsOnMovieFileDeleteForUpgrade;
definition.SupportsOnHealthIssue = resource.SupportsOnHealthIssue;
definition.SupportsOnHealthRestored = resource.SupportsOnHealthRestored;
definition.IncludeHealthWarnings = resource.IncludeHealthWarnings;
definition.SupportsOnApplicationUpdate = resource.SupportsOnApplicationUpdate;