diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 07:45:40 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 07:45:40 +0000 |
commit | 07d7f4cfa4b10de87a31b68191036ff446add675 (patch) | |
tree | 7162524d8aaf1aef62d2f4fa51f595ed113981ff /agents | |
parent | Adding upstream version 2.1.6. (diff) | |
download | pacemaker-07d7f4cfa4b10de87a31b68191036ff446add675.tar.xz pacemaker-07d7f4cfa4b10de87a31b68191036ff446add675.zip |
Adding upstream version 2.1.7.upstream/2.1.7
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'agents')
-rw-r--r-- | agents/Makefile.am | 4 | ||||
-rw-r--r-- | agents/alerts/Makefile.am | 4 | ||||
-rwxr-xr-x | agents/ocf/HealthCPU.in | 23 | ||||
-rwxr-xr-x | agents/ocf/HealthSMART.in | 16 | ||||
-rw-r--r-- | agents/ocf/Makefile.am | 11 | ||||
-rwxr-xr-x | agents/ocf/ifspeed.in | 20 | ||||
-rwxr-xr-x | agents/ocf/ping.in | 13 | ||||
-rw-r--r-- | agents/stonith/Makefile.am | 3 |
8 files changed, 55 insertions, 39 deletions
diff --git a/agents/Makefile.am b/agents/Makefile.am index 3cbd7c6..af0d970 100644 --- a/agents/Makefile.am +++ b/agents/Makefile.am @@ -9,4 +9,6 @@ include $(top_srcdir)/mk/common.mk -SUBDIRS = alerts ocf stonith +SUBDIRS = alerts \ + ocf \ + stonith diff --git a/agents/alerts/Makefile.am b/agents/alerts/Makefile.am index fdb294f..a3fe891 100644 --- a/agents/alerts/Makefile.am +++ b/agents/alerts/Makefile.am @@ -10,6 +10,4 @@ include $(top_srcdir)/mk/common.mk samplesdir = $(datadir)/$(PACKAGE)/alerts/ -dist_samples_DATA = alert_file.sh.sample \ - alert_smtp.sh.sample \ - alert_snmp.sh.sample +dist_samples_DATA = $(wildcard *.sample) diff --git a/agents/ocf/HealthCPU.in b/agents/ocf/HealthCPU.in index 4a8e7c3..14e4b07 100755 --- 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 @@ -136,8 +145,7 @@ healthcpu_monitor() { } healthcpu_reload_agent() { - # No action required - :; + return $OCF_SUCCESS } healthcpu_validate() { @@ -188,6 +196,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 @@ -195,7 +206,7 @@ meta-data) meta_data ;; start) healthcpu_start;; stop) healthcpu_stop;; -monitor) healthcpu_monitor;; +monitor) healthcpu_validate && healthcpu_monitor;; reload-agent) healthcpu_reload_agent;; validate-all) healthcpu_validate;; usage|help) healthcpu_usage diff --git a/agents/ocf/HealthSMART.in b/agents/ocf/HealthSMART.in index b6edac2..b2f37de 100755 --- a/agents/ocf/HealthSMART.in +++ b/agents/ocf/HealthSMART.in @@ -139,25 +139,25 @@ check_temperature() { if [ $1 -lt ${lower_red_limit} ] ; then ocf_log info "Drive ${DRIVE} ${DEVICE} too cold: ${1} C" - attrd_updater -n "#health-smart" -U "red" -d "${OCF_RESKEY_dampen}" + attrd_updater -n "#health-smart" -B "red" -d "${OCF_RESKEY_dampen}" return 1 fi if [ $1 -gt ${upper_red_limit} ] ; then ocf_log info "Drive ${DRIVE} ${DEVICE} too hot: ${1} C" - attrd_updater -n "#health-smart" -U "red" -d "${OCF_RESKEY_dampen}" + attrd_updater -n "#health-smart" -B "red" -d "${OCF_RESKEY_dampen}" return 1 fi if [ $1 -lt ${lower_yellow_limit} ] ; then ocf_log info "Drive ${DRIVE} ${DEVICE} quite cold: ${1} C" - attrd_updater -n "#health-smart" -U "yellow" -d "${OCF_RESKEY_dampen}" + attrd_updater -n "#health-smart" -B "yellow" -d "${OCF_RESKEY_dampen}" return 1 fi if [ $1 -gt ${upper_yellow_limit} ] ; then ocf_log info "Drive ${DRIVE} ${DEVICE} quite hot: ${1} C" - attrd_updater -n "#health-smart" -U "yellow" -d "${OCF_RESKEY_dampen}" + attrd_updater -n "#health-smart" -B "yellow" -d "${OCF_RESKEY_dampen}" return 1 fi } @@ -244,7 +244,7 @@ HealthSMART_start() { } HealthSMART_stop() { - attrd_updater -D -n "#health-smart" -d "${OCF_RESKEY_dampen}" + attrd_updater -D -n "#health-smart" rm "${OCF_RESKEY_state}" @@ -278,7 +278,7 @@ HealthSMART_monitor() { # Check overall S.M.A.R.T. status "${OCF_RESKEY_smartctl}" -d "${DEVICE}" -H ${DRIVE} | grep -q "SMART overall-health self-assessment test result: PASSED" if [ $? -ne 0 ]; then - attrd_updater -n "#health-smart" -U "red" -d "${OCF_RESKEY_dampen}" + attrd_updater -n "#health-smart" -B "red" -d "${OCF_RESKEY_dampen}" return $OCF_SUCCESS fi @@ -290,7 +290,7 @@ HealthSMART_monitor() { else "${OCF_RESKEY_smartctl}" -H "${DRIVE}" | grep -q "SMART overall-health self-assessment test result: PASSED" if [ $? -ne 0 ]; then - attrd_updater -n "#health-smart" -U "red" -d "${OCF_RESKEY_dampen}" + attrd_updater -n "#health-smart" -B "red" -d "${OCF_RESKEY_dampen}" return $OCF_SUCCESS fi @@ -301,7 +301,7 @@ HealthSMART_monitor() { fi done - attrd_updater -n "#health-smart" -U "green" -d "${OCF_RESKEY_dampen}" + attrd_updater -n "#health-smart" -B "green" -d "${OCF_RESKEY_dampen}" return $OCF_SUCCESS fi diff --git a/agents/ocf/Makefile.am b/agents/ocf/Makefile.am index 823e67e..0b18bb1 100644 --- a/agents/ocf/Makefile.am +++ b/agents/ocf/Makefile.am @@ -27,8 +27,11 @@ ocf_SCRIPTS = ClusterMon \ if BUILD_XML_HELP -man7_MANS = $(ocf_SCRIPTS:%=ocf_pacemaker_%.7) $(dist_ocf_SCRIPTS:%=ocf_pacemaker_%.7) -DBOOK_OPTS = --stringparam command.prefix ocf_pacemaker_ --stringparam variable.prefix OCF_RESKEY_ --param man.vol 7 +man7_MANS = $(ocf_SCRIPTS:%=ocf_pacemaker_%.7) \ + $(dist_ocf_SCRIPTS:%=ocf_pacemaker_%.7) +DBOOK_OPTS = --stringparam command.prefix ocf_pacemaker_ \ + --stringparam variable.prefix OCF_RESKEY_ \ + --param man.vol 7 ocf_pacemaker_%.xml: % $(AM_V_GEN)OCF_FUNCTIONS=/dev/null OCF_ROOT=$(OCF_ROOT_DIR) $(abs_builddir)/$< meta-data > $@ @@ -50,4 +53,6 @@ validate: all | xmllint --noout --relaxng $(RNG) - || break; \ done -CLEANFILES = $(man7_MANS) $(ocf_SCRIPTS:%=%.xml) $(dist_ocf_SCRIPTS:%=%.xml) +CLEANFILES = $(man7_MANS) \ + $(ocf_SCRIPTS:%=%.xml) \ + $(dist_ocf_SCRIPTS:%=%.xml) diff --git a/agents/ocf/ifspeed.in b/agents/ocf/ifspeed.in index 5fbaf89..8c07c3d 100755 --- a/agents/ocf/ifspeed.in +++ b/agents/ocf/ifspeed.in @@ -123,7 +123,7 @@ Can be used to tune how big attribute value will be. <content type="integer" default="${OCF_RESKEY_weight_base_default}"/> </parameter> -<parameter name="dampen"> +<parameter name="dampen" reloadable="1"> <longdesc lang="en"> The time to wait (dampening) for further changes to occur. </longdesc> @@ -147,6 +147,7 @@ Log more verbosely. <action name="monitor" depth="0" timeout="30s" interval="10s"/> <action name="meta-data" timeout="5s" /> <action name="validate-all" timeout="30s" depth="0" /> +<action name="reload-agent" timeout="20s" /> </actions> </resource-agent> END @@ -154,7 +155,7 @@ END usage() { cat <<END -Usage: $0 {start|stop|monitor|validate-all|meta-data} +Usage: $0 {start|stop|monitor|validate-all|meta-data|reload-agent} Expects to have a fully populated OCF RA-compliant environment set. END @@ -172,7 +173,7 @@ start() { stop() { ha_pseudo_resource "${ha_pseudo_resource_name}" stop - attrd_updater -D -n "${OCF_RESKEY_name}" -d "${OCF_RESKEY_dampen}" ${attrd_options} + attrd_updater -D -n "${OCF_RESKEY_name}" ${attrd_options} return $OCF_SUCCESS } @@ -491,11 +492,7 @@ update() { speed=$( iface_get_speed "${nic}" ) : $(( score = speed * ${OCF_RESKEY_weight_base} / 1000 )) - if [ "$__OCF_ACTION" = "start" ] ; then - attrd_updater -n "${OCF_RESKEY_name}" -B "${score}" -d "${OCF_RESKEY_dampen}" ${attrd_options} - else - attrd_updater -n "${OCF_RESKEY_name}" -v "${score}" -d "${OCF_RESKEY_dampen}" ${attrd_options} - fi + attrd_updater -n "${OCF_RESKEY_name}" -B "${score}" -d "${OCF_RESKEY_dampen}" ${attrd_options} rc=$? case ${rc} in 0) @@ -508,6 +505,10 @@ update() { return ${rc} } +reload_agent() { + return $OCF_SUCCESS +} + case $__OCF_ACTION in meta-data) meta_data @@ -542,6 +543,9 @@ case "$__OCF_ACTION" in validate-all) validate "$OCF_CHECK_LEVEL" ;; + reload-agent) + reload_agent + ;; *) usage exit $OCF_ERR_UNIMPLEMENTED diff --git a/agents/ocf/ping.in b/agents/ocf/ping.in index 4855e5b..73a3677 100755 --- a/agents/ocf/ping.in +++ b/agents/ocf/ping.in @@ -178,7 +178,7 @@ ping_stop() { rm -f "${OCF_RESKEY_pidfile}" - attrd_updater -D -n "$OCF_RESKEY_name" -d "$OCF_RESKEY_dampen" + attrd_updater -D -n "$OCF_RESKEY_name" return $OCF_SUCCESS } @@ -237,8 +237,7 @@ ping_validate() { } ping_reload_agent() { - # No action required - :; + return $OCF_SUCCESS } fping_check() { @@ -319,11 +318,7 @@ ping_update() { fi score=$(expr $active \* $OCF_RESKEY_multiplier) - if [ "$__OCF_ACTION" = "start" ] ; then - attrd_updater -n "$OCF_RESKEY_name" -B "$score" -d "$OCF_RESKEY_dampen" - else - attrd_updater -n "$OCF_RESKEY_name" -v "$score" -d "$OCF_RESKEY_dampen" - fi + attrd_updater -n "$OCF_RESKEY_name" -B "$score" -d "$OCF_RESKEY_dampen" rc=$? case $rc in 0) ping_conditional_log debug "Updated $OCF_RESKEY_name = $score" ;; @@ -423,7 +418,7 @@ start) ping_start;; stop) ping_stop;; monitor) ping_monitor;; validate-all) ping_validate;; -reload-agent) ping_reload_agent;; +reload-agent) ping_reload_agent;; usage|help) ping_usage exit $OCF_SUCCESS ;; diff --git a/agents/stonith/Makefile.am b/agents/stonith/Makefile.am index e231775..3e074f1 100644 --- a/agents/stonith/Makefile.am +++ b/agents/stonith/Makefile.am @@ -16,4 +16,5 @@ if BUILD_LHA_SUPPORT sbin_SCRIPTS += fence_legacy endif -CLEANFILES = $(man7_MANS) $(man8_MANS) +CLEANFILES = $(man7_MANS) \ + $(man8_MANS) |