Allow endpoint warnings during setup acceptance
This commit is contained in:
@@ -164,7 +164,14 @@ namespace BizTalkCheckmkPulse
|
||||
+ " catalogUtc=" + (validation.CatalogSynchronizedUtc.HasValue
|
||||
? validation.CatalogSynchronizedUtc.Value.ToString("o")
|
||||
: "disabled")
|
||||
+ " stableServices=" + validation.StableServiceCount);
|
||||
+ " stableServices=" + validation.StableServiceCount
|
||||
+ " acceptedUnknown=" + validation.AcceptedUnknownLines.Count);
|
||||
foreach (var line in validation.AcceptedUnknownLines)
|
||||
{
|
||||
Console.WriteLine(
|
||||
"RUNTIME_VALIDATION_WARNING: Installation technisch valide; Monitoringzustand bleibt sichtbar: "
|
||||
+ line);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,5 +6,5 @@ using System.Reflection;
|
||||
[assembly: AssemblyDescription("Privileged BizTalk data provider and validated Checkmk snapshot consumer")]
|
||||
[assembly: AssemblyCompany("BEW")]
|
||||
[assembly: AssemblyProduct("BizTalk Checkmk Pulse")]
|
||||
[assembly: AssemblyVersion("2.2.5.0")]
|
||||
[assembly: AssemblyFileVersion("2.2.5.0")]
|
||||
[assembly: AssemblyVersion("2.2.6.0")]
|
||||
[assembly: AssemblyFileVersion("2.2.6.0")]
|
||||
|
||||
@@ -43,12 +43,34 @@ namespace BizTalkCheckmkPulse
|
||||
}
|
||||
|
||||
string serviceError;
|
||||
string[] unknownServiceLines;
|
||||
var expectedServices = formatter.FormatSelfTest().Select(ExtractServiceName).ToArray();
|
||||
if (!ContainsExactStableContract(snapshot.Lines, expectedServices, out serviceError))
|
||||
if (!ContainsExactStableContract(
|
||||
snapshot.Lines,
|
||||
expectedServices,
|
||||
out unknownServiceLines,
|
||||
out serviceError))
|
||||
{
|
||||
return RuntimeValidationResult.Failed(serviceError);
|
||||
}
|
||||
|
||||
var acceptedEndpointUnknownName = options.ServiceName("Endpoint Reachability");
|
||||
var blockingUnknown = unknownServiceLines
|
||||
.Where(x => !options.ProbeEndpointConnectivity
|
||||
|| !string.Equals(
|
||||
ExtractServiceName(x),
|
||||
acceptedEndpointUnknownName,
|
||||
StringComparison.Ordinal))
|
||||
.Select(ExtractServiceName)
|
||||
.OrderBy(x => x, StringComparer.Ordinal)
|
||||
.ToArray();
|
||||
if (blockingUnknown.Length != 0)
|
||||
{
|
||||
return RuntimeValidationResult.Failed(
|
||||
"Snapshot enthaelt blockierende UNKNOWN-Zustaende in Kernservices. UNKNOWN=["
|
||||
+ string.Join(", ", blockingUnknown) + "].");
|
||||
}
|
||||
|
||||
DateTime? catalogUtc = null;
|
||||
if (options.ProbeEndpointConnectivity)
|
||||
{
|
||||
@@ -85,14 +107,17 @@ namespace BizTalkCheckmkPulse
|
||||
return RuntimeValidationResult.Success(
|
||||
snapshot.GeneratedUtc,
|
||||
catalogUtc,
|
||||
expectedServices.Length);
|
||||
expectedServices.Length,
|
||||
unknownServiceLines);
|
||||
}
|
||||
|
||||
internal static bool ContainsExactStableContract(
|
||||
IEnumerable<string> lines,
|
||||
IEnumerable<string> expectedServices,
|
||||
out string[] unknownServiceLines,
|
||||
out string error)
|
||||
{
|
||||
unknownServiceLines = new string[0];
|
||||
string[] actual;
|
||||
try
|
||||
{
|
||||
@@ -123,18 +148,11 @@ namespace BizTalkCheckmkPulse
|
||||
return false;
|
||||
}
|
||||
|
||||
var unknown = (lines ?? Enumerable.Empty<string>())
|
||||
unknownServiceLines = (lines ?? Enumerable.Empty<string>())
|
||||
.Where(x => x != null && x.StartsWith("3 ", StringComparison.Ordinal))
|
||||
.Select(ExtractServiceName)
|
||||
.Where(x => expected.Contains(x, StringComparer.Ordinal))
|
||||
.OrderBy(x => x, StringComparer.Ordinal)
|
||||
.Where(x => expected.Contains(ExtractServiceName(x), StringComparer.Ordinal))
|
||||
.OrderBy(ExtractServiceName, StringComparer.Ordinal)
|
||||
.ToArray();
|
||||
if (unknown.Length != 0)
|
||||
{
|
||||
error = "Snapshot enthaelt unzuverlaessige UNKNOWN-Zustaende in stabilen Services. UNKNOWN=["
|
||||
+ string.Join(", ", unknown) + "].";
|
||||
return false;
|
||||
}
|
||||
|
||||
error = string.Empty;
|
||||
return true;
|
||||
@@ -159,21 +177,31 @@ namespace BizTalkCheckmkPulse
|
||||
public DateTime GeneratedUtc { get; private set; }
|
||||
public DateTime? CatalogSynchronizedUtc { get; private set; }
|
||||
public int StableServiceCount { get; private set; }
|
||||
public IReadOnlyList<string> AcceptedUnknownLines { get; private set; }
|
||||
|
||||
public static RuntimeValidationResult Success(DateTime generatedUtc, DateTime? catalogUtc, int serviceCount)
|
||||
public static RuntimeValidationResult Success(
|
||||
DateTime generatedUtc,
|
||||
DateTime? catalogUtc,
|
||||
int serviceCount,
|
||||
IEnumerable<string> acceptedUnknownLines)
|
||||
{
|
||||
return new RuntimeValidationResult
|
||||
{
|
||||
IsSuccess = true,
|
||||
GeneratedUtc = generatedUtc,
|
||||
CatalogSynchronizedUtc = catalogUtc,
|
||||
StableServiceCount = serviceCount
|
||||
StableServiceCount = serviceCount,
|
||||
AcceptedUnknownLines = (acceptedUnknownLines ?? Enumerable.Empty<string>()).ToArray()
|
||||
};
|
||||
}
|
||||
|
||||
public static RuntimeValidationResult Failed(string error)
|
||||
{
|
||||
return new RuntimeValidationResult { Error = error };
|
||||
return new RuntimeValidationResult
|
||||
{
|
||||
Error = error,
|
||||
AcceptedUnknownLines = new string[0]
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user