Skip to content

Commit fb12f3b

Browse files
committed
Add network monitor script as plugin
1 parent ec470b6 commit fb12f3b

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

config/network-problem-monitor.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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+
"rules": [
11+
{
12+
"type": "temporary",
13+
"reason": "ConntrackFull",
14+
"path": "./config/plugin/network_problem.sh",
15+
"timeout": "3s"
16+
}
17+
]
18+
}

config/plugin/network_problem.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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+
conntrack_max=$(cat /proc/sys/net/ipv4/netfilter/ip_conntrack_max)
7+
conntrack_count=$(cat /proc/sys/net/ipv4/netfilter/ip_conntrack_count)
8+
if (( conntrack_count >= conntrack_max )); then
9+
echo "Conntrack table full"
10+
exit 1
11+
fi
12+
13+
echo "Conntrack table available"
14+
exit 0
15+

0 commit comments

Comments
 (0)