[update] Node problem detector path for conntrack

The path to get the conntrack value was incorrect.
Also the logic of the script is updated to raise conntrack alert.

Change-Id: I4d3ea74396eb726458d05df3d9c9a50fec74cf05
This commit is contained in:
radhika pai 2020-09-10 17:19:45 +00:00
parent 35235d1532
commit 949724ad8f

View File

@ -411,25 +411,19 @@ conf:
#!/bin/bash #!/bin/bash
# This plugin checks for common network issues. Currently, it only checks # This plugin checks for common network issues. Currently, it only checks
# if the conntrack table is full. # if the conntrack table is 50% full.
set -eu
set -o pipefail
OK=0 conntrack_threshold=$(($(cat /proc/sys/net/netfilter/nf_conntrack_max)/2 ))
NONOK=1 conntrack_count=$(cat /proc/sys/net/netfilter/nf_conntrack_count)
UNKNOWN=2
[ -f /proc/sys/net/ipv4/netfilter/ip_conntrack_max ] || exit $UNKNOWN if [ "$conntrack_count" -ge "$conntrack_threshold" ]; then
[ -f /proc/sys/net/ipv4/netfilter/ip_conntrack_count ] || exit $UNKNOWN echo "Conntrack table approaching full"
exit 1
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 $NONOK
fi fi
echo "Conntrack table available" exit 0
exit $OK
config: config:
network-problem-monitor: network-problem-monitor:
plugin: custom plugin: custom