Merge pull request #152 from rramkumar1/network-problem-script

Network problem script
This commit is contained in:
Lantao Liu
2018-01-02 19:54:10 -08:00
committed by GitHub
2 changed files with 42 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
{
"plugin": "custom",
"pluginConfig": {
"invoke_interval": "30s",
"timeout": "5s",
"max_output_length": 80,
"concurrency": 3
},
"source": "network-custom-plugin-monitor",
"conditions": [],
"rules": [
{
"type": "temporary",
"reason": "ConntrackFull",
"path": "./config/plugin/network_problem.sh",
"timeout": "3s"
}
]
}

View File

@@ -0,0 +1,23 @@
#!/bin/bash
# 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 $NONOK
fi
echo "Conntrack table available"
exit $OK