Network port(s) down-radware-alteon-os

health-checks
critical
alteon-os
radware
Network port(s) down-radware-alteon-os
0

#1

Network port(s) down-radware-alteon-os

Vendor: radware

OS: alteon-os

Description:
Indeni will trigger an issue if one or more network ports is down.

Remediation Steps:
Review the cause for the ports being down.

radware-api-config-portInfoTable

#! META
name: radware-api-config-portInfoTable
description: Fetch the current state of the ports.
type: monitoring
monitoring_interval: 1 minute
requires:
    os.name: "alteon-os"
    vendor: "radware"
    or:
        -
            vsx: "true"
        -
            standalone: "true"

#! COMMENTS
network-interface-admin-state:
    skip-documentation: true

network-interface-speed:
    skip-documentation: true

network-interface-duplex:
    skip-documentation: true

network-interface-type:
    skip-documentation: true

network-interface-mtu:
    skip-documentation: true

network-interface-mac:
    skip-documentation: true

#! REMOTE::HTTP
url: /config/PortInfoTable
protocol: HTTPS

#! PARSER::JSON

_metrics:
    ###################
    # 1=UP,2=DOWN,3=DISABLED,4=INOPERATIVE
    ###################
    -
        _groups:
            "$.['PortInfoTable'][0:]":
                _tags:
                    "im.name":
                        _constant: "network-interface-state"
                    "live-config":
                       _constant: "true"
                    "display-name":
                        _constant: "Network - Interfaces"
                    "im.dstype.displayType":
                        _constant: "state"
                    "im.identity-tags":
                        _constant: "name"
                _temp:
                    "status":
                        _value: "Link"
                    "index":
                        _value: "Indx"
        _transform:
            _tags:
                "name": |
                    {
                        print "Port Index " temp("index")
                    }
            _value.double: |
                {
                    if (temp("status") > 1) {
                        print 0.0
                    } else {
                        print 1.0
                    }
                }
    ###################
    # 2=MBS10, 3=MBS100, 4=MBS1000, 5=ANY, 6=MBS10000, 7=MBS40000, 8=AUTO
    # 5 and 8 indicate that the port is not being used, but it is available and waiting for negotiation.
    # Best to assume that the port speed is not low.
    ###################
    -
        _groups:
            "$.['PortInfoTable'][0:][?(@.Speed in ['2', '3', '4', '6', '7'])]":
                _tags:
                    "im.name":
                        _constant: "network-interface-speed"
                    "im.identity-tags":
                        _constant: "name"
                _temp:
                    "speed":
                        _value: "Speed"
                    "index":
                        _value: "Indx"
        _transform:
            _tags:
                "name": |
                    {
                        print "Port Index " temp("index")
                    }
                "alert-item-port-speed": |
                    {
                        if (temp("speed") == 2) {
                            speed = "10M"
                        } else if (temp("speed") == 3) {
                            speed = "100M"
                        } else if (temp("speed") == 4) {
                            speed = "1000M"
                        } else if (temp("speed") == 6) {
                            speed = "10000M"
                        } else if (temp("speed") == 7) {
                            speed = "40000M"
                        }

                        print temp("index") "-" speed
                    }
            _value.complex:
                value: |
                    {
                        if (temp("speed") == 2) {
                            print "10M"
                        } else if (temp("speed") == 3) {
                            print "100M"
                        } else if (temp("speed") == 4) {
                            print "1000M"
                        } else if (temp("speed") == 6) {
                            print "10000M"
                        } else if (temp("speed") == 7) {
                            print "40000M"
                        }
                    }
    ###################
    # 2=FULL_DUPLEX, 3=HALF_DUPLEX, 4=ANY
    ###################
    -
        _groups:
            "$.['PortInfoTable'][0:][?(@.Mode in ['2', '3'])]":
                _tags:
                    "im.name":
                        _constant: "network-interface-duplex"
                    "im.identity-tags":
                        _constant: "name"
                _temp:
                    "duplex":
                        _value: "Mode"
                    "index":
                        _value: "Indx"
        _transform:
            _tags:
                "name": |
                    {
                        print "Port Index " temp("index")
                    }
            _value.complex:
                value: |
                    {
                        if (temp("duplex") == 2) {
                            print "full"
                        } else if (temp("duplex") == 3) {
                            print "half"
                        }
                    }
    ###################
    # 1=FECOPPER, 2=GECOPPER, 3=GESFP, 4=UNKNOWN, 5=XGESFP, 6=XGEQSFP
    ###################
    -
        _groups:
            "$.['PortInfoTable'][0:][?(@.PhyConnType in ['1', '2', '3', '5', '6'])]":
                _tags:
                    "im.name":
                        _constant: "network-interface-type"
                    "im.identity-tags":
                        _constant: "name"
                _temp:
                    "type":
                        _value: "PhyConnType"
                    "index":
                        _value: "Indx"
        _transform:
            _tags:
                "name": |
                    {
                        print "Port Index " temp("index")
                    }
            _value.complex:
                value: |
                    {
                        if (temp("type") == 1 || temp("type") == 2) {
                            print "Ethernet"
                        } else if (temp("type") == 3 || temp("type") == 5 || temp("type") == 6 ) {
                            print "Fiber"
                        }
                    }
    -
        _groups:
            "$.['PortInfoTable'][0:]":
                _tags:
                    "im.name":
                        _constant: "network-interface-mtu"
                    "im.identity-tags":
                        _constant: "name"
                _temp:
                    "mtu":
                        _value: "PhyIfMtu"
                    "index":
                        _value: "Indx"
        _transform:
            _tags:
                "name": |
                    {
                        print "Port Index " temp("index")
                    }
            _value.complex:
                value: |
                    {
                        print (temp("mtu") - 18)
                    }
    -
        _groups:
            "$.['PortInfoTable'][0:]":
                _tags:
                    "im.name":
                        _constant: "network-interface-mac"
                    "im.identity-tags":
                        _constant: "name"
                _value.complex: 
                    value:
                        _value: "PhyIfPhysAddress"
                _temp:
                    "index":
                        _value: "Indx"
        _transform:
            _tags:
                "name": |
                    {
                        print "Port Index " temp("index")
                    }

