diff --git a/frontend/src/Settings/Notifications/Notifications/Notification.js b/frontend/src/Settings/Notifications/Notifications/Notification.js
index 1331a7c8b..66021fd0d 100644
--- a/frontend/src/Settings/Notifications/Notifications/Notification.js
+++ b/frontend/src/Settings/Notifications/Notifications/Notification.js
@@ -57,9 +57,11 @@ class Notification extends Component {
name,
onGrab,
onHealthIssue,
+ onHealthRestored,
onApplicationUpdate,
supportsOnGrab,
supportsOnHealthIssue,
+ supportsOnHealthRestored,
supportsOnApplicationUpdate
} = this.props;
@@ -74,17 +76,27 @@ class Notification extends Component {
{
- supportsOnGrab && onGrab &&
+ supportsOnGrab && onGrab ?
+ :
+ null
}
{
- supportsOnHealthIssue && onHealthIssue &&
+ supportsOnHealthIssue && onHealthIssue ?
+ :
+ null
+ }
+
+ {
+ supportsOnHealthRestored && onHealthRestored ?
+ :
+ null
}
{
@@ -96,7 +108,7 @@ class Notification extends Component {
}
{
- !onGrab && !onHealthIssue && !onApplicationUpdate ?
+ !onGrab && !onHealthIssue && !onHealthRestored && !onApplicationUpdate ?
+
+
+
+
{
- onHealthIssue.value &&
+ (onHealthIssue.value || onHealthRestored.value) &&
x.ImplementationName)
.Ignore(i => i.SupportsOnGrab)
.Ignore(i => i.SupportsOnHealthIssue)
+ .Ignore(i => i.SupportsOnHealthRestored)
.Ignore(i => i.SupportsOnApplicationUpdate);
Mapper.Entity("IndexerProxies").RegisterModel()
diff --git a/src/NzbDrone.Core/HealthCheck/HealthCheckRestoredEvent.cs b/src/NzbDrone.Core/HealthCheck/HealthCheckRestoredEvent.cs
new file mode 100644
index 000000000..a31b63cc4
--- /dev/null
+++ b/src/NzbDrone.Core/HealthCheck/HealthCheckRestoredEvent.cs
@@ -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;
+ }
+ }
+}
diff --git a/src/NzbDrone.Core/HealthCheck/HealthCheckService.cs b/src/NzbDrone.Core/HealthCheck/HealthCheckService.cs
index 1538674ab..11ae42719 100644
--- a/src/NzbDrone.Core/HealthCheck/HealthCheckService.cs
+++ b/src/NzbDrone.Core/HealthCheck/HealthCheckService.cs
@@ -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
diff --git a/src/NzbDrone.Core/Localization/Core/en.json b/src/NzbDrone.Core/Localization/Core/en.json
index 77db15c79..48d631a9a 100644
--- a/src/NzbDrone.Core/Localization/Core/en.json
+++ b/src/NzbDrone.Core/Localization/Core/en.json
@@ -294,6 +294,8 @@
"OnGrabHelpText": "On Release Grab",
"OnHealthIssue": "On Health Issue",
"OnHealthIssueHelpText": "On Health Issue",
+ "OnHealthRestored": "On Health Restored",
+ "OnHealthRestoredHelpText": "On Health Restored",
"OpenBrowserOnStart": "Open browser on start",
"OpenThisModal": "Open This Modal",
"Options": "Options",
diff --git a/src/NzbDrone.Core/Notifications/Apprise/Apprise.cs b/src/NzbDrone.Core/Notifications/Apprise/Apprise.cs
index d2b896b3f..ef84b743c 100644
--- a/src/NzbDrone.Core/Notifications/Apprise/Apprise.cs
+++ b/src/NzbDrone.Core/Notifications/Apprise/Apprise.cs
@@ -27,6 +27,11 @@ namespace NzbDrone.Core.Notifications.Apprise
_proxy.SendNotification(HEALTH_ISSUE_TITLE_BRANDED, 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_BRANDED, updateMessage.Message, Settings);
diff --git a/src/NzbDrone.Core/Notifications/Boxcar/Boxcar.cs b/src/NzbDrone.Core/Notifications/Boxcar/Boxcar.cs
index c4caa0435..c1f616d5a 100644
--- a/src/NzbDrone.Core/Notifications/Boxcar/Boxcar.cs
+++ b/src/NzbDrone.Core/Notifications/Boxcar/Boxcar.cs
@@ -26,6 +26,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);
diff --git a/src/NzbDrone.Core/Notifications/CustomScript/CustomScript.cs b/src/NzbDrone.Core/Notifications/CustomScript/CustomScript.cs
index 13dfa8478..f87917468 100755
--- a/src/NzbDrone.Core/Notifications/CustomScript/CustomScript.cs
+++ b/src/NzbDrone.Core/Notifications/CustomScript/CustomScript.cs
@@ -55,6 +55,21 @@ namespace NzbDrone.Core.Notifications.CustomScript
ExecuteScript(environmentVariables);
}
+ public override void OnHealthRestored(HealthCheck.HealthCheck previousCheck)
+ {
+ var environmentVariables = new StringDictionary();
+
+ environmentVariables.Add("Prowlarr_EventType", "HealthRestored");
+ environmentVariables.Add("Prowlarr_InstanceName", _configFileProvider.InstanceName);
+ environmentVariables.Add("Prowlarr_ApplicationUrl", _configService.ApplicationUrl);
+ environmentVariables.Add("Prowlarr_Health_Restored_Level", Enum.GetName(typeof(HealthCheckResult), previousCheck.Type));
+ environmentVariables.Add("Prowlarr_Health_Restored_Message", previousCheck.Message);
+ environmentVariables.Add("Prowlarr_Health_Restored_Type", previousCheck.Source.Name);
+ environmentVariables.Add("Prowlarr_Health_Restored_Wiki", previousCheck.WikiUrl.ToString() ?? string.Empty);
+
+ ExecuteScript(environmentVariables);
+ }
+
public override void OnApplicationUpdate(ApplicationUpdateMessage updateMessage)
{
var environmentVariables = new StringDictionary();
diff --git a/src/NzbDrone.Core/Notifications/Discord/Discord.cs b/src/NzbDrone.Core/Notifications/Discord/Discord.cs
index ca69464a4..9eb41e989 100644
--- a/src/NzbDrone.Core/Notifications/Discord/Discord.cs
+++ b/src/NzbDrone.Core/Notifications/Discord/Discord.cs
@@ -101,6 +101,29 @@ namespace NzbDrone.Core.Notifications.Discord
_proxy.SendPayload(payload, Settings);
}
+ public override void OnHealthRestored(HealthCheck.HealthCheck previousCheck)
+ {
+ var attachments = new List