Sha256: e57a9b84b04cecc614908ee474326204fee9023f24420aa5a69f068dcf60181b

Contents?: true

Size: 1.13 KB

Versions: 12

Compression:

Stored size: 1.13 KB

Contents

#!/bin/bash
#
# Check Net Filter Connection Track Table Usage
# ===
#
# DESCRIPTION:
#   This plugin provides a method for monitoring the percentage used of the nf_conntrack hash
#
# OUTPUT:
#   plain-text
#
# PLATFORMS:
#   Linux
#
# DEPENDENCIES:
#
# Copyright 2014 Yieldbot, Inc  <devops@yieldbot.com>
#
# Released under the same terms as Sensu (the MIT license); see LICENSE
# for details.

# CLI Options
while getopts ':w:c:' OPT; do
  case $OPT in
    w)  WARN=$OPTARG;;
    c)  CRIT=$OPTARG;;
  esac
done

WARN=${WARN:=100}
CRIT=${CRIT:=100}

# Get the max connections
MAX=$(sysctl net.netfilter.nf_conntrack_max | awk '{ print $3 }')

# Get the current connections
CURR=$(sysctl net.netfilter.nf_conntrack_count | awk '{ print $3 }')

# Percent usage of conncetions
PERCENT=$(echo "scale=3; $CURR / $MAX *100" | bc -l | cut -d "." -f1)

# If percent isnt defined set it to 0
PERCENT=${PERCENT:=0}

if [[ $PERCENT -ge $CRIT ]] ; then
  echo "NETFILTER CONNTRACK CRITICAL - $PERCENT"
  exit 2
elif [[ $PERCENT -ge $WARN ]] ; then
  echo "NETFILTER CONNTRACK WARNING - $PERCENT"
  exit 1
else
  echo "NETFILTER CONNTRACK OK - $PERCENT"
  exit 0
fi

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
sensu-plugins-network-checks-3.0.0 bin/check-netfilter-conntrack.sh
sensu-plugins-network-checks-2.3.1 bin/check-netfilter-conntrack.sh
sensu-plugins-network-checks-2.3.0 bin/check-netfilter-conntrack.sh
sensu-plugins-network-checks-2.2.0 bin/check-netfilter-conntrack.sh
sensu-plugins-network-checks-2.1.1 bin/check-netfilter-conntrack.sh
sensu-plugins-network-checks-2.1.0 bin/check-netfilter-conntrack.sh
sensu-plugins-network-checks-2.0.1 bin/check-netfilter-conntrack.sh
sensu-plugins-network-checks-2.0.0 bin/check-netfilter-conntrack.sh
sensu-plugins-network-checks-1.2.0 bin/check-netfilter-conntrack.sh
sensu-plugins-network-checks-1.1.0 bin/check-netfilter-conntrack.sh
sensu-plugins-network-checks-1.0.0 bin/check-netfilter-conntrack.sh
sensu-plugins-network-checks-0.2.4 bin/check-netfilter-conntrack.sh