!58 Modify HealthCPU HealthIOWait HealthSmart about dampen, reload, and validate
From: @twtlpl Reviewed-by: @jxy_git Signed-off-by: @jxy_git
This commit is contained in:
commit
40e2dc2560
@ -0,0 +1,158 @@
|
|||||||
|
From 0a5fb8acb9eca15d4ea237b21da533f45821c099 Mon Sep 17 00:00:00 2001
|
||||||
|
From: rpm-build <rpm-build>
|
||||||
|
Date: Thu, 7 Dec 2023 06:54:56 +0800
|
||||||
|
Subject: [PATCH] Modify HealthCPU HealthIOWait HealthSmart about dampen,
|
||||||
|
reload, and validate simultaneously
|
||||||
|
|
||||||
|
---
|
||||||
|
agents/ocf/HealthCPU.in | 13 +++++--------
|
||||||
|
agents/ocf/HealthIOWait.in | 19 +++++++++++--------
|
||||||
|
agents/ocf/HealthSMART.in | 2 +-
|
||||||
|
3 files changed, 17 insertions(+), 17 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/agents/ocf/HealthCPU.in b/agents/ocf/HealthCPU.in
|
||||||
|
index 4bd6e36..6e9745d 100755
|
||||||
|
--- a/agents/ocf/HealthCPU.in
|
||||||
|
+++ b/agents/ocf/HealthCPU.in
|
||||||
|
@@ -26,6 +26,7 @@
|
||||||
|
: ${OCF_FUNCTIONS:="${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs"}
|
||||||
|
. "${OCF_FUNCTIONS}"
|
||||||
|
: ${__OCF_ACTION:="$1"}
|
||||||
|
+: ${OCF_RESKEY_dampen:="30s"}
|
||||||
|
|
||||||
|
#######################################################################
|
||||||
|
|
||||||
|
@@ -126,16 +127,16 @@ healthcpu_monitor() {
|
||||||
|
|
||||||
|
if [ $IDLE -lt ${OCF_RESKEY_red_limit} ] ; then
|
||||||
|
# echo "System state RED!"
|
||||||
|
- attrd_updater -n "#health-cpu" -B "red" -d ${OCF_RESKEY_dampening}
|
||||||
|
+ 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" -B "yellow" -d ${OCF_RESKEY_dampening}
|
||||||
|
+ attrd_updater -n "#health-cpu" -B "yellow" -d "${OCF_RESKEY_dampening}"
|
||||||
|
else
|
||||||
|
# echo "System state green."
|
||||||
|
- attrd_updater -n "#health-cpu" -B "green" -d ${OCF_RESKEY_dampening}
|
||||||
|
+ attrd_updater -n "#health-cpu" -B "green" -d "${OCF_RESKEY_dampening}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
return $OCF_SUCCESS
|
||||||
|
@@ -145,8 +146,7 @@ healthcpu_monitor() {
|
||||||
|
}
|
||||||
|
|
||||||
|
healthcpu_reload_agent() {
|
||||||
|
- # No action required
|
||||||
|
- :;
|
||||||
|
+ return $OCF_SUCCESS
|
||||||
|
}
|
||||||
|
|
||||||
|
healthcpu_validate() {
|
||||||
|
@@ -197,9 +197,6 @@ 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
|
||||||
|
diff --git a/agents/ocf/HealthIOWait.in b/agents/ocf/HealthIOWait.in
|
||||||
|
index 61b6de3..65ce901 100755
|
||||||
|
--- a/agents/ocf/HealthIOWait.in
|
||||||
|
+++ b/agents/ocf/HealthIOWait.in
|
||||||
|
@@ -19,6 +19,7 @@
|
||||||
|
: ${OCF_FUNCTIONS:="${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs"}
|
||||||
|
. "${OCF_FUNCTIONS}"
|
||||||
|
: ${__OCF_ACTION:="$1"}
|
||||||
|
+: ${OCF_RESKEY_dampening:="5s"}
|
||||||
|
|
||||||
|
#######################################################################
|
||||||
|
|
||||||
|
@@ -75,6 +76,7 @@ before writing</shortdesc>
|
||||||
|
<action name="start" timeout="10s" />
|
||||||
|
<action name="stop" timeout="10s" />
|
||||||
|
<action name="monitor" timeout="10s" interval="10s" start-delay="0s" />
|
||||||
|
+<action name="reload-agent" timeout="20s" />
|
||||||
|
<action name="meta-data" timeout="5s" />
|
||||||
|
<action name="validate-all" timeout="10s" depth="0" />
|
||||||
|
</actions>
|
||||||
|
@@ -86,7 +88,7 @@ END
|
||||||
|
|
||||||
|
agent_usage() {
|
||||||
|
cat <<END
|
||||||
|
-usage: $0 {start|stop|monitor|validate-all|meta-data}
|
||||||
|
+usage: $0 {start|stop|monitor|reload-agent|validate-all|meta-data}
|
||||||
|
|
||||||
|
Expects to have a fully populated OCF RA-compliant environment set.
|
||||||
|
END
|
||||||
|
@@ -118,22 +120,26 @@ agent_monitor() {
|
||||||
|
# echo $OCF_RESKEY_yellow_limit
|
||||||
|
if [ $WAIT -gt ${OCF_RESKEY_red_limit} ] ; then
|
||||||
|
# echo "System state RED!"
|
||||||
|
- attrd_updater -n "#health-iowait" -B "red" -d ${OCF_RESKEY_dampening}
|
||||||
|
+ attrd_updater -n "#health-iowait" -B "red" -d "${OCF_RESKEY_dampening}"
|
||||||
|
return $OCF_SUCCESS
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $WAIT -gt ${OCF_RESKEY_yellow_limit} ] ; then
|
||||||
|
# echo "System state yellow."
|
||||||
|
- attrd_updater -n "#health-iowait" -B "yellow" -d ${OCF_RESKEY_dampening}
|
||||||
|
+ attrd_updater -n "#health-iowait" -B "yellow" -d "${OCF_RESKEY_dampening}"
|
||||||
|
else
|
||||||
|
# echo "System state green."
|
||||||
|
- attrd_updater -n "#health-iowait" -B "green" -d ${OCF_RESKEY_dampening}
|
||||||
|
+ attrd_updater -n "#health-iowait" -B "green" -d "${OCF_RESKEY_dampening}"
|
||||||
|
fi
|
||||||
|
return $OCF_SUCCESS
|
||||||
|
fi
|
||||||
|
return $OCF_NOT_RUNNING
|
||||||
|
}
|
||||||
|
|
||||||
|
+agent_reload_agent() {
|
||||||
|
+ return $OCF_SUCCESS
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
is_integer() {
|
||||||
|
case "$1" in
|
||||||
|
""|*[0-9]*) return 0 ;;
|
||||||
|
@@ -184,10 +190,6 @@ if [ -z "${OCF_RESKEY_yellow_limit}" ] ; then
|
||||||
|
OCF_RESKEY_yellow_limit=10
|
||||||
|
fi
|
||||||
|
|
||||||
|
-if [ -z "${OCF_RESKEY_dampening}" ]; then
|
||||||
|
- OCF_RESKEY_dampening="5s"
|
||||||
|
-fi
|
||||||
|
-
|
||||||
|
case $__OCF_ACTION in
|
||||||
|
meta-data) meta_data
|
||||||
|
exit $OCF_SUCCESS
|
||||||
|
@@ -195,6 +197,7 @@ meta-data) meta_data
|
||||||
|
start) agent_start;;
|
||||||
|
stop) agent_stop;;
|
||||||
|
monitor) agent_validate && agent_monitor;;
|
||||||
|
+reload-agent) agent_reload_agent;;
|
||||||
|
validate-all) agent_validate;;
|
||||||
|
usage|help) agent_usage
|
||||||
|
exit $OCF_SUCCESS
|
||||||
|
diff --git a/agents/ocf/HealthSMART.in b/agents/ocf/HealthSMART.in
|
||||||
|
index 3b15339..0cafa46 100755
|
||||||
|
--- a/agents/ocf/HealthSMART.in
|
||||||
|
+++ b/agents/ocf/HealthSMART.in
|
||||||
|
@@ -351,7 +351,7 @@ fi
|
||||||
|
case "$__OCF_ACTION" in
|
||||||
|
start) HealthSMART_start;;
|
||||||
|
stop) HealthSMART_stop;;
|
||||||
|
- monitor) HealthSMART_monitor;;
|
||||||
|
+ monitor) HealthSMART_validate && HealthSMART_monitor;;
|
||||||
|
validate-all) HealthSMART_validate;;
|
||||||
|
reload-agent) HealthSMART_reload_agent;;
|
||||||
|
meta-data)
|
||||||
|
--
|
||||||
|
2.27.0
|
||||||
|
|
||||||
@ -17,7 +17,7 @@
|
|||||||
## can be incremented to build packages reliably considered "newer"
|
## can be incremented to build packages reliably considered "newer"
|
||||||
## than previously built packages with the same pcmkversion)
|
## than previously built packages with the same pcmkversion)
|
||||||
%global pcmkversion 2.1.6
|
%global pcmkversion 2.1.6
|
||||||
%global specversion 11
|
%global specversion 12
|
||||||
|
|
||||||
## Upstream commit (full commit ID, abbreviated commit ID, or tag) to build
|
## Upstream commit (full commit ID, abbreviated commit ID, or tag) to build
|
||||||
%global commit 6fdc9deea294bbad629b003c6ae036aaed8e3ee0
|
%global commit 6fdc9deea294bbad629b003c6ae036aaed8e3ee0
|
||||||
@ -161,6 +161,7 @@ Patch6: Fix-a-bug-in-clone-resource-description-display.patch
|
|||||||
Patch7: Fix-controller-not-check-watchdog-fencing-status.patch
|
Patch7: Fix-controller-not-check-watchdog-fencing-status.patch
|
||||||
Patch8: fix-the-validation-function-of-input-for-IOWait.patch
|
Patch8: fix-the-validation-function-of-input-for-IOWait.patch
|
||||||
Patch9: fix-HealthSMART-parameter-check.patch
|
Patch9: fix-HealthSMART-parameter-check.patch
|
||||||
|
Patch10: Modify-HealthCPU-HealthIOWait-HealthSmart-about-dampen-reload-validate.patch
|
||||||
# upstream commits
|
# upstream commits
|
||||||
|
|
||||||
Requires: resource-agents
|
Requires: resource-agents
|
||||||
@ -780,6 +781,9 @@ exit 0
|
|||||||
%license %{nagios_name}-%{nagios_hash}/COPYING
|
%license %{nagios_name}-%{nagios_hash}/COPYING
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Dec 12 2023 liupei <liupei@kylinos.cn> - 2.1.6-12
|
||||||
|
- Modify HealthCPU HealthIOWait HealthSmart about dampen, reload, and validate
|
||||||
|
|
||||||
* Thu Dec 07 2023 bixiaoyan <bixiaoyan@kylinos.cn> - 2.1.6-11
|
* Thu Dec 07 2023 bixiaoyan <bixiaoyan@kylinos.cn> - 2.1.6-11
|
||||||
- Adding parameter check in HealthSMART
|
- Adding parameter check in HealthSMART
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user