Skip to content

Commit cf3519a

Browse files
authored
Merge pull request #152 from rramkumar1/network-problem-script
Network problem script
2 parents eab61e8 + 69b6b58 commit cf3519a

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

config/network-problem-monitor.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"plugin": "custom",
3+
"pluginConfig": {
4+
"invoke_interval": "30s",
5+
"timeout": "5s",
6+
"max_output_length": 80,
7+
"concurrency": 3
8+
},
9+
"source": "network-custom-plugin-monitor",
10+
"conditions": [],
11+
"rules": [
12+
{
13+
"type": "temporary",
14+
"reason": "ConntrackFull",
15+
"path": "./config/plugin/network_problem.sh",
16+
"timeout": "3s"
17+
}
18+
]
19+
}

config/plugin/network_problem.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
3+
# This plugin checks for common network issues. Currently, it only checks
4+
# if the conntrack table is full.
5+
6+
OK=0
7+
NONOK=1
8+
UNKNOWN=2
9+
10+
[ -f /proc/sys/net/ipv4/netfilter/ip_conntrack_max ] || echo $UNKNOWN
11+
[ -f /proc/sys/net/ipv4/netfilter/ip_conntrack_count ] || echo $UNKNOWN
12+
13+
conntrack_max=$(cat /proc/sys/net/ipv4/netfilter/ip_conntrack_max)
14+
conntrack_count=$(cat /proc/sys/net/ipv4/netfilter/ip_conntrack_count)
15+
16+
if (( conntrack_count >= conntrack_max )); then
17+
echo "Conntrack table full"
18+
exit $NONOK
19+
fi
20+
21+
echo "Conntrack table available"
22+
exit $OK
23+

0 commit comments

Comments
 (0)