pacemaker/0001-Add-the-parameter-of-dampening-and-fix-attrd_updater.patch
liupei 64f9edfd09 Add the parameter of dampening and fix attrd_updater command
(cherry picked from commit 9b5ccbfd92b318e847002b54674cb2ec2f902eda)
2023-08-23 15:54:30 +08:00

63 lines
2.0 KiB
Diff

From 92d5801b36408c3e6af561ecb546df0641212b4a Mon Sep 17 00:00:00 2001
From: liupei <liupei@kylinos.cn>
Date: Wed, 23 Aug 2023 11:28:38 +0800
Subject: [PATCH] Add the parameter of dampening and fix attrd_updater command
---
agents/ocf/HealthCPU.in | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/agents/ocf/HealthCPU.in b/agents/ocf/HealthCPU.in
index 4a8e7c3..a852a7a 100644
--- a/agents/ocf/HealthCPU.in
+++ b/agents/ocf/HealthCPU.in
@@ -67,6 +67,15 @@ the #health-cpu will go red if the %idle of the CPU falls below 10%.
<content type="string" default="10"/>
</parameter>
+<parameter name="dampening" reloadable="1">
+<longdesc lang="en">
+The time to wait (dampening) in seconds for further changes before writing
+</longdesc>
+<shortdesc lang="en">The time to wait (dampening) in seconds for further changes
+before writing</shortdesc>
+<content type="string" default="30s"/>
+</parameter>
+
</parameters>
<actions>
@@ -117,16 +126,16 @@ healthcpu_monitor() {
if [ $IDLE -lt ${OCF_RESKEY_red_limit} ] ; then
# echo "System state RED!"
- attrd_updater -n "#health-cpu" -U "red" -d "30s"
+ attrd_updater -n "#health-cpu" -B "red" -d ${OCF_RESKEY_dampening}
return $OCF_SUCCESS
fi
if [ $IDLE -lt ${OCF_RESKEY_yellow_limit} ] ; then
# echo "System state yellow."
- attrd_updater -n "#health-cpu" -U "yellow" -d "30s"
+ attrd_updater -n "#health-cpu" -B "yellow" -d ${OCF_RESKEY_dampening}
else
# echo "System state green."
- attrd_updater -n "#health-cpu" -U "green" -d "30s"
+ attrd_updater -n "#health-cpu" -B "green" -d ${OCF_RESKEY_dampening}
fi
return $OCF_SUCCESS
@@ -188,6 +197,9 @@ fi
if [ -z "${OCF_RESKEY_yellow_limit}" ] ; then
OCF_RESKEY_yellow_limit=50
fi
+if [ -z "${OCF_RESKEY_dampening}" ]; then
+ OCF_RESKEY_dampening="30s"
+fi
case "$__OCF_ACTION" in
meta-data) meta_data
--
2.33.1.windows.1