<?xml version="1.0"?>
<!--
  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 name="netscaler">
  <property name="MIBS"
            value="/usr/share/snmp/mibs/NS-MIB-smiv2-7.0.mib"/>

  <!-- for autoinventory plugin -->
  <classpath>
    <include name="pdk/plugins/netdevice-plugin.jar"/>
  </classpath>

  <platform name="NetScaler">

    <config include="snmp"/>

    <properties>
      <property name="sysContact"
                description="Contact Name"/>

      <property name="sysName"
                description="Name"/>

      <property name="sysLocation"
                description="Location"/>

      <property name="Version"
                description="Version"/>
    </properties>

    <plugin type="autoinventory"
            class="org.hyperic.hq.plugin.netdevice.NetworkDevicePlatformDetector"/>

    <plugin type="measurement"
            class="net.hyperic.hq.product.SNMPMeasurementPlugin"/>

    <property name="template" value="${snmp.template}:${alias}"/>

    <metric name="Availability"
            template="${snmp.template},Avail=true:totalClientConnections"
            indicator="true"/>

    <metric name="Current Client Connections"
            alias="tcpCurClientConn"
            indicator="true"/>

    <metric name="Total Client Connections"
            alias="totalClientConnections"
            collectionType="trendsup"/>

    <metric name="Current Server Connections"
            alias="tcpCurServerConn"
            indicator="true"/>

    <metric name="Total Server Connections"
            alias="totalServerConnections"
            collectionType="trendsup"/>

    <!-- index to get table data -->
    <filter name="index"
            value="snmpIndexName=${snmpIndexName},snmpIndexValue=%snmpIndexValue%"/>

    <filter name="template"
            value="${snmp.template}:${alias}:${index}"/>

    <server>
      <plugin type="autoinventory"
              class="org.hyperic.hq.plugin.netdevice.NetworkDeviceDetector"/>

      <service name="Interface">
        <config>
          <option name="snmpIndexValue"
                  description="Interface name"/>
        </config>

        <property name="snmpIndexName" value="wsIfName"/>

        <plugin type="autoinventory"/>

        <metric name="Availability"
                template="${snmp.template},Avail=true:wsIfMedia:${index}"
                indicator="true"/>

        <metric name="Bits Received"
                alias="rxRawBandwidthUsage"
                collectionType="trendsup"
                units="b"
                rate="1s"
                indicator="true"/>

        <metric name="Packets Received"
                alias="rxCurrentPacketRate"
                collectionType="trendsup"
                rate="1s"
                indicator="true"/>

        <metric name="Bits Transmitted"
                alias="txRawBandwidthUsage"
                collectionType="trendsup"
                units="b"
                rate="1s"
                indicator="true"/>

        <metric name="Packets Transmitted"
                alias="txCurrentPacketRate"
                collectionType="trendsup"
                rate="1s"
                indicator="true"/>
      </service>

      <service name="Vserver">
        <config>
          <option name="snmpIndexValue"
                  description="Vserver name"/>
        </config>

        <property name="snmpIndexName" value="vsvrName"/>

        <plugin type="autoinventory"/>

        <properties>
          <property name="vsvrIpAddress"
                    description="IP Address"/>

          <property name="vsvrPort"
                    description="Port"/>
        </properties>

        <metric name="Availability"
                template="${snmp.template},Avail=true:vsvrState:${index}"
                indicator="true"/>

        <metric name="Current Client Connections"
                alias="vsvrCurClntConnections"
                indicator="true"/>

        <metric name="Current Server Connections"
                alias="vsvrCurSrvrConnections"
                indicator="true"/>

        <metric name="Services Down"
                alias="vsvrCurServicesDown"
                indicator="true"/>

        <metric name="Services Up"
                alias="vsvrCurServicesUp"/>

        <metric name="Services Unknown"
                alias="vsvrCurServicesUnKnown"/>

        <metric name="Services Out of Service"
                alias="vsvrCurServicesOutOfSvc"/>

        <metric name="Services Going Out of Service"
                alias="vsvrCurServicesTransToOutOfSvc"/>

        <metric name="Requests"
                alias="vsvrTotalRequests"
                collectionType="trendsup"
                rate="1s"
                category="THROUGHPUT"
                defaultOn="true"/>

        <metric name="Responses"
                alias="vsvrTotalResponses"
                collectionType="trendsup"
                rate="1s"
                category="THROUGHPUT"
                defaultOn="true"/>

        <metric name="RxBytes"
                alias="vsvrTotalRequestBytes"
                collectionType="trendsup"
                units="B"
                rate="1s"
                category="THROUGHPUT"
                defaultOn="true"/>

        <metric name="TxBytes"
                alias="vsvrTotalResponseBytes"
                collectionType="trendsup"
                units="B"
                category="THROUGHPUT"
                rate="1s"
                defaultOn="true"/>
      </service>

      <service name="Load Balancing Vserver">
        <config>
          <option name="snmpIndexValue"
                  description="Vserver name"/>
        </config>

        <property name="snmpIndexName" value="vsvrName"/>

        <plugin type="autoinventory"/>

        <properties>
          <property name="lbvsvrLBMethod"
                    description="Load Balancing Policy"/>

          <property name="lbvsvrPersistanceType"
                    description="Persistence Type"/>

          <property name="lbvsvrPersistanceTimeOut"
                    description="Persistence Timeout"/>
        </properties>

        <metric name="Availability"
                template="${snmp.template},Avail=true:lbvsvrActiveConn:${index}"
                indicator="true"/>

        <metric name="Current Active Connections"
                alias="lbvsvrActiveConn"
                indicator="true"/>

        <metric name="Average TTFB"
                alias="lbvsvrAvgSvrTTFB"
                indicator="true"/>
      </service>
    </server>
  </platform>
</plugin>
