<!--
  NOTE: This copyright does *not* cover user programs that use HQ
  program services by normal system calls through the application
  program interfaces provided as part of the Hyperic Plug-in Development
  Kit or the Hyperic Client Development Kit - this is merely considered
  normal use of the program, and does *not* fall under the heading of
  "derived work".
  
  Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
  This file is part of HQ.
  
  HQ is free software; you can redistribute it and/or modify
  it under the terms version 2 of the GNU General Public License as
  published by the Free Software Foundation. This program is distributed
  in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
  even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  PARTICULAR PURPOSE. See the GNU General Public License for more
  details.
  
  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
  USA.
 -->

<plugin>

  <!-- extracted to: pdk/work/scripts/ping/hq-ping

    ping will return a 1 if the host is down.  This script will wrap that
    value and exit with a code of 2, matching what the script plugin would
    expect.
  -->
  <script name="hq-ping">
  <![CDATA[
#!/bin/sh
ping=$1
switch=$2
count=$3
hostname=$4

result=`$ping $switch $count $hostname`
[ "$?" != "0" ] &&
    exit 2

exit 0
  ]]>
  </script>

  <service name="ICMP Ping">

    <config>
      <option name="ping"
              description="Ping program"
              default="/sbin/ping"/>

      <option name="hostname"
              description="Hostname"
              default="www.hyperic.com"/>

      <option name="switch"
              description="Count switch"
              default="-c"/>

      <option name="count"
              description="Count"
              default="3"
              type="int"/>
    </config>

    <!-- /sbin/ping www.hyperic.com -c 3 -->

    <filter name="template"
            value="exec:file=pdk/work/scripts/ping/hq-ping,args=%ping% %switch% %count% %hostname%:${alias}"/>

    <metric name="Availability"
            indicator="true"/>

    <metric name="Response Time"
            units="ms"
            indicator="true"/>
  </service>
</plugin>
