mirror of
https://github.com/kubernetes/node-problem-detector.git
synced 2026-02-14 18:09:57 +00:00
Merge pull request #152 from rramkumar1/network-problem-script
Network problem script
This commit is contained in:
19
config/network-problem-monitor.json
Normal file
19
config/network-problem-monitor.json
Normal 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"
|
||||
}
|
||||
]
|
||||
}
|
||||
23
config/plugin/network_problem.sh
Executable file
23
config/plugin/network_problem.sh
Executable 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
|
||||
|
||||
Reference in New Issue
Block a user