Skip to content

Commit f37c18a

Browse files
committed
add host/proc
1 parent 423c271 commit f37c18a

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

deployment/node-problem-detector-config.yaml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ data:
8888
{
8989
"plugin": "custom",
9090
"pluginConfig": {
91-
"invoke_interval": "30s",
92-
"timeout": "15s",
91+
"invoke_interval": "300s",
92+
"timeout": "120s",
9393
"max_output_length": 80,
9494
"concurrency": 3,
9595
"enable_message_change_based_condition_update": false
@@ -120,14 +120,15 @@ data:
120120
NONOK=1
121121
UNKNOWN=2
122122
123-
which lsof > /dev/null
124-
if [ $? -ne 0 ]; then
125-
echo "lsof is not support"
126-
exit $UNKNOWN
127-
fi
123+
cd /host/proc
124+
sum=0
125+
for pid in [0-9]*
126+
do
127+
sum=$(($sum+$(ls /host/proc/$pid/fd/ | wc -l)))
128+
done
128129
129-
count=$(lsof | wc -l)
130-
max=$(cat /proc/sys/fs/file-max)
130+
count=$(sum)
131+
max=$(cat /host/proc/sys/fs/file-max)
131132
132133
echo "current fd is $count and max is $max"
133134
if [[ $count -gt $((max*8/10)) ]]; then

deployment/node-problem-detector.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ spec:
5353
- name: config
5454
mountPath: /config
5555
readOnly: true
56+
- mountPath: /host/proc
57+
name: proc
58+
readOnly: true
5659
volumes:
5760
- name: log
5861
# Config `log` to your system log directory
@@ -64,6 +67,9 @@ spec:
6467
- name: localtime
6568
hostPath:
6669
path: /etc/localtime
70+
- name: proc
71+
hostPath:
72+
path: /proc
6773
- name: config
6874
configMap:
6975
name: node-problem-detector-config

0 commit comments

Comments
 (0)