4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of version 2 of the GNU General Public License as
6 # published by the Free Software Foundation.
8 # This program is distributed in the hope that it would be useful, but
9 # WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 # Further, this software is distributed without any warranty that it is
13 # free of the rightful claim of any third person regarding infringement
14 # or the like. Any license provided herein, whether implied or
15 # otherwise, applies only to this software file. Patent licenses, if
16 # any, provided herein do not apply to combinations of this program with
17 # other software, or any other product whatsoever.
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write the Free Software Foundation,
21 # Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
24 #######################################################################
27 . ${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs
28 #. /usr/lib/ocf/resource.d/heartbeat/.ocf-shellfuncs
30 #######################################################################
35 <!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
36 <resource-agent name="VIPcheck" version="0.1">
37 <version>1.0</version>
40 This is a VIPcheck Resource Agent.
42 <shortdesc lang="en">VIPcheck resource agent</shortdesc>
45 <parameter name="target_ip" unique="1">
47 ping target VIP address.
49 <shortdesc lang="en">target ip</shortdesc>
50 <content type="string" default="" />
53 <parameter name="count" unique="1">
57 <shortdesc lang="en">repeat times</shortdesc>
58 <content type="integer" default="1" />
61 <parameter name="wait" unique="1">
65 <shortdesc lang="en">wait times</shortdesc>
66 <content type="integer" default="10" />
72 <action name="start" timeout="60" />
73 <action name="stop" timeout="60" />
74 <action name="monitor" timeout="60" interval="10" depth="0" start-delay="0" />
75 <action name="meta-data" timeout="5" />
81 #######################################################################
85 usage: $0 {start|stop|monitor|meta-data}
87 Expects to have a fully populated OCF RA-compliant environment set.
93 if [ $? = $OCF_SUCCESS ]; then
97 ping ${OCF_RESKEY_target_ip} -c ${OCF_RESKEY_count} -w ${OCF_RESKEY_wait} > /dev/null 2>&1
99 ocf_log debug "target_ip = $OCF_RESKEY_target_ip, count = $OCF_RESKEY_count, wait = $OCF_RESKEY_wait"
100 ocf_log debug "ping return code = $prc"
101 if [ $prc = 0 ]; then
103 return $OCF_ERR_GENERIC
106 touch ${OCF_RESKEY_state}
113 if [ $? = $OCF_SUCCESS ]; then
114 rm ${OCF_RESKEY_state}
120 if [ -f ${OCF_RESKEY_state} ]; then
124 return $OCF_ERR_GENERIC
126 return $OCF_NOT_RUNNING
129 : ${OCF_RESKEY_wait=10}
130 : ${OCF_RESKEY_count=1}
131 : ${OCF_RESKEY_state=${HA_RSCTMP}/VIPcheck-${OCF_RESOURCE_INSTANCE}.state}
133 case $__OCF_ACTION in
137 start) VIPcheck_start;;
138 stop) VIPcheck_stop;;
139 monitor) VIPcheck_monitor;;
140 usage|help) VIPcheck_usage
144 exit $OCF_ERR_UNIMPLEMENTED
148 ocf_log debug "${OCF_RESOURCE_INSTANCE} $__OCF_ACTION : $rc"