Expand BizTalk operational metrics
This commit is contained in:
@@ -23,6 +23,11 @@ namespace BizTalkCheckmkPulse.Tests
|
||||
Run("ProviderSqlLoginFailureIsPermission", ProviderSqlLoginFailureIsPermission);
|
||||
Run("RejectedSqlPrincipalIsExtracted", RejectedSqlPrincipalIsExtracted);
|
||||
Run("PlatformPermissionPropagatesToSqlDiscovery", PlatformPermissionPropagatesToSqlDiscovery);
|
||||
Run("RoutingFailureReportsAreCounted", RoutingFailureReportsAreCounted);
|
||||
Run("ReceiveLocationAllowlistSeparatesExpectedState", ReceiveLocationAllowlistSeparatesExpectedState);
|
||||
Run("UnknownReceiveLocationStateIsNotGreen", UnknownReceiveLocationStateIsNotGreen);
|
||||
Run("SendPortAllowlistSeparatesExpectedState", SendPortAllowlistSeparatesExpectedState);
|
||||
Run("ArtifactSummaryIsBounded", ArtifactSummaryIsBounded);
|
||||
Run("SnapshotRoundTripPreservesLines", SnapshotRoundTripPreservesLines);
|
||||
Run("SnapshotRejectsTampering", SnapshotRejectsTampering);
|
||||
Run("SnapshotRejectsStaleData", SnapshotRejectsStaleData);
|
||||
@@ -47,16 +52,19 @@ namespace BizTalkCheckmkPulse.Tests
|
||||
private static void SelfTestEmitsAllStableServices()
|
||||
{
|
||||
var lines = new CheckmkLocalFormatter(new MonitoringOptions()).FormatSelfTest().ToArray();
|
||||
AssertEqual(6, lines.Length, "self-test line count");
|
||||
AssertEqual(6, lines.Distinct(StringComparer.Ordinal).Count(), "unique self-test lines");
|
||||
AssertEqual(8, lines.Length, "self-test line count");
|
||||
AssertEqual(8, lines.Distinct(StringComparer.Ordinal).Count(), "unique self-test lines");
|
||||
Assert(lines.All(x => x.StartsWith("0 \"BizTalk ", StringComparison.Ordinal)), "every self-test line must be OK");
|
||||
Assert(lines.Any(x => x.Contains("\"BizTalk Event Log\"")), "Event Log service missing");
|
||||
Assert(lines.Any(x => x.Contains("\"BizTalk Receive Locations\"")), "Receive Locations service missing");
|
||||
Assert(lines.Any(x => x.Contains("\"BizTalk Send Ports\"")), "Send Ports service missing");
|
||||
Assert(lines.Any(x => x.Contains("\"BizTalk Orchestrations\"")), "Orchestrations service missing");
|
||||
}
|
||||
|
||||
private static void UnavailableSourcesAreUnknown()
|
||||
{
|
||||
var lines = new CheckmkLocalFormatter(new MonitoringOptions()).Format(new ProbeResult()).Take(6).ToArray();
|
||||
AssertEqual(6, lines.Length, "stable service count");
|
||||
var lines = new CheckmkLocalFormatter(new MonitoringOptions()).Format(new ProbeResult()).Take(8).ToArray();
|
||||
AssertEqual(8, lines.Length, "stable service count");
|
||||
Assert(lines.All(x => x.StartsWith("3 \"BizTalk ", StringComparison.Ordinal)), "unavailable sources must be UNKNOWN");
|
||||
}
|
||||
|
||||
@@ -65,7 +73,7 @@ namespace BizTalkCheckmkPulse.Tests
|
||||
var options = new MonitoringOptions { EmitPerApplicationSuspensionServices = true };
|
||||
var result = CreateSuspensionResult("(unknown)");
|
||||
var lines = new CheckmkLocalFormatter(options).Format(result).ToArray();
|
||||
AssertEqual(6, lines.Length, "unknown application must not create a dynamic service");
|
||||
AssertEqual(8, lines.Length, "unknown application must not create a dynamic service");
|
||||
}
|
||||
|
||||
private static void KnownApplicationCreatesService()
|
||||
@@ -73,7 +81,7 @@ namespace BizTalkCheckmkPulse.Tests
|
||||
var options = new MonitoringOptions { EmitPerApplicationSuspensionServices = true };
|
||||
var result = CreateSuspensionResult("Orders");
|
||||
var lines = new CheckmkLocalFormatter(options).Format(result).ToArray();
|
||||
AssertEqual(7, lines.Length, "known application should create one dynamic service");
|
||||
AssertEqual(9, lines.Length, "known application should create one dynamic service");
|
||||
Assert(lines.Any(x => x.Contains("\"BizTalk Suspended Orders\"")), "known application service missing");
|
||||
}
|
||||
|
||||
@@ -93,6 +101,7 @@ namespace BizTalkCheckmkPulse.Tests
|
||||
Assert(query.Contains("SubscriptionDBServerName"), "master MessageBox server property missing");
|
||||
Assert(query.Contains("SubscriptionDBName"), "master MessageBox database property missing");
|
||||
Assert(query.IndexOf("MessageBoxSetting", StringComparison.OrdinalIgnoreCase) < 0, "unsupported MessageBoxSetting class present");
|
||||
Assert(WmiBizTalkProbe.SuspendedInstancesQuery.Contains("ServiceClass = 64"), "routing failure report filter missing");
|
||||
}
|
||||
|
||||
private static void ProviderSqlLoginFailureIsPermission()
|
||||
@@ -137,6 +146,167 @@ namespace BizTalkCheckmkPulse.Tests
|
||||
"SQL discovery classification");
|
||||
}
|
||||
|
||||
private static void RoutingFailureReportsAreCounted()
|
||||
{
|
||||
var result = new ProbeResult();
|
||||
result.Platform.SuspendedInstancesDataAvailable = true;
|
||||
result.SuspendedInstances.Add(new SuspendedInstance
|
||||
{
|
||||
ApplicationName = "(unknown)",
|
||||
ServiceName = string.Empty,
|
||||
ServiceClassId = 64,
|
||||
Kind = SuspendedKind.NonResumable
|
||||
});
|
||||
result.SuspendedInstances.Add(new SuspendedInstance
|
||||
{
|
||||
ApplicationName = "Orders",
|
||||
ServiceName = "Receive.Order",
|
||||
Kind = SuspendedKind.Resumable
|
||||
});
|
||||
|
||||
var line = FindServiceLine(result, "Suspended Instances");
|
||||
Assert(line.StartsWith("2 \"BizTalk Suspended Instances\"", StringComparison.Ordinal), "routing failure must be CRIT");
|
||||
Assert(line.Contains("biztalk_suspended_total=2"), "suspended total metric missing");
|
||||
Assert(line.Contains("biztalk_suspended_nonresumable=1"), "non-resumable metric missing");
|
||||
Assert(line.Contains("biztalk_routing_failure_reports=1"), "routing failure metric missing");
|
||||
Assert(line.Contains("routing_failure_reports=1"), "routing failure summary missing");
|
||||
}
|
||||
|
||||
private static void ReceiveLocationAllowlistSeparatesExpectedState()
|
||||
{
|
||||
var options = new MonitoringOptions
|
||||
{
|
||||
ExpectedDisabledReceiveLocations = new[] { "Maintenance\\RL Expected" }
|
||||
};
|
||||
var result = new ProbeResult();
|
||||
result.Platform.ReceiveLocationsDataAvailable = true;
|
||||
result.ReceiveLocations.Add(new ReceiveLocationState
|
||||
{
|
||||
ApplicationName = "Maintenance",
|
||||
Name = "RL Expected",
|
||||
IsDisabled = true
|
||||
});
|
||||
result.ReceiveLocations.Add(new ReceiveLocationState
|
||||
{
|
||||
ApplicationName = "Orders",
|
||||
Name = "RL Orders",
|
||||
IsDisabled = true
|
||||
});
|
||||
result.ReceiveLocations.Add(new ReceiveLocationState
|
||||
{
|
||||
ApplicationName = "Orders",
|
||||
Name = "RL Active",
|
||||
IsDisabled = false
|
||||
});
|
||||
|
||||
var line = FindServiceLine(result, "Receive Locations", options);
|
||||
Assert(line.StartsWith("2 \"BizTalk Receive Locations\"", StringComparison.Ordinal), "unexpected disabled receive location must be CRIT");
|
||||
Assert(line.Contains("biztalk_receive_locations_enabled=1"), "enabled receive metric missing");
|
||||
Assert(line.Contains("biztalk_receive_locations_unexpected_disabled=1"), "unexpected disabled metric missing");
|
||||
Assert(line.Contains("biztalk_receive_locations_expected_disabled=1"), "expected disabled metric missing");
|
||||
Assert(line.Contains(@"Orders\RL Orders"), "affected receive location missing");
|
||||
Assert(line.IndexOf("RL Expected", StringComparison.Ordinal) < 0, "expected disabled receive location should not clutter affected list");
|
||||
|
||||
options.ExpectedDisabledReceiveLocations = new[] { "Maintenance\\RL Expected", "RL Orders" };
|
||||
var allExpected = FindServiceLine(result, "Receive Locations", options);
|
||||
Assert(allExpected.StartsWith("0 \"BizTalk Receive Locations\"", StringComparison.Ordinal), "all expected disabled receive locations should be OK");
|
||||
Assert(allExpected.Contains("biztalk_receive_locations_expected_disabled=2"), "all expected receive count missing");
|
||||
}
|
||||
|
||||
private static void SendPortAllowlistSeparatesExpectedState()
|
||||
{
|
||||
var options = new MonitoringOptions
|
||||
{
|
||||
ExpectedInactiveSendPorts = new[] { "Maintenance\\SP Expected" }
|
||||
};
|
||||
var result = new ProbeResult();
|
||||
result.Platform.SendPortsDataAvailable = true;
|
||||
result.SendPorts.Add(new SendPortState
|
||||
{
|
||||
ApplicationName = "Maintenance",
|
||||
Name = "SP Expected",
|
||||
Status = 2
|
||||
});
|
||||
result.SendPorts.Add(new SendPortState
|
||||
{
|
||||
ApplicationName = "Orders",
|
||||
Name = "SP Orders",
|
||||
Status = 1
|
||||
});
|
||||
result.SendPorts.Add(new SendPortState
|
||||
{
|
||||
ApplicationName = "Orders",
|
||||
Name = "SP Active",
|
||||
Status = 3
|
||||
});
|
||||
|
||||
var line = FindServiceLine(result, "Send Ports", options);
|
||||
Assert(line.StartsWith("2 \"BizTalk Send Ports\"", StringComparison.Ordinal), "unexpected inactive send port must be CRIT");
|
||||
Assert(line.Contains("biztalk_send_ports_started=1"), "started send port metric missing");
|
||||
Assert(line.Contains("biztalk_send_ports_unexpected_inactive=1"), "unexpected inactive send metric missing");
|
||||
Assert(line.Contains("biztalk_send_ports_expected_inactive=1"), "expected inactive send metric missing");
|
||||
Assert(line.Contains(@"Orders\SP Orders(bound)"), "affected send port missing");
|
||||
Assert(line.IndexOf("SP Expected", StringComparison.Ordinal) < 0, "expected inactive send port should not clutter affected list");
|
||||
|
||||
options.ExpectedInactiveSendPorts = new[] { "Maintenance\\SP Expected", "SP Orders" };
|
||||
var allExpected = FindServiceLine(result, "Send Ports", options);
|
||||
Assert(allExpected.StartsWith("0 \"BizTalk Send Ports\"", StringComparison.Ordinal), "all expected inactive send ports should be OK");
|
||||
Assert(allExpected.Contains("biztalk_send_ports_expected_inactive=2"), "all expected send count missing");
|
||||
}
|
||||
|
||||
private static void UnknownReceiveLocationStateIsNotGreen()
|
||||
{
|
||||
var result = new ProbeResult();
|
||||
result.Platform.ReceiveLocationsDataAvailable = true;
|
||||
result.ReceiveLocations.Add(new ReceiveLocationState
|
||||
{
|
||||
ApplicationName = "Orders",
|
||||
Name = "RL Missing State",
|
||||
IsDisabled = null
|
||||
});
|
||||
|
||||
var line = FindServiceLine(result, "Receive Locations");
|
||||
Assert(line.StartsWith("3 \"BizTalk Receive Locations\"", StringComparison.Ordinal), "unknown receive state must be UNKNOWN");
|
||||
Assert(line.Contains("biztalk_receive_locations_unknown=1"), "unknown receive metric missing");
|
||||
Assert(line.Contains(@"Orders\RL Missing State"), "unknown receive location must be visible");
|
||||
}
|
||||
|
||||
private static void ArtifactSummaryIsBounded()
|
||||
{
|
||||
var options = new MonitoringOptions
|
||||
{
|
||||
MaxSummaryItems = 2,
|
||||
MaxDetailCharacters = 256
|
||||
};
|
||||
var result = new ProbeResult();
|
||||
result.Platform.ReceiveLocationsDataAvailable = true;
|
||||
for (var i = 1; i <= 6; i++)
|
||||
{
|
||||
result.ReceiveLocations.Add(new ReceiveLocationState
|
||||
{
|
||||
ApplicationName = "Application",
|
||||
Name = "Disabled-" + i,
|
||||
IsDisabled = true
|
||||
});
|
||||
}
|
||||
|
||||
var line = FindServiceLine(result, "Receive Locations", options);
|
||||
Assert(line.Contains("(+4 more)"), "omitted item count missing");
|
||||
Assert(line.Length < 700, "local check line should remain compact");
|
||||
|
||||
var longResult = new ProbeResult();
|
||||
longResult.Platform.ReceiveLocationsDataAvailable = true;
|
||||
longResult.ReceiveLocations.Add(new ReceiveLocationState
|
||||
{
|
||||
ApplicationName = new string('A', 400),
|
||||
Name = new string('R', 400),
|
||||
IsDisabled = true
|
||||
});
|
||||
var truncated = FindServiceLine(longResult, "Receive Locations", options);
|
||||
Assert(truncated.Contains("[truncated]"), "detail character limit should be visible");
|
||||
Assert(truncated.Length < 700, "truncated local check line should remain bounded");
|
||||
}
|
||||
|
||||
private static void SnapshotRoundTripPreservesLines()
|
||||
{
|
||||
WithTemporarySnapshot((path, store) =>
|
||||
@@ -222,7 +392,7 @@ namespace BizTalkCheckmkPulse.Tests
|
||||
var lines = new CheckmkLocalFormatter(new MonitoringOptions())
|
||||
.FormatSnapshotFailure("Snapshot file does not exist.")
|
||||
.ToArray();
|
||||
AssertEqual(6, lines.Length, "snapshot failure stable service count");
|
||||
AssertEqual(8, lines.Length, "snapshot failure stable service count");
|
||||
Assert(lines.All(x => x.StartsWith("3 \"BizTalk ", StringComparison.Ordinal)), "snapshot failure must be UNKNOWN");
|
||||
Assert(lines.All(x => x.Contains("Scheduled Task")), "snapshot failure must contain provider action");
|
||||
}
|
||||
@@ -258,6 +428,18 @@ namespace BizTalkCheckmkPulse.Tests
|
||||
return result;
|
||||
}
|
||||
|
||||
private static string FindServiceLine(
|
||||
ProbeResult result,
|
||||
string serviceSuffix,
|
||||
MonitoringOptions options = null)
|
||||
{
|
||||
var effectiveOptions = options ?? new MonitoringOptions();
|
||||
var token = "\"" + effectiveOptions.ServiceName(serviceSuffix) + "\"";
|
||||
return new CheckmkLocalFormatter(effectiveOptions)
|
||||
.Format(result)
|
||||
.Single(x => x.Contains(token));
|
||||
}
|
||||
|
||||
private static void Run(string name, Action test)
|
||||
{
|
||||
ExecutedTests++;
|
||||
|
||||
Reference in New Issue
Block a user