DNS server response time slow-bluecoat-sgos

sgos
bluecoat
error
health-checks
DNS server response time slow-bluecoat-sgos
0

#1

DNS server response time slow-bluecoat-sgos

Vendor: bluecoat

OS: sgos

Description:
indeni will trigger an issue when a DNS server takes too long to respond.

Remediation Steps:
Identify any network and server issues which may be causing this.

How does this work?
Indeni logs on to the device and executes the command “show health-checks statistics”.

Why is this important?
Slow DNS lookups could impact production traffic negatively by causing delays for client requests.

Without Indeni how would you find this?
An administrator could login and manually run the command.

bluecoat-show-health-checks-statistics

#! META
name: bluecoat-show-health-checks-statistics
description: Get DNS servers states and response times
type: monitoring
monitoring_interval: 5 minutes
requires:
    vendor: "bluecoat"
    os.name: "sgos"

#! COMMENTS
dns-server-state:
    why: |
        Even though DNS servers are configured, that does not guarantee that they work. Many products require a fully functional DNS server being set.
    how: |
        Using the built-in "dig" command, each configured DNS server on the device is sent a query to resolve www.indeni.com
    without-indeni: |
        An administrator could login and manually run the command.
    can-with-snmp: false
    can-with-syslog: false

dns-response-time:
    why: |
        Slow DNS lookups could impact production traffic negatively by causing delays for client requests.
    how: |
        Indeni logs on to the device and executes the command "show health-checks statistics".
    without-indeni: |
        An administrator could login and manually run the command.
    can-with-snmp: false
    can-with-syslog: false

dns-average-response-time:
    skip-documentation: true

bluecoat-process-state:
    why: |
        The ProxySG device is integrating with a variety of different services like ICAP and DTTR. It is important to monitor the current state of the services, otherwise the organization might suffer from security risks and unavailability of external resources.
    how: |
        Indeni logs in over SSH and executes "show health-checks statistics".  The output includes the current state of each service.
    without-indeni: |
        Login via HTTPS (Port 8082) to the Bluecoat ProxySG and go to the menu Statistics> Health Checks and review the state of each service.
    can-with-snmp: false
    can-with-syslog: true

#! REMOTE::SSH
show health-checks statistics

#! PARSER::AWK

# This script collects metrics for the configured and enabled dns servers.

# DNS servers can be in an unknown state until the tests has finished.
# In these cases the state of the server is still used to avoid flapping alerts.

# Examples of the states that the script handles:
#    Enabled     Unknown         UP
#    Enabled     OK      UP
#    Enabled     Check failed    DOWN

# Disabled DNS servers are skipped.

#Authentication
#DNS Server
#External Services
#Content analysis services
#Forwarding
/^[^\s]/{
    check_type = $0
}

#  dns.1.1.1.1
/\s+dns\./ && check_type == "DNS Server" {

    ip = $1
    sub(/^.+?\./, "", ip)

    # This variable is used to indicate if the DNS server in question is in use
    # If it isn't the script won't write response time metrics to avoid false positives.
    dns_server_status = 0

    next

}


#DNS Server
/^\s+Enabled.+(DOWN|UP)$/ && check_type == "DNS Server" {


    if ($NF == "UP") {
        dns_server_status = 1
    }

    state_tags["name"] = ip
    writeDoubleMetricWithLiveConfig("dns-server-state", state_tags, "gauge", 300, dns_server_status, "DNS Servers - State", "state", "name")

    next

}

#    Last response time: 150256 ms       Average response time: 150252 ms
/^\s+Last response time: [0-9]+ ms/ && check_type == "DNS Server" {

    if (dns_server_status == 1) {
        responseTimeTags["dns-server"] = ip
        writeDoubleMetric("dns-response-time", responseTimeTags, "gauge", 300, $4)
        writeDoubleMetricWithLiveConfig("dns-average-response-time", responseTimeTags, "gauge", 300, $4, "DNS Servers - Average Response Time", "number", "dns-server")
    }

    next

}



#Checks the status of the ICAP services:
#  icap.proxyav
#    Enabled     OK      UP

/^\s+icap\.[^\s]+$/ && check_type == "Content analysis services" {

    icap_name = $1
    sub(/icap\./, "", icap_name)
    icap_tags["name"] = icap_name
    icap_tags["process-name"] = "icap-service"
    icap_tags["command"] = "show health-checks statistics"
    icap_tags["description"] = "ICAP Traffic might drop or not be fully monitored"

    next
}