radware-api-config-portInfoTable

#! META
name: radware-api-config-portInfoTable
description: Fetch the current state of the ports.
type: monitoring
monitoring_interval: 1 minute
requires:
    os.name: "alteon-os"
    vendor: "radware"
    or:
        -
            vsx: "true"
        -
            standalone: "true"

#! COMMENTS
network-interface-admin-state:
    skip-documentation: true

network-interface-speed:
    skip-documentation: true

network-interface-duplex:
    skip-documentation: true

network-interface-type:
    skip-documentation: true

network-interface-mtu:
    skip-documentation: true

network-interface-mac:
    skip-documentation: true

#! REMOTE::HTTP
url: /config/PortInfoTable
protocol: HTTPS

#! PARSER::JSON

_metrics:
    ###################
    # 1=UP,2=DOWN,3=DISABLED,4=INOPERATIVE
    ###################
    -
        _groups:
            "$.['PortInfoTable'][0:]":
                _tags:
                    "im.name":
                        _constant: "network-interface-state"
                    "live-config":
                       _constant: "true"
                    "display-name":
                        _constant: "Network - Interfaces"
                    "im.dstype.displayType":
                        _constant: "state"
                    "im.identity-tags":
                        _constant: "name"
                _temp:
                    "status":
                        _value: "Link"
                    "index":
                        _value: "Indx"
        _transform:
            _tags:
                "name": |
                    {
                        print "Port Index " temp("index")
                    }
            _value.double: |
                {
                    if (temp("status") > 1) {
                        print 0.0
                    } else {
                        print 1.0
                    }
                }
    ###################
    # 2=MBS10, 3=MBS100, 4=MBS1000, 5=ANY, 6=MBS10000, 7=MBS40000, 8=AUTO
    # 5 and 8 indicate that the port is not being used, but it is available and waiting for negotiation.
    # Best to assume that the port speed is not low.
    ###################
    -
        _groups:
            "$.['PortInfoTable'][0:][?(@.Speed in ['2', '3', '4', '6', '7'])]":
                _tags:
                    "im.name":
                        _constant: "network-interface-speed"
                    "im.identity-tags":
                        _constant: "name"
                _temp:
                    "speed":
                        _value: "Speed"
                    "index":
                        _value: "Indx"
        _transform:
            _tags:
                "name": |
                    {
                        print "Port Index " temp("index")
                    }
                "alert-item-port-speed": |
                    {
                        if (temp("speed") == 2) {
                            speed = "10M"
                        } else if (temp("speed") == 3) {
                            speed = "100M"
                        } else if (temp("speed") == 4) {
                            speed = "1000M"
                        } else if (temp("speed") == 6) {
                            speed = "10000M"
                        } else if (temp("speed") == 7) {
                            speed = "40000M"
                        }

                        print temp("index") "-" speed
                    }
            _value.complex:
                value: |
                    {
                        if (temp("speed") == 2) {
                            print "10M"
                        } else if (temp("speed") == 3) {
                            print "100M"
                        } else if (temp("speed") == 4) {
                            print "1000M"
                        } else if (temp("speed") == 6) {
                            print "10000M"
                        } else if (temp("speed") == 7) {
                            print "40000M"
                        }
                    }
    ###################
    # 2=FULL_DUPLEX, 3=HALF_DUPLEX, 4=ANY
    ###################
    -
        _groups:
            "$.['PortInfoTable'][0:][?(@.Mode in ['2', '3'])]":
                _tags:
                    "im.name":
                        _constant: "network-interface-duplex"
                    "im.identity-tags":
                        _constant: "name"
                _temp:
                    "duplex":
                        _value: "Mode"
                    "index":
                        _value: "Indx"
        _transform:
            _tags:
                "name": |
                    {
                        print "Port Index " temp("index")
                    }
            _value.complex:
                value: |
                    {
                        if (temp("duplex") == 2) {
                            print "full"
                        } else if (temp("duplex") == 3) {
                            print "half"
                        }
                    }
    ###################
    # 1=FECOPPER, 2=GECOPPER, 3=GESFP, 4=UNKNOWN, 5=XGESFP, 6=XGEQSFP
    ###################
    -
        _groups:
            "$.['PortInfoTable'][0:][?(@.PhyConnType in ['1', '2', '3', '5', '6'])]":
                _tags:
                    "im.name":
                        _constant: "network-interface-type"
                    "im.identity-tags":
                        _constant: "name"
                _temp:
                    "type":
                        _value: "PhyConnType"
                    "index":
                        _value: "Indx"
        _transform:
            _tags:
                "name": |
                    {
                        print "Port Index " temp("index")
                    }
            _value.complex:
                value: |
                    {
                        if (temp("type") == 1 || temp("type") == 2) {
                            print "Ethernet"
                        } else if (temp("type") == 3 || temp("type") == 5 || temp("type") == 6 ) {
                            print "Fiber"
                        }
                    }
    -
        _groups:
            "$.['PortInfoTable'][0:]":
                _tags:
                    "im.name":
                        _constant: "network-interface-mtu"
                    "im.identity-tags":
                        _constant: "name"
                _temp:
                    "mtu":
                        _value: "PhyIfMtu"
                    "index":
                        _value: "Indx"
        _transform:
            _tags:
                "name": |
                    {
                        print "Port Index " temp("index")
                    }
            _value.complex:
                value: |
                    {
                        print (temp("mtu") - 18)
                    }
    -
        _groups:
            "$.['PortInfoTable'][0:]":
                _tags:
                    "im.name":
                        _constant: "network-interface-mac"
                    "im.identity-tags":
                        _constant: "name"
                _value.complex: 
                    value:
                        _value: "PhyIfPhysAddress"
                _temp:
                    "index":
                        _value: "Indx"
        _transform:
            _tags:
                "name": |
                    {
                        print "Port Index " temp("index")
                    }

