<?xml version="1.0" standalone="yes"?>

<!--

  $Header$
  
  NOTICE:
    Copyright 2014 Kaseya. All Rights Reserved. 
    This software is the proprietary information
    of Kaseya. Use is subject to license terms.

  DESCRIPTION:
    Configuration file for automatically discovering and monitoring 
    network interface state, utilization, errors, etc using IF-MIB 
    section of standard MIB-2
  
-->
        
    
<NetVigil>
  <monitor type="snmp">

    <onLoad>
      <verify type="oid" 
        object=".1.3.6.1.2.1.2.1.0"
        pattern="\d+" 
        action="accept"/>
      <verify type="variable" 
        object="ifTable"
        pattern="^1$" 
        action="reject"/>
    </onLoad>

    <probeConfig>
      <subType name="interface_pkt_rate" enabled="true">
        <appliesTo agentVersion="2" deviceType="switch"/>
        <snmpOid>
          <prefix>.1.3.6.1.2.1</prefix>
          <poll name="objectIndex" index="2.2.1.1"/>
          <poll name="objectName" index="2.2.1.2"/>
          <poll name="ifDescr" index="31.1.1.1.18"/>
          <poll name="portType" index="2.2.1.3"/>
          <poll name="maximumValue" index="2.2.1.5"/>
          <poll name="portStatus" index="2.2.1.7"/>
          <poll name="ifOperStatus" index="2.2.1.8"/>
          <poll name="ifMtu" index="2.2.1.4"/>
          <poll name="managed" index="2.2.1.10"/>
        </snmpOid>
        <filter name="ifOperStatus"
          pattern="^(1|5)$"
          action="accept"/>
        <filter name="portStatus"
          pattern="^2$"
          action="reject"/>
        <filter name="objectName"
          pattern="(^vlan|dialer|tunnel|^tu\d*$|null|cef\s+layer|virtual\-|console|manage|mgmt|cas\s+channel)"
          action="reject"/>
        <postProcess
          parser="interface"
          element="netif_desc"
          input="[[
            {
              if ($maximumValue > 20000000) {
                $input='.1.3.6.1.2.1.31.1.1.1.7.'.$objectIndex;
              } else {
                $input='.1.3.6.1.2.1.2.2.1.11.'.$objectIndex;
              }
            }
            return $input;
          ]]"
          output="[[
            {
              if ($maximumValue > 20000000) {
                $output= '.1.3.6.1.2.1.31.1.1.1.11.'.$objectIndex;
              } else {
                $output= '.1.3.6.1.2.1.2.2.1.17.'.$objectIndex;
              }
              return $output;
            }
          ]]"
          testName="[[$objectName]][[$ifDescr =~ /\S+/ ? ' ('. $ifDescr .')' : '';]] Packets"
          displayUnit="pkts/s"
          resultMultiplier="1"
          warningThreshold="[[ 
            {
              $tempValue = 0;
              $tempValue = $maximumValue / 4608;
              $tempValue *= 0.75;
              $tempValue = sprintf(qq(%d), $tempValue);
              return ($tempValue > 0 ? $tempValue : '');
            }
          ]]"
          criticalThreshold="[[ 
            {
              $tempValue = 0;
              $tempValue = $maximumValue / 4608;
              $tempValue *= 0.90;
              $tempValue = sprintf(qq(%d), $tempValue);
              return ($tempValue > 0 ? $tempValue : '');
            }
          ]]"
          directive="rate"/>
      </subType>
    </probeConfig>

    <probeConfig>
      <subType name="interface_pkt_rate" enabled="true">
        <appliesTo agentVersion="1" deviceType="switch"/>
        <snmpOid>
          <prefix>.1.3.6.1.2.1</prefix>
          <poll name="objectIndex" index="2.2.1.1"/>
          <poll name="objectName" index="2.2.1.2"/>
          <poll name="ifDescr" index="31.1.1.1.18"/>
          <poll name="portType" index="2.2.1.3"/>
          <poll name="maximumValue" index="2.2.1.5"/>
          <poll name="portStatus" index="2.2.1.7"/>
          <poll name="ifOperStatus" index="2.2.1.8"/>
          <poll name="ifMtu" index="2.2.1.4"/>
          <poll name="managed" index="2.2.1.10"/>
          <poll name="input" index="2.2.1.11"/>
          <poll name="output" index="2.2.1.17"/>
        </snmpOid>
        <filter name="ifOperStatus"
          pattern="^(1|5)$"
          action="accept"/>
        <filter name="portStatus"
          pattern="^2$"
          action="reject"/>
        <filter name="objectName"
          pattern="(^vlan|dialer|tunnel|^tu\d*$|null|cef\s+layer|virtual\-|console|manage|mgmt|cas\s+channel)"
          action="reject"/>
        <postProcess
          parser="interface"
          element="netif_desc"
          testName="[[$objectName]][[$ifDescr =~ /\S+/ ? ' ('. $ifDescr .')' : '';]] Packets"
          displayUnit="pkts/s"
          resultMultiplier="1"
          warningThreshold="[[ 
            {
              $tempValue = 0;
              $tempValue = $maximumValue / 4608;
              $tempValue *= 0.75;
              $tempValue = sprintf(qq(%d), $tempValue);
              return ($tempValue > 0 ? $tempValue : '');
            }
          ]]"
          criticalThreshold="[[ 
            {
              $tempValue = 0;
              $tempValue = $maximumValue / 4608;
              $tempValue *= 0.90;
              $tempValue = sprintf(qq(%d), $tempValue);
              return ($tempValue > 0 ? $tempValue : '');
            }
          ]]"
          directive="rate"/>
      </subType>
    </probeConfig>

  </monitor>
</NetVigil>

