Add open file descriptor monitoring (#5655)
This commit is contained in:
20
scripts/fd-monitor.sh
Executable file
20
scripts/fd-monitor.sh
Executable file
@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Reports open file descriptors for the current user
|
||||
#
|
||||
set -e
|
||||
|
||||
[[ $(uname) == Linux ]] || exit 0
|
||||
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
# shellcheck source=scripts/configure-metrics.sh
|
||||
source configure-metrics.sh
|
||||
|
||||
while true; do
|
||||
count=$(lsof -u $UID | wc -l)
|
||||
./metrics-write-datapoint.sh "open-files,hostname=$HOSTNAME count=$count"
|
||||
sleep 10
|
||||
done
|
||||
|
||||
exit 1
|
@ -22,5 +22,5 @@ if [[ -n $INFLUX_HOST ]]; then
|
||||
fi
|
||||
|
||||
echo "${host}/write?db=${INFLUX_DATABASE}&u=${INFLUX_USERNAME}&p=${INFLUX_PASSWORD}" \
|
||||
| xargs curl --max-time 5 -XPOST --data-binary "$point"
|
||||
| xargs curl --max-time 5 --silent --show-error -XPOST --data-binary "$point"
|
||||
exit 0
|
||||
|
Reference in New Issue
Block a user