From fb12f3b70eff147c6ffe9f36686e6f230255b017 Mon Sep 17 00:00:00 2001 From: Rohit Ramkumar Date: Mon, 27 Nov 2017 11:33:38 -0800 Subject: [PATCH] Add network monitor script as plugin --- config/network-problem-monitor.json | 18 ++++++++++++++++++ config/plugin/network_problem.sh | 15 +++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 config/network-problem-monitor.json create mode 100755 config/plugin/network_problem.sh diff --git a/config/network-problem-monitor.json b/config/network-problem-monitor.json new file mode 100644 index 00000000..1a2a5764 --- /dev/null +++ b/config/network-problem-monitor.json @@ -0,0 +1,18 @@ +{ + "plugin": "custom", + "pluginConfig": { + "invoke_interval": "30s", + "timeout": "5s", + "max_output_length": 80, + "concurrency": 3 + }, + "source": "network-custom-plugin-monitor", + "rules": [ + { + "type": "temporary", + "reason": "ConntrackFull", + "path": "./config/plugin/network_problem.sh", + "timeout": "3s" + } + ] +} diff --git a/config/plugin/network_problem.sh b/config/plugin/network_problem.sh new file mode 100755 index 00000000..645a84b0 --- /dev/null +++ b/config/plugin/network_problem.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# This plugin checks for common network issues. Currently, it only checks +# if the conntrack table is full. + +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 +fi + +echo "Conntrack table available" +exit 0 +