From 69b6b58ee34f8d1e5af213d6f0b3ea3656d0cf5d Mon Sep 17 00:00:00 2001 From: Rohit Ramkumar Date: Tue, 19 Dec 2017 08:32:27 -0800 Subject: [PATCH] Addressed comments --- config/plugin/network_problem.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/config/plugin/network_problem.sh b/config/plugin/network_problem.sh index 645a84b0..51be5137 100755 --- a/config/plugin/network_problem.sh +++ b/config/plugin/network_problem.sh @@ -3,13 +3,21 @@ # This plugin checks for common network issues. Currently, it only checks # if the conntrack table is full. +OK=0 +NONOK=1 +UNKNOWN=2 + +[ -f /proc/sys/net/ipv4/netfilter/ip_conntrack_max ] || echo $UNKNOWN +[ -f /proc/sys/net/ipv4/netfilter/ip_conntrack_count ] || echo $UNKNOWN + conntrack_max=$(cat /proc/sys/net/ipv4/netfilter/ip_conntrack_max) conntrack_count=$(cat /proc/sys/net/ipv4/netfilter/ip_conntrack_count) + if (( conntrack_count >= conntrack_max )); then echo "Conntrack table full" - exit 1 + exit $NONOK fi echo "Conntrack table available" -exit 0 +exit $OK