#    Enabled     OK      UP
/^\s+(Enabled|Disabled)\s+/ && check_type == "Content analysis services" {
    status = $2

    if (status == "OK") {
        icap_service_status = 1
    } else {
        icap_service_status = 0
    }

    writeDoubleMetricWithLiveConfig("bluecoat-process-state", icap_tags, "gauge", 300, icap_service_status, "ICAP Services - State", "state", "name")
    next
}


#Checks the status of the drtr service:
#External Services
#  drtr.rating_service
/^\s+drtr\.[^\s]+$/ && check_type == "External Services" {

    extsrv_name = $1
    extsrv_tags["process-name"] = "external-rating-service"
    extsrv_tags["command"] = "show health-checks statistics"
    extsrv_tags["description"] = "The Dynamic Real Time Rating might not work"

    next
}

#      IP address: 185.2.196.215                 Enabled         Check failed    DOWN
#      IP address: 185.2.196.215           Enabled         OK      UP
/^\s+(IP)\s+address:\s+/ && check_type == "External Services" {
    status = $5
    extsrv_ipaddr = $3
    extsrv_tags["ip"] = extsrv_ipaddr
    extsrv_tags["name"] = extsrv_name " " extsrv_ipaddr
    if (status == "OK") {
        extsrv_service_status = 1
    } else {
        extsrv_service_status = 0
    }

    writeDoubleMetricWithLiveConfig("bluecoat-process-state", extsrv_tags, "gauge", 300, extsrv_service_status, "External Services - State", "state", "name")

}

cross_vendor_dns_server_response_time

package com.indeni.server.rules.library

import com.indeni.ruleengine._
import com.indeni.ruleengine.expressions.conditions.GreaterThanOrEqual
import com.indeni.ruleengine.expressions.core.{StatusTreeExpression, _}
import com.indeni.ruleengine.expressions.data._
import com.indeni.ruleengine.expressions.math.AverageExpression
import com.indeni.server.params.ParameterDefinition
import com.indeni.server.params.ParameterDefinition.UIType
import com.indeni.server.rules._
import com.indeni.server.rules.library.core.PerDeviceRule
import com.indeni.server.sensor.models.managementprocess.alerts.dto.AlertSeverity
import com.indeni.apidata.time.TimeSpan
import com.indeni.server.common.data.conditions.True

case class DnsServerTooSlowRule() extends PerDeviceRule with RuleHelper {

  private[library] val highThresholdParameterName = "Ahead_Alerting_Threshold"
  private val highThresholdParameter = new ParameterDefinition(highThresholdParameterName,
    "",
    "Response Time Threshold (ms)",
    "If a DNS server's response time is higher than this, an issue will be triggered.",
    UIType.DOUBLE,
    150)

  override val metadata: RuleMetadata = RuleMetadata.builder("cross_vendor_dns_server_response_time", "All Devices: DNS server response time slow",
    "indeni will trigger an issue when a DNS server takes too long to respond.", AlertSeverity.ERROR).configParameter(highThresholdParameter).build()

  override def expressionTree(context: RuleContext): StatusTreeExpression = {
    val actualValue = AverageExpression(TimeSeriesExpression[Double]("dns-response-time"))

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

      // What constitutes an issue
      StatusTreeExpression(

          // The additional tags we care about (we'll be including this in alert data)
          SelectTagsExpression(context.tsDao, Set("dns-server"), True),

        StatusTreeExpression(
              // The time-series we check the test condition against:
              SelectTimeSeriesExpression[Double](context.tsDao, Set("dns-response-time"), historyLength = ConstantExpression(TimeSpan.fromMinutes(60)), denseOnly = false),

              // The condition which, if true, we have an issue. Checked against the time-series we've collected
              GreaterThanOrEqual(
                actualValue,
                getParameterDouble(highThresholdParameter))

              // The Alert Item to add for this specific item
            ).withSecondaryInfo(
                scopableStringFormatExpression("${scope(\"dns-server\")}"),
                scopableStringFormatExpression("This server's response time is: %.0f ms", actualValue),
                title = "Affected Servers"
            ).asCondition()
        ).withoutInfo().asCondition()


      // Details of the alert itself
    ).withRootInfo(
        getHeadline(),
        ConstantExpression("One or more DNS servers have a high response time. This may slow down critical system processes."),
        ConstantExpression("Identify any network and server issues which may be causing this.")
    )
  }
}


#2