This commit is contained in:
Charles Torre 2022-06-06 13:12:46 -07:00
Родитель 3654bb3929
Коммит 6cef5ebb5d
1 изменённых файлов: 6 добавлений и 5 удалений

Просмотреть файл

@ -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.