cross_vendor_network_port_down

package com.indeni.server.rules.library

import com.indeni.ruleengine.expressions.conditions.{And, Equals}
import com.indeni.ruleengine.expressions.core.{StatusTreeExpression, _}
import com.indeni.ruleengine.expressions.data.{SelectTagsExpression, SelectTimeSeriesExpression, TimeSeriesExpression}
import com.indeni.server.common.data.conditions.True
import com.indeni.server.rules._
import com.indeni.server.rules.library.core.PerDeviceRule
import com.indeni.server.sensor.models.managementprocess.alerts.dto.AlertSeverity


case class PortIsDownRule() extends PerDeviceRule with RuleHelper {

  override val metadata: RuleMetadata = RuleMetadata.builder("cross_vendor_network_port_down", "All Devices: Network port(s) down",
    "Indeni will trigger an issue if one or more network ports is down.", AlertSeverity.CRITICAL).build()

  override def expressionTree(context: RuleContext): StatusTreeExpression = {

    val actualValue = TimeSeriesExpression[Double]("network-interface-state").last
    val adminValue = TimeSeriesExpression[Double]("network-interface-admin-state").last

    StatusTreeExpression(
      // Which objects to pull (normally, devices)
      SelectTagsExpression(context.metaDao, Set(DeviceKey), True),

      // What constitutes an issue
      And(StatusTreeExpression(
        // The additional tags we care about (we'll be including this in alert data)
        SelectTagsExpression(context.tsDao, Set("name"), withTagsCondition("network-interface-state")),
        And(
          StatusTreeExpression(
            SelectTimeSeriesExpression[Double](context.tsDao, Set("network-interface-state"), denseOnly = false),
            Equals(ConstantExpression[Option[Double]](Some(0)), actualValue)
          ).withoutInfo().asCondition(),
          StatusTreeExpression(
            SelectTimeSeriesExpression[Double](context.tsDao, Set("network-interface-admin-state"), denseOnly = false),
            adminValue.isNot(0.0)
          ).withoutInfo().asCondition().orElse(Some(true))
        )
      ).withSecondaryInfo(
        scopableStringFormatExpression("${scope(\"name\")}"),
        EMPTY_STRING,
        title = "Ports Affected"
      ).asCondition(), generateDevicePassiveAndPassiveLinkStateCondition(context.tsDao))
    ).withRootInfo(
      getHeadline(),
      ConstantExpression("One or more ports are down."),
      ConditionalRemediationSteps("Review the cause for the ports being down.",
        ConditionalRemediationSteps.OS_NXOS ->
          """|
            |1. Check the physical media to ensure that there are no damaged parts.
            |2. Verify that the SFP (small form-factor pluggable) devices in use are those authorized by Cisco and that they are not faulty by executing the "show interface transceiver" NX-OS command.
            |3. Verify that you have enabled the port by using the "no shutdown" NX-OS command.
            |4. Use the "show interface" command to verify the state of the interface. Besides, you can use the "show interface counters" command to check port counters.
            |5. Check if the port is configured in dedicated mode.
            |6. Execute the following NX-OS commands to gather more information about ports:
            | a. "show interface status"
            | b. "show interface capabilities"
            | c. "show udld"
            | d. "show tech-support udld"
            |
            |7. For more information review: <a target="_blank" href="https://www.cisco.com/c/en/us/td/docs/switches/datacenter/nexus9000/sw/7-x/troubleshooting/guide/b_Cisco_Nexus_9000_Series_NX-OS_Troubleshooting_Guide_7x/b_Cisco_Nexus_9000_Series_NX-OS_Troubleshooting_Guide_7x_chapter_0101.pdf">Nexus Troubleshooting Guide</a> """.stripMargin,
        ConditionalRemediationSteps.VENDOR_JUNIPER ->
          """|
            |1. On the device command line interface run "show interfaces extensive" command to check the status of the interface.
            |2. Execute "show configuration interface" command to check interface configuration.
            |3. Check the encapsulation type and physical media on the port.
            |4. Check the port specification and the fiber cable.
            |5. Review the following article on Juniper TechLibrary for more information: <a target="_blank" href="https://www.juniper.net/documentation/en_US/junos/topics/reference/command-summary/show-interfaces-security.html#jd0e1772">Operational Commands: show interfaces (SRX Series)</a>.""".stripMargin,
        ConditionalRemediationSteps.VENDOR_FORTINET ->
          """|
            |1. Monitor hardware network operations (e.g. speed, duplex settings) by using the "diag hardware deviceinfo nic <interface>" FortiOS command.
            |2. Run the command "diag hardware deviceinfo nic <interface>" command to display a list of hardware related names and values. Review the next link for more details: http://help.fortinet.com/fos50hlp/54/Content/FortiOS/fortigate-toubleshooting-54/troubleshooting_tools.htm
            |3. Run the hidden FortiOS command "fnsysctl cat /proc/net/dev" to get a summary of  the interface statistics.
            |4. Check for a mismatch in the speed and duplex interface settings on two sides of a cable, or for a damaged cable / SFP. Try to manually configure both sides to the same speed/duplex mode when you can. For more information, review "Symptoms of Ethernet speed/duplex mismatches" at http://kb.fortinet.com/kb/documentLink.do?externalID=10653
            |5. Review the log history for interfaces status changes.
            |6. Review the interface configuration. For more information, use the following interface configuration guide: http://help.fortinet.com/fos50hlp/52data/Content/FortiOS/fortigate-system-administration-52/Interfaces/interfaces.htm""".stripMargin
      )
    )
  }
}