diff --git a/heartbeat/pingd b/heartbeat/pingd index 7e4d8395b..57fa0dba3 100755 --- a/heartbeat/pingd +++ b/heartbeat/pingd @@ -1,279 +1,297 @@ #!/bin/sh # # # pingd OCF Resource Agent # Records (in the CIB) the current number of ping nodes a # cluster node can connect to. # # Copyright (c) 2006 Andrew Beekhof # All Rights Reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of version 2 of the GNU General Public License as # published by the Free Software Foundation. # # This program is distributed in the hope that it would be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # # Further, this software is distributed without any warranty that it is # free of the rightful claim of any third person regarding infringement # or the like. Any license provided herein, whether implied or # otherwise, applies only to this software file. Patent licenses, if # any, provided herein do not apply to combinations of this program with # other software, or any other product whatsoever. # # You should have received a copy of the GNU General Public License # along with this program; if not, write the Free Software Foundation, # Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. # ####################################################################### # Initialization: : ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/lib/heartbeat} . ${OCF_FUNCTIONS_DIR}/ocf-shellfuncs +# Parameter defaults + +OCF_RESKEY_pidfile_default="$HA_RSCTMP/pingd-${OCF_RESOURCE_INSTANCE}" +OCF_RESKEY_user_default="root" +OCF_RESKEY_dampen_default="1s" +OCF_RESKEY_set_default="" +OCF_RESKEY_name_default="pingd" +OCF_RESKEY_section_default="" +OCF_RESKEY_multiplier_default="" +OCF_RESKEY_host_list_default="" +OCF_RESKEY_ignore_deprecation_default="false" + +: ${OCF_RESKEY_pidfile=${OCF_RESKEY_pidfile_default}} +: ${OCF_RESKEY_user=${OCF_RESKEY_user_default}} +: ${OCF_RESKEY_dampen=${OCF_RESKEY_dampen_default}} +: ${OCF_RESKEY_set=${OCF_RESKEY_set_default}} +: ${OCF_RESKEY_name=${OCF_RESKEY_name_default}} +: ${OCF_RESKEY_section=${OCF_RESKEY_section_default}} +: ${OCF_RESKEY_multiplier=${OCF_RESKEY_multiplier_default}} +: ${OCF_RESKEY_host_list=${OCF_RESKEY_host_list_default}} +: ${OCF_RESKEY_ignore_deprecation=${OCF_RESKEY_ignore_deprecation_default}} + ####################################################################### meta_data() { cat < 1.0 Deprecation warning: This agent is deprecated and may be removed from a future release. See the ocf:pacemaker:pingd resource agent for a supported alternative. -- This is a pingd Resource Agent. It records (in the CIB) the current number of ping nodes a node can connect to. Monitors connectivity to specific hosts or IP addresses ("ping nodes") (deprecated) PID file PID file - + The user we want to run pingd as The user we want to run pingd as - + The time to wait (dampening) further changes occur Dampening interval - + The name of the instance_attributes set to place the value in. Rarely needs to be specified. Set name - + The name of the attributes to set. This is the name to be used in the constraints. Attribute name - + The section place the value in. Rarely needs to be specified. Section name - + The number by which to multiply the number of connected ping nodes by Value multiplier - + The list of ping nodes to count. Defaults to all configured ping nodes. Rarely needs to be specified. Host list - + If set to true, suppresses the deprecation warning for this agent. Suppress deprecation warning - + END } ####################################################################### pingd_usage() { cat </dev/null if [ $? -eq 0 ]; then : Yes, user exists. We can further check his permission on crm_mon if necessary else ocf_exit_reason "The user $OCF_RESKEY_user does not exist!" exit $OCF_ERR_ARGS fi fi # Pidfile better be an absolute path case $OCF_RESKEY_pidfile in /*) ;; *) ocf_log warn "You should have pidfile($OCF_RESKEY_pidfile) of absolute path!" ;; esac # Check the update interval if ocf_is_decimal "$OCF_RESKEY_update" && [ $OCF_RESKEY_update -gt 0 ]; then : else ocf_exit_reason "Invalid update interval $OCF_RESKEY_update. It should be positive integer!" exit $OCF_ERR_ARGS fi echo "Validate OK" return $OCF_SUCCESS } if [ $# -ne 1 ]; then pingd_usage exit $OCF_ERR_ARGS fi -: ${OCF_RESKEY_pidfile:="$HA_RSCTMP/pingd-${OCF_RESOURCE_INSTANCE}"} -: ${OCF_RESKEY_name:="pingd"} -: ${OCF_RESKEY_dampen:="1s"} - if [ "$__OCF_ACTION" = "meta-data" ]; then meta_data exit $OCF_SUCCESS fi # Be obnoxious, log deprecation warning on every invocation (unless # suppressed by resource configuration). ocf_deprecated case $__OCF_ACTION in start) pingd_start ;; stop) pingd_stop ;; monitor) pingd_monitor ;; validate-all) pingd_validate ;; usage|help) pingd_usage exit $OCF_SUCCESS ;; *) pingd_usage exit $OCF_ERR_UNIMPLEMENTED ;; esac exit $?