mirror of
https://github.com/Sonarr/Sonarr.git
synced 2026-03-05 13:20:20 -05:00
Add reason to health check
This commit is contained in:
@@ -14,7 +14,7 @@ namespace NzbDrone.Core.Test.HealthCheck
|
||||
[TestCase("I blew up because of some weird user mistake", "custom_page#my-health-check", WikiRoot + "sonarr/custom_page#my-health-check")]
|
||||
public void should_format_wiki_url(string message, string wikiFragment, string expectedUrl)
|
||||
{
|
||||
var subject = new NzbDrone.Core.HealthCheck.HealthCheck(typeof(HealthCheckBase), HealthCheckResult.Warning, message, wikiFragment);
|
||||
var subject = new NzbDrone.Core.HealthCheck.HealthCheck(typeof(HealthCheckBase), HealthCheckResult.Warning, HealthCheckReason.ServerNotification, message, wikiFragment);
|
||||
|
||||
subject.WikiUrl.Should().Be(expectedUrl);
|
||||
}
|
||||
|
||||
@@ -29,7 +29,12 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||
{
|
||||
_logger.Warn("Please update your API key to be at least {0} characters long. You can do this via settings or the config file", MinimumLength);
|
||||
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Warning, _localizationService.GetLocalizedString("ApiKeyValidationHealthCheckMessage", new Dictionary<string, object> { { "length", MinimumLength } }), "#invalid-api-key");
|
||||
return new HealthCheck(GetType(),
|
||||
HealthCheckResult.Warning,
|
||||
HealthCheckReason.MinimumApiKeyLength,
|
||||
_localizationService.GetLocalizedString("ApiKeyValidationHealthCheckMessage",
|
||||
new Dictionary<string, object> { { "length", MinimumLength } }),
|
||||
"#invalid-api-key");
|
||||
}
|
||||
|
||||
return new HealthCheck(GetType());
|
||||
|
||||
@@ -19,7 +19,11 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||
if (_appFolderInfo.StartUpFolder.IsParentPath(_appFolderInfo.AppDataFolder) ||
|
||||
_appFolderInfo.StartUpFolder.PathEquals(_appFolderInfo.AppDataFolder))
|
||||
{
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Warning, _localizationService.GetLocalizedString("AppDataLocationHealthCheckMessage"), "#updating-will-not-be-possible-to-prevent-deleting-appdata-on-update");
|
||||
return new HealthCheck(GetType(),
|
||||
HealthCheckResult.Warning,
|
||||
HealthCheckReason.AppDataLocation,
|
||||
_localizationService.GetLocalizedString("AppDataLocationHealthCheckMessage"),
|
||||
"#updating-will-not-be-possible-to-prevent-deleting-appdata-on-update");
|
||||
}
|
||||
|
||||
return new HealthCheck(GetType());
|
||||
|
||||
@@ -30,7 +30,11 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||
|
||||
if (!downloadClients.Any())
|
||||
{
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Warning, _localizationService.GetLocalizedString("DownloadClientCheckNoneAvailableHealthCheckMessage"), "#no-download-client-is-available");
|
||||
return new HealthCheck(GetType(),
|
||||
HealthCheckResult.Warning,
|
||||
HealthCheckReason.DownloadClientCheckNoneAvailable,
|
||||
_localizationService.GetLocalizedString("DownloadClientCheckNoneAvailableHealthCheckMessage"),
|
||||
"#no-download-client-is-available");
|
||||
}
|
||||
|
||||
foreach (var downloadClient in downloadClients)
|
||||
@@ -45,6 +49,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||
|
||||
return new HealthCheck(GetType(),
|
||||
HealthCheckResult.Error,
|
||||
HealthCheckReason.DownloadClientCheckUnableToCommunicate,
|
||||
_localizationService.GetLocalizedString("DownloadClientCheckUnableToCommunicateWithHealthCheckMessage", new Dictionary<string, object>
|
||||
{
|
||||
{ "downloadClientName", downloadClient.Definition.Name },
|
||||
|
||||
@@ -45,6 +45,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||
{
|
||||
return new HealthCheck(GetType(),
|
||||
HealthCheckResult.Warning,
|
||||
HealthCheckReason.DownloadClientRemovesCompletedDownloads,
|
||||
_localizationService.GetLocalizedString("DownloadClientRemovesCompletedDownloadsHealthCheckMessage", new Dictionary<string, object>
|
||||
{
|
||||
{ "downloadClientName", clientName }
|
||||
|
||||
@@ -54,6 +54,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||
{
|
||||
return new HealthCheck(GetType(),
|
||||
HealthCheckResult.Warning,
|
||||
HealthCheckReason.DownloadClientRootFolder,
|
||||
_localizationService.GetLocalizedString("DownloadClientRootFolderHealthCheckMessage", new Dictionary<string, object>
|
||||
{
|
||||
{ "downloadClientName", client.Definition.Name },
|
||||
|
||||
@@ -46,6 +46,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||
{
|
||||
return new HealthCheck(GetType(),
|
||||
HealthCheckResult.Warning,
|
||||
HealthCheckReason.DownloadClientSorting,
|
||||
_localizationService.GetLocalizedString("DownloadClientSortingHealthCheckMessage", new Dictionary<string, object>
|
||||
{
|
||||
{ "downloadClientName", clientName },
|
||||
|
||||
@@ -40,12 +40,14 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||
{
|
||||
return new HealthCheck(GetType(),
|
||||
HealthCheckResult.Error,
|
||||
HealthCheckReason.DownloadClientStatusAllClients,
|
||||
_localizationService.GetLocalizedString("DownloadClientStatusAllClientHealthCheckMessage"),
|
||||
"#download-clients-are-unavailable-due-to-failures");
|
||||
}
|
||||
|
||||
return new HealthCheck(GetType(),
|
||||
HealthCheckResult.Warning,
|
||||
HealthCheckReason.DownloadClientStatusSingleClient,
|
||||
_localizationService.GetLocalizedString("DownloadClientStatusSingleClientHealthCheckMessage", new Dictionary<string, object>
|
||||
{
|
||||
{ "downloadClientNames", string.Join(", ", backOffProviders.Select(v => v.Provider.Definition.Name)) }
|
||||
|
||||
@@ -68,6 +68,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||
|
||||
return new HealthCheck(GetType(),
|
||||
HealthCheckResult.Error,
|
||||
HealthCheckReason.ImportListRootFolderMissing,
|
||||
_localizationService.GetLocalizedString("ImportListRootFolderMissingRootHealthCheckMessage", new Dictionary<string, object>
|
||||
{
|
||||
{ "rootFolderInfo", FormatRootFolder(missingRootFolder.Key, missingRootFolder.Value) }
|
||||
@@ -77,6 +78,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||
|
||||
return new HealthCheck(GetType(),
|
||||
HealthCheckResult.Error,
|
||||
HealthCheckReason.ImportListRootFolderMultipleMissing,
|
||||
_localizationService.GetLocalizedString("ImportListRootFolderMultipleMissingRootsHealthCheckMessage", new Dictionary<string, object>
|
||||
{
|
||||
{ "rootFoldersInfo", string.Join(" | ", missingRootFolders.Select(m => FormatRootFolder(m.Key, m.Value))) }
|
||||
|
||||
@@ -40,12 +40,14 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||
{
|
||||
return new HealthCheck(GetType(),
|
||||
HealthCheckResult.Error,
|
||||
HealthCheckReason.ImportListStatusAllUnavailable,
|
||||
_localizationService.GetLocalizedString("ImportListStatusAllUnavailableHealthCheckMessage"),
|
||||
"#import-lists-are-unavailable-due-to-failures");
|
||||
}
|
||||
|
||||
return new HealthCheck(GetType(),
|
||||
HealthCheckResult.Warning,
|
||||
HealthCheckReason.ImportListStatusUnavailable,
|
||||
_localizationService.GetLocalizedString("ImportListStatusUnavailableHealthCheckMessage", new Dictionary<string, object>
|
||||
{
|
||||
{ "importListNames", string.Join(", ", backOffProviders.Select(v => v.ImportList.Definition.Name)) }
|
||||
|
||||
@@ -53,6 +53,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||
{
|
||||
return new HealthCheck(GetType(),
|
||||
HealthCheckResult.Warning,
|
||||
HealthCheckReason.ImportMechanismEnableCompletedDownloadHandlingIfPossibleMultiComputer,
|
||||
_localizationService.GetLocalizedString("ImportMechanismEnableCompletedDownloadHandlingIfPossibleMultiComputerHealthCheckMessage"),
|
||||
"#completedfailed-download-handling");
|
||||
}
|
||||
@@ -61,6 +62,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||
{
|
||||
return new HealthCheck(GetType(),
|
||||
HealthCheckResult.Warning,
|
||||
HealthCheckReason.ImportMechanismEnableCompletedDownloadHandlingIfPossible,
|
||||
$"{_localizationService.GetLocalizedString("ImportMechanismEnableCompletedDownloadHandlingIfPossibleHealthCheckMessage")} (Sabnzbd)",
|
||||
"#completedfailed-download-handling");
|
||||
}
|
||||
@@ -69,12 +71,14 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||
{
|
||||
return new HealthCheck(GetType(),
|
||||
HealthCheckResult.Warning,
|
||||
HealthCheckReason.ImportMechanismEnableCompletedDownloadHandlingIfPossible,
|
||||
$"{_localizationService.GetLocalizedString("ImportMechanismEnableCompletedDownloadHandlingIfPossibleHealthCheckMessage")} (Nzbget)",
|
||||
"#completedfailed-download-handling");
|
||||
}
|
||||
|
||||
return new HealthCheck(GetType(),
|
||||
HealthCheckResult.Warning,
|
||||
HealthCheckReason.ImportMechanismEnableCompletedDownloadHandlingIfPossible,
|
||||
_localizationService.GetLocalizedString("ImportMechanismEnableCompletedDownloadHandlingIfPossibleHealthCheckMessage"),
|
||||
"#completedfailed-download-handling");
|
||||
}
|
||||
@@ -83,6 +87,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||
{
|
||||
return new HealthCheck(GetType(),
|
||||
HealthCheckResult.Warning,
|
||||
HealthCheckReason.ImportMechanismHandlingDisabled,
|
||||
_localizationService.GetLocalizedString("ImportMechanismHandlingDisabledHealthCheckMessage"),
|
||||
"#completed-download-handling-is-disabled");
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||
{
|
||||
return new HealthCheck(GetType(),
|
||||
HealthCheckResult.Warning,
|
||||
HealthCheckReason.IndexerDownloadClient,
|
||||
_localizationService.GetLocalizedString("IndexerDownloadClientHealthCheckMessage", new Dictionary<string, object>
|
||||
{
|
||||
{ "indexerNames", string.Join(", ", invalidIndexers.Select(v => v.Name).ToArray()) }
|
||||
|
||||
@@ -42,6 +42,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||
|
||||
return new HealthCheck(GetType(),
|
||||
HealthCheckResult.Warning,
|
||||
HealthCheckReason.IndexerJackettAll,
|
||||
_localizationService.GetLocalizedString("IndexerJackettAllHealthCheckMessage", new Dictionary<string, object>
|
||||
{
|
||||
{ "indexerNames", string.Join(", ", jackettAllProviders.Select(i => i.Name)) }
|
||||
|
||||
@@ -43,12 +43,14 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||
{
|
||||
return new HealthCheck(GetType(),
|
||||
HealthCheckResult.Error,
|
||||
HealthCheckReason.IndexerLongTermStatusAllUnavailable,
|
||||
_localizationService.GetLocalizedString("IndexerLongTermStatusAllUnavailableHealthCheckMessage"),
|
||||
"#indexers-are-unavailable-due-to-failures");
|
||||
}
|
||||
|
||||
return new HealthCheck(GetType(),
|
||||
HealthCheckResult.Warning,
|
||||
HealthCheckReason.IndexerLongTermStatusUnavailable,
|
||||
_localizationService.GetLocalizedString("IndexerLongTermStatusUnavailableHealthCheckMessage", new Dictionary<string, object>
|
||||
{
|
||||
{ "indexerNames", string.Join(", ", backOffProviders.Select(v => v.Provider.Definition.Name)) }
|
||||
|
||||
@@ -25,14 +25,22 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||
|
||||
if (enabled.Empty())
|
||||
{
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Error, _localizationService.GetLocalizedString("IndexerRssNoIndexersEnabledHealthCheckMessage"), "#no-indexers-available-with-rss-sync-enabled-sonarr-will-not-grab-new-releases-automatically");
|
||||
return new HealthCheck(GetType(),
|
||||
HealthCheckResult.Error,
|
||||
HealthCheckReason.IndexerRssNoIndexersEnabled,
|
||||
_localizationService.GetLocalizedString("IndexerRssNoIndexersEnabledHealthCheckMessage"),
|
||||
"#no-indexers-available-with-rss-sync-enabled-sonarr-will-not-grab-new-releases-automatically");
|
||||
}
|
||||
|
||||
var active = _indexerFactory.RssEnabled(true);
|
||||
|
||||
if (active.Empty())
|
||||
{
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Warning, _localizationService.GetLocalizedString("IndexerRssNoIndexersAvailableHealthCheckMessage"), "#indexers-are-unavailable-due-to-failures");
|
||||
return new HealthCheck(GetType(),
|
||||
HealthCheckResult.Warning,
|
||||
HealthCheckReason.IndexerRssNoIndexersAvailable,
|
||||
_localizationService.GetLocalizedString("IndexerRssNoIndexersAvailableHealthCheckMessage"),
|
||||
"#indexers-are-unavailable-due-to-failures");
|
||||
}
|
||||
|
||||
return new HealthCheck(GetType());
|
||||
|
||||
@@ -25,21 +25,33 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||
|
||||
if (automaticSearchEnabled.Empty())
|
||||
{
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Warning, _localizationService.GetLocalizedString("IndexerSearchNoAutomaticHealthCheckMessage"), "#no-indexers-available-with-automatic-search-enabled-sonarr-will-not-provide-any-automatic-search-results");
|
||||
return new HealthCheck(GetType(),
|
||||
HealthCheckResult.Warning,
|
||||
HealthCheckReason.IndexerSearchNoAutomatic,
|
||||
_localizationService.GetLocalizedString("IndexerSearchNoAutomaticHealthCheckMessage"),
|
||||
"#no-indexers-available-with-automatic-search-enabled-sonarr-will-not-provide-any-automatic-search-results");
|
||||
}
|
||||
|
||||
var interactiveSearchEnabled = _indexerFactory.InteractiveSearchEnabled(false);
|
||||
|
||||
if (interactiveSearchEnabled.Empty())
|
||||
{
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Warning, _localizationService.GetLocalizedString("IndexerSearchNoInteractiveHealthCheckMessage"), "#no-indexers-available-with-interactive-search-enabled");
|
||||
return new HealthCheck(GetType(),
|
||||
HealthCheckResult.Warning,
|
||||
HealthCheckReason.IndexerSearchNoInteractive,
|
||||
_localizationService.GetLocalizedString("IndexerSearchNoInteractiveHealthCheckMessage"),
|
||||
"#no-indexers-available-with-interactive-search-enabled");
|
||||
}
|
||||
|
||||
var active = _indexerFactory.AutomaticSearchEnabled(true);
|
||||
|
||||
if (active.Empty())
|
||||
{
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Warning, _localizationService.GetLocalizedString("IndexerSearchNoAvailableIndexersHealthCheckMessage"), "#indexers-are-unavailable-due-to-failures");
|
||||
return new HealthCheck(GetType(),
|
||||
HealthCheckResult.Warning,
|
||||
HealthCheckReason.IndexerSearchNoAvailableIndexers,
|
||||
_localizationService.GetLocalizedString("IndexerSearchNoAvailableIndexersHealthCheckMessage"),
|
||||
"#indexers-are-unavailable-due-to-failures");
|
||||
}
|
||||
|
||||
return new HealthCheck(GetType());
|
||||
|
||||
@@ -43,12 +43,14 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||
{
|
||||
return new HealthCheck(GetType(),
|
||||
HealthCheckResult.Error,
|
||||
HealthCheckReason.IndexerStatusAllUnavailable,
|
||||
_localizationService.GetLocalizedString("IndexerStatusAllUnavailableHealthCheckMessage"),
|
||||
"#indexers-are-unavailable-due-to-failures");
|
||||
}
|
||||
|
||||
return new HealthCheck(GetType(),
|
||||
HealthCheckResult.Warning,
|
||||
HealthCheckReason.IndexerStatusUnavailable,
|
||||
_localizationService.GetLocalizedString("IndexerStatusUnavailableHealthCheckMessage", new Dictionary<string, object>
|
||||
{
|
||||
{ "indexerNames", string.Join(", ", backOffProviders.Select(v => v.Provider.Definition.Name)) }
|
||||
|
||||
@@ -31,6 +31,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||
{
|
||||
return new HealthCheck(GetType(),
|
||||
HealthCheckResult.Error,
|
||||
HealthCheckReason.MountSeries,
|
||||
$"{_localizationService.GetLocalizedString("MountSeriesHealthCheckMessage")}{string.Join(", ", mounts.Select(m => $"{m.Item1.Name} ({m.Item2})"))}",
|
||||
"#series-mount-ro");
|
||||
}
|
||||
|
||||
@@ -40,12 +40,14 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||
{
|
||||
return new HealthCheck(GetType(),
|
||||
HealthCheckResult.Error,
|
||||
HealthCheckReason.NotificationStatusAll,
|
||||
_localizationService.GetLocalizedString("NotificationStatusAllClientHealthCheckMessage"),
|
||||
"#notifications-are-unavailable-due-to-failures");
|
||||
}
|
||||
|
||||
return new HealthCheck(GetType(),
|
||||
HealthCheckResult.Warning,
|
||||
HealthCheckReason.NotificationStatusSingle,
|
||||
_localizationService.GetLocalizedString("NotificationStatusSingleClientHealthCheckMessage", new Dictionary<string, object>
|
||||
{
|
||||
{ "notificationNames", string.Join(", ", backOffProviders.Select(v => v.Provider.Definition.Name)) }
|
||||
|
||||
@@ -35,7 +35,11 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||
result = HealthCheckResult.Warning;
|
||||
}
|
||||
|
||||
return new HealthCheck(GetType(), result, message, "#package-maintainer-message");
|
||||
return new HealthCheck(GetType(),
|
||||
result,
|
||||
HealthCheckReason.Package,
|
||||
message,
|
||||
"#package-maintainer-message");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||
{
|
||||
return new HealthCheck(GetType(),
|
||||
HealthCheckResult.Error,
|
||||
HealthCheckReason.ProxyResolveIp,
|
||||
_localizationService.GetLocalizedString("ProxyResolveIpHealthCheckMessage", new Dictionary<string, object>
|
||||
{
|
||||
{ "proxyHostName", _configService.ProxyHostname }
|
||||
@@ -65,6 +66,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||
|
||||
return new HealthCheck(GetType(),
|
||||
HealthCheckResult.Error,
|
||||
HealthCheckReason.ProxyBadRequest,
|
||||
_localizationService.GetLocalizedString("ProxyBadRequestHealthCheckMessage", new Dictionary<string, object>
|
||||
{
|
||||
{ "statusCode", response.StatusCode }
|
||||
@@ -78,6 +80,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||
|
||||
return new HealthCheck(GetType(),
|
||||
HealthCheckResult.Error,
|
||||
HealthCheckReason.ProxyFailed,
|
||||
_localizationService.GetLocalizedString("ProxyFailedToTestHealthCheckMessage", new Dictionary<string, object>
|
||||
{
|
||||
{ "url", request.Url }
|
||||
|
||||
@@ -34,6 +34,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||
{
|
||||
return new HealthCheck(GetType(),
|
||||
HealthCheckResult.Error,
|
||||
HealthCheckReason.RecycleBinUnableToWrite,
|
||||
_localizationService.GetLocalizedString("RecycleBinUnableToWriteHealthCheckMessage", new Dictionary<string, object>
|
||||
{
|
||||
{ "path", recycleBin }
|
||||
|
||||
@@ -72,6 +72,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||
return new HealthCheck(
|
||||
GetType(),
|
||||
HealthCheckResult.Error,
|
||||
HealthCheckReason.RemotePathMappingWrongOSPath,
|
||||
_localizationService.GetLocalizedString(
|
||||
"RemotePathMappingWrongOSPathHealthCheckMessage", new Dictionary<string, object>
|
||||
{
|
||||
@@ -87,6 +88,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||
return new HealthCheck(
|
||||
GetType(),
|
||||
HealthCheckResult.Error,
|
||||
HealthCheckReason.RemotePathMappingBadDockerPath,
|
||||
_localizationService.GetLocalizedString(
|
||||
"RemotePathMappingBadDockerPathHealthCheckMessage",
|
||||
new Dictionary<string, object>
|
||||
@@ -101,6 +103,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||
return new HealthCheck(
|
||||
GetType(),
|
||||
HealthCheckResult.Error,
|
||||
HealthCheckReason.RemotePathMappingLocalWrongOSPath,
|
||||
_localizationService.GetLocalizedString(
|
||||
"RemotePathMappingLocalWrongOSPathHealthCheckMessage",
|
||||
new Dictionary<string, object>
|
||||
@@ -119,6 +122,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||
return new HealthCheck(
|
||||
GetType(),
|
||||
HealthCheckResult.Error,
|
||||
HealthCheckReason.RemotePathMappingDockerFolderMissing,
|
||||
_localizationService.GetLocalizedString(
|
||||
"RemotePathMappingDockerFolderMissingHealthCheckMessage",
|
||||
new Dictionary<string, object>
|
||||
@@ -134,6 +138,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||
return new HealthCheck(
|
||||
GetType(),
|
||||
HealthCheckResult.Error,
|
||||
HealthCheckReason.RemotePathMappingLocalFolderMissing,
|
||||
_localizationService.GetLocalizedString(
|
||||
"RemotePathMappingLocalFolderMissingHealthCheckMessage",
|
||||
new Dictionary<string, object>
|
||||
@@ -147,6 +152,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||
return new HealthCheck(
|
||||
GetType(),
|
||||
HealthCheckResult.Error,
|
||||
HealthCheckReason.RemotePathMappingGenericPermissions,
|
||||
_localizationService.GetLocalizedString(
|
||||
"RemotePathMappingGenericPermissionsHealthCheckMessage",
|
||||
new Dictionary<string, object>
|
||||
@@ -194,6 +200,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||
{
|
||||
return new HealthCheck(GetType(),
|
||||
HealthCheckResult.Error,
|
||||
HealthCheckReason.RemotePathMappingDownloadPermissionsEpisode,
|
||||
_localizationService.GetLocalizedString(
|
||||
"RemotePathMappingDownloadPermissionsEpisodeHealthCheckMessage",
|
||||
new Dictionary<string, object>
|
||||
@@ -207,6 +214,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||
// ImportApprovedEpisodes and the file must have been removed part way through processing
|
||||
return new HealthCheck(GetType(),
|
||||
HealthCheckResult.Error,
|
||||
HealthCheckReason.RemotePathMappingFileRemoved,
|
||||
_localizationService.GetLocalizedString(
|
||||
"RemotePathMappingFileRemovedHealthCheckMessage",
|
||||
new Dictionary<string, object>
|
||||
@@ -238,6 +246,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||
return new HealthCheck(
|
||||
GetType(),
|
||||
HealthCheckResult.Error,
|
||||
HealthCheckReason.RemotePathMappingImportEpisodeFailed,
|
||||
_localizationService.GetLocalizedString("RemotePathMappingImportEpisodeFailedHealthCheckMessage"),
|
||||
"#remote-path-import-failed");
|
||||
}
|
||||
@@ -249,6 +258,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||
return new HealthCheck(
|
||||
GetType(),
|
||||
HealthCheckResult.Error,
|
||||
HealthCheckReason.RemotePathMappingFilesWrongOSPath,
|
||||
_localizationService.GetLocalizedString(
|
||||
"RemotePathMappingFilesWrongOSPathHealthCheckMessage",
|
||||
new Dictionary<string, object>
|
||||
@@ -265,6 +275,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||
return new HealthCheck(
|
||||
GetType(),
|
||||
HealthCheckResult.Error,
|
||||
HealthCheckReason.RemotePathMappingFilesBadDockerPath,
|
||||
_localizationService.GetLocalizedString(
|
||||
"RemotePathMappingFilesBadDockerPathHealthCheckMessage",
|
||||
new Dictionary<string, object>
|
||||
@@ -279,6 +290,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||
return new HealthCheck(
|
||||
GetType(),
|
||||
HealthCheckResult.Error,
|
||||
HealthCheckReason.RemotePathMappingFilesLocalWrongOSPath,
|
||||
_localizationService.GetLocalizedString(
|
||||
"RemotePathMappingFilesLocalWrongOSPathHealthCheckMessage",
|
||||
new Dictionary<string, object>
|
||||
@@ -295,6 +307,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||
return new HealthCheck(
|
||||
GetType(),
|
||||
HealthCheckResult.Error,
|
||||
HealthCheckReason.RemotePathMappingFolderPermissions,
|
||||
_localizationService.GetLocalizedString(
|
||||
"RemotePathMappingFolderPermissionsHealthCheckMessage",
|
||||
new Dictionary<string, object>
|
||||
@@ -310,6 +323,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||
return new HealthCheck(
|
||||
GetType(),
|
||||
HealthCheckResult.Error,
|
||||
HealthCheckReason.RemotePathMappingFolderPermissions,
|
||||
_localizationService.GetLocalizedString(
|
||||
"RemotePathMappingFolderPermissionsHealthCheckMessage",
|
||||
new Dictionary<string, object>
|
||||
@@ -325,6 +339,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||
return new HealthCheck(
|
||||
GetType(),
|
||||
HealthCheckResult.Error,
|
||||
HealthCheckReason.RemotePathMappingRemoteDownloadClient,
|
||||
_localizationService.GetLocalizedString(
|
||||
"RemotePathMappingRemoteDownloadClientHealthCheckMessage",
|
||||
new Dictionary<string, object>
|
||||
@@ -340,6 +355,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||
return new HealthCheck(
|
||||
GetType(),
|
||||
HealthCheckResult.Error,
|
||||
HealthCheckReason.RemotePathMappingFilesGenericPermissions,
|
||||
_localizationService.GetLocalizedString(
|
||||
"RemotePathMappingFilesGenericPermissionsHealthCheckMessage",
|
||||
new Dictionary<string, object>
|
||||
|
||||
@@ -35,6 +35,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||
{
|
||||
return new HealthCheck(GetType(),
|
||||
HealthCheckResult.Error,
|
||||
HealthCheckReason.RemovedSeriesSingle,
|
||||
_localizationService.GetLocalizedString("RemovedSeriesSingleRemovedHealthCheckMessage", new Dictionary<string, object>
|
||||
{
|
||||
{ "series", seriesText }
|
||||
@@ -44,6 +45,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||
|
||||
return new HealthCheck(GetType(),
|
||||
HealthCheckResult.Error,
|
||||
HealthCheckReason.RemovedSeriesMultiple,
|
||||
_localizationService.GetLocalizedString("RemovedSeriesMultipleRemovedHealthCheckMessage", new Dictionary<string, object>
|
||||
{
|
||||
{ "series", seriesText }
|
||||
|
||||
@@ -43,6 +43,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||
{
|
||||
return new HealthCheck(GetType(),
|
||||
HealthCheckResult.Error,
|
||||
HealthCheckReason.RootFolderMissing,
|
||||
_localizationService.GetLocalizedString(
|
||||
"RootFolderMissingHealthCheckMessage",
|
||||
new Dictionary<string, object>
|
||||
@@ -54,6 +55,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||
|
||||
return new HealthCheck(GetType(),
|
||||
HealthCheckResult.Error,
|
||||
HealthCheckReason.RootFolderMultipleMissing,
|
||||
_localizationService.GetLocalizedString(
|
||||
"RootFolderMultipleMissingHealthCheckMessage",
|
||||
new Dictionary<string, object>
|
||||
|
||||
@@ -37,7 +37,11 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||
if (Math.Abs(result.DateTimeUtc.Subtract(systemTime).TotalDays) >= 1)
|
||||
{
|
||||
_logger.Error("System time mismatch. SystemTime: {0} Expected Time: {1}. Update system time", systemTime, result.DateTimeUtc);
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Error, _localizationService.GetLocalizedString("SystemTimeHealthCheckMessage"), "#system-time-off");
|
||||
return new HealthCheck(GetType(),
|
||||
HealthCheckResult.Error,
|
||||
HealthCheckReason.SystemTime,
|
||||
_localizationService.GetLocalizedString("SystemTimeHealthCheckMessage"),
|
||||
"#system-time-off");
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
|
||||
@@ -48,6 +48,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||
{
|
||||
return new HealthCheck(GetType(),
|
||||
HealthCheckResult.Error,
|
||||
HealthCheckReason.UpdateStartupTranslocation,
|
||||
_localizationService.GetLocalizedString(
|
||||
"UpdateStartupTranslocationHealthCheckMessage",
|
||||
new Dictionary<string, object>
|
||||
@@ -61,6 +62,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||
{
|
||||
return new HealthCheck(GetType(),
|
||||
HealthCheckResult.Error,
|
||||
HealthCheckReason.UpdateStartupNotWritable,
|
||||
_localizationService.GetLocalizedString(
|
||||
"UpdateStartupNotWritableHealthCheckMessage",
|
||||
new Dictionary<string, object>
|
||||
@@ -75,6 +77,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||
{
|
||||
return new HealthCheck(GetType(),
|
||||
HealthCheckResult.Error,
|
||||
HealthCheckReason.UpdateUiNotWritable,
|
||||
_localizationService.GetLocalizedString(
|
||||
"UpdateUiNotWritableHealthCheckMessage",
|
||||
new Dictionary<string, object>
|
||||
@@ -94,6 +97,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||
{
|
||||
return new HealthCheck(GetType(),
|
||||
HealthCheckResult.Warning,
|
||||
HealthCheckReason.UpdateAvailable,
|
||||
_localizationService.GetLocalizedString("UpdateAvailableHealthCheckMessage", new Dictionary<string, object>
|
||||
{
|
||||
{ "version", $"v{latestAvailable.Version}" }
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace NzbDrone.Core.HealthCheck
|
||||
|
||||
public Type Source { get; set; }
|
||||
public HealthCheckResult Type { get; set; }
|
||||
public HealthCheckReason Reason { get; set; }
|
||||
public string Message { get; set; }
|
||||
public HttpUri WikiUrl { get; set; }
|
||||
|
||||
@@ -24,10 +25,11 @@ namespace NzbDrone.Core.HealthCheck
|
||||
Type = HealthCheckResult.Ok;
|
||||
}
|
||||
|
||||
public HealthCheck(Type source, HealthCheckResult type, string message, string wikiFragment = null)
|
||||
public HealthCheck(Type source, HealthCheckResult type, HealthCheckReason reason, string message, string wikiFragment = null)
|
||||
{
|
||||
Source = source;
|
||||
Type = type;
|
||||
Reason = reason;
|
||||
Message = message;
|
||||
WikiUrl = MakeWikiUrl(wikiFragment ?? MakeWikiFragment(message));
|
||||
}
|
||||
@@ -50,4 +52,68 @@ namespace NzbDrone.Core.HealthCheck
|
||||
Warning = 2,
|
||||
Error = 3
|
||||
}
|
||||
|
||||
public enum HealthCheckReason
|
||||
{
|
||||
AppDataLocation,
|
||||
DownloadClientCheckNoneAvailable,
|
||||
DownloadClientCheckUnableToCommunicate,
|
||||
DownloadClientRemovesCompletedDownloads,
|
||||
DownloadClientRootFolder,
|
||||
DownloadClientSorting,
|
||||
DownloadClientStatusAllClients,
|
||||
DownloadClientStatusSingleClient,
|
||||
ImportListRootFolderMissing,
|
||||
ImportListRootFolderMultipleMissing,
|
||||
ImportListStatusAllUnavailable,
|
||||
ImportListStatusUnavailable,
|
||||
ImportMechanismEnableCompletedDownloadHandlingIfPossible,
|
||||
ImportMechanismEnableCompletedDownloadHandlingIfPossibleMultiComputer,
|
||||
ImportMechanismHandlingDisabled,
|
||||
IndexerDownloadClient,
|
||||
IndexerJackettAll,
|
||||
IndexerLongTermStatusAllUnavailable,
|
||||
IndexerLongTermStatusUnavailable,
|
||||
IndexerRssNoIndexersAvailable,
|
||||
IndexerRssNoIndexersEnabled,
|
||||
IndexerSearchNoAutomatic,
|
||||
IndexerSearchNoAvailableIndexers,
|
||||
IndexerSearchNoInteractive,
|
||||
IndexerStatusAllUnavailable,
|
||||
IndexerStatusUnavailable,
|
||||
MinimumApiKeyLength,
|
||||
MountSeries,
|
||||
NotificationStatusAll,
|
||||
NotificationStatusSingle,
|
||||
Package,
|
||||
ProxyBadRequest,
|
||||
ProxyFailed,
|
||||
ProxyResolveIp,
|
||||
RecycleBinUnableToWrite,
|
||||
RemotePathMappingBadDockerPath,
|
||||
RemotePathMappingDockerFolderMissing,
|
||||
RemotePathMappingDownloadPermissionsEpisode,
|
||||
RemotePathMappingFileRemoved,
|
||||
RemotePathMappingFilesBadDockerPath,
|
||||
RemotePathMappingFilesGenericPermissions,
|
||||
RemotePathMappingFilesLocalWrongOSPath,
|
||||
RemotePathMappingFilesWrongOSPath,
|
||||
RemotePathMappingFolderPermissions,
|
||||
RemotePathMappingGenericPermissions,
|
||||
RemotePathMappingImportEpisodeFailed,
|
||||
RemotePathMappingLocalFolderMissing,
|
||||
RemotePathMappingLocalWrongOSPath,
|
||||
RemotePathMappingRemoteDownloadClient,
|
||||
RemotePathMappingWrongOSPath,
|
||||
RemovedSeriesMultiple,
|
||||
RemovedSeriesSingle,
|
||||
RootFolderMissing,
|
||||
RootFolderMultipleMissing,
|
||||
ServerNotification,
|
||||
SystemTime,
|
||||
UpdateAvailable,
|
||||
UpdateStartupNotWritable,
|
||||
UpdateStartupTranslocation,
|
||||
UpdateUiNotWritable
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,11 @@ namespace NzbDrone.Core.HealthCheck
|
||||
var response = _client.Execute(request);
|
||||
var result = Json.Deserialize<List<ServerNotificationResponse>>(response.Content);
|
||||
|
||||
var checks = result.Select(x => new HealthCheck(GetType(), x.Type, x.Message, x.WikiUrl)).ToList();
|
||||
var checks = result.Select(x => new HealthCheck(GetType(),
|
||||
x.Type,
|
||||
HealthCheckReason.ServerNotification,
|
||||
x.Message,
|
||||
x.WikiUrl)).ToList();
|
||||
|
||||
// Only one health check is supported, services returns an ordered list, so use the first one
|
||||
return checks.FirstOrDefault() ?? new HealthCheck(GetType());
|
||||
|
||||
Reference in New Issue
Block a user