Add network monitor script as plugin

This commit is contained in:
Rohit Ramkumar
2017-11-27 11:33:38 -08:00
parent ec470b65b0
commit fb12f3b70e
2 changed files with 33 additions and 0 deletions
+18
View File
@@ -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"
}
]
}
+15
View File
@@ -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