From 6cef5ebb5df7d9aaed84442dce8db7d7e77a6781 Mon Sep 17 00:00:00 2001 From: Charles Torre Date: Mon, 6 Jun 2022 13:12:46 -0700 Subject: [PATCH] Updated app rules. --- .../PackageRoot/Config/LogicRules/AppRules.guan | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/FabricHealer/PackageRoot/Config/LogicRules/AppRules.guan b/FabricHealer/PackageRoot/Config/LogicRules/AppRules.guan index bd8988b..beae936 100644 --- a/FabricHealer/PackageRoot/Config/LogicRules/AppRules.guan +++ b/FabricHealer/PackageRoot/Config/LogicRules/AppRules.guan @@ -58,12 +58,12 @@ ## *Note*: you must wrap the date string in quotes to make it explicit to Guan that the arg is a string as it contains mathematical operators (in this case a /). ## The rule below reads: If any of the specified (set in Mitigate) app's service processes have put it into Warning due to CPU over-consumption and today's date is later than the supplied end date, emit a message, stop processing rules (!). -Mitigate(AppName="fabric:/CpuStress", MetricName="CpuPercent") :- time() > DateTime("03/30/2022"), - EmitMessage("Exceeded specified end date for repair of fabric:/MyApp CpuPercent usage violations. Target end date: {0}. Current date (Utc): {1}", DateTime("11/30/2021"), time()), !. +Mitigate(AppName="fabric:/CpuStress", MetricName="CpuPercent") :- time() > DateTime("12/30/2022"), + EmitMessage("Exceeded specified end date for repair of fabric:/MyApp CpuPercent usage violations. Target end date: {0}. Current date (Utc): {1}", DateTime("12/30/2022"), time()), !. ## Alternatively, you could enforce repair end dates inline (as a subgoal) to any rule, e.g., -Mitigate(AppName="fabric:/PortEater42", MetricName="EphemeralPorts", MetricValue=?MetricValue) :- time() < DateTime("03/30/2022"), +Mitigate(AppName="fabric:/PortEater42", MetricName="EphemeralPorts", MetricValue=?MetricValue) :- time() < DateTime("12/30/2022"), ?MetricValue >= 8500, TimeScopedRestartCodePackage(4, 01:00:00). @@ -134,8 +134,9 @@ Mitigate(MetricName="MemoryMB", MetricValue=?MetricValue) :- ?MetricValue >= 102 Mitigate(MetricName="ActiveTcpPorts") :- TimeScopedRestartCodePackage(5, 05:00:00). ## Local Ports in Dynamic Range (aka Ephemeral Ports) -## Percentage in use or Total Ephemeral ports - Any app service. 5 repairs within 5 hour window. This means if FO warns on Ephemeral ports usage, then heal. -Mitigate(MetricName=?MetricName) :- match(?MetricName, "EphemeralPorts"), TimeScopedRestartCodePackage(5, 05:00:00). +## Percentage in use or Total Ephemeral ports - Any app service. 5 repairs within 5 hour window. This means if FO or FHProxy supplies repair facts related to Ephemeral ports, +## then restart the offending service by simulating process failure (RestartCodePackage). This will free all TCP ports held by the process. +Mitigate(MetricName="EphemeralPorts") :- TimeScopedRestartCodePackage(15, 05:00:00). ## Total Ephemeral Ports - Specific Application: any of its services, constrained on number of local ephemeral ports open. ## 5 repairs within 5 hour window.