Skip to content

Commit dbc4cd2

Browse files
committed
fix warn and info level of custom plugin
1 parent 30dab97 commit dbc4cd2

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

config/plugin/check_fd.sh

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,14 @@ OK=0
66
NONOK=1
77
UNKNOWN=2
88

9-
which lsof > /dev/null
10-
if [ $? -ne 0 ]; then
11-
echo "lsof is not support"
12-
exit $UNKNOWN
13-
fi
9+
cd /host/proc
1410

15-
count=$(lsof | wc -l)
16-
max=$(cat /proc/sys/fs/file-max)
11+
count=$(find -maxdepth 1 -type d -name '[0-9]*' | xargs -I {} ls {}/fd | wc -l)
12+
max=$(cat /host/proc/sys/fs/file-max)
1713

18-
echo "current fd is $count and max is $max"
19-
if [[ $count -gt $((max*8/10)) ]]; then
20-
echo "more than 80 percent of fd has been used($count:$max)"
14+
if [[ $count -gt $((max*80/100)) ]]; then
15+
echo "current fd usage is $count and max is $max"
2116
exit $NONOK
2217
fi
23-
echo "fd is ok"
24-
exit $OK
18+
echo "node has no fd pressure"
19+
exit $OK

deployment/node-problem-detector-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ data:
130130
echo "current fd usage is $count and max is $max"
131131
exit $NONOK
132132
fi
133-
echo "fd usage is ok"
133+
echo "node has no fd pressure"
134134
exit $OK
135135
kind: ConfigMap
136136
metadata:

0 commit comments

Comments
 (0)