Filehandler check to monitor open files

We are trying to monitor the EFS in AWS for open files, i see there is a check " [Filehandler]" however not sure how to use it.

Has anyone tried setting this up, i have tried enforcing it however doesnt seem to give any output.

We ended up writing our own local check we call “mk_stat” because it could do more than filehandles (we added threads). In our case the java-services.sh call returns the list of microservices by pid, port and name. And then we just quick get those things out of /proc.

#!/bin/bash
VERSION='20220407'

services=$(/usr/local/bin/java-services.sh --format=csv status | cut -f1,3,4)
lsof_warn_at=2000
lsof_crit_at=3000

echo "${services}" | while read pid port service; do
  cmk_ret=0

  # open fds
  cmk_lsof_tick=''
  lsof=$(ls /proc/${pid}/fd | wc -l)
  if [ $lsof -gt ${lsof_warn_at} ]; then
    cmk_lsof_tick='(!)'
  fi
  if [ $lsof -gt ${lsof_crit_at} ]; then
    cmk_lsof_tick='(!!)'
  fi

  # threads
  cmk_threads_tick=''
  threads=$(grep '^Threads:' /proc/${pid}/status | awk '{ print $NF }')


  echo "P Stat-${service}-${port} lsof_count=${lsof};${lsof_warn_at};${lsof_crit_at}|threads=${threads} Open Files: ${lsof}${cmk_lsof_tick}, Threads: ${threads}${cmk_threads_tick}"
done

Once we get to AWS, unsure what will change.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed. Contact an admin if you think this should be re-opened.