open files

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
srikanth.kallu
Posts: 243
Joined: Thu Jul 26, 2012 10:48 am

open files

Post by srikanth.kallu »

Hi,

Where is the script or command in nagios that checks open files of any servers.

I noticed that there is a script /opt/nagios/libexec/check_open_files.pl which i calling another executable file /opt/nagios/libexec/count_open_files

I am not able to open /opt/nagios/libexec/count_open_files so i am not able to find the command that checks open files in AIX


Thanks,
Srikanth.
Last edited by srikanth.kallu on Mon Sep 29, 2014 10:01 am, edited 1 time in total.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: open files

Post by tmcdonald »

Are you looking to check the number of open files? A specific open file? Windows or Linux remote system?

This would need to be run through NRPE or SSH if you want an active check, and the plugin to do the actual open file checking is not one of our default plugins.

There's a perl plugin listed on the Exchange that might get you started:

http://exchange.nagios.org/directory/Pl ... es/details
Former Nagios employee
srikanth.kallu
Posts: 243
Joined: Thu Jul 26, 2012 10:48 am

Re: open files

Post by srikanth.kallu »

i am asking this because on my AIX servers

output of " lsof | wc -l " shows differnt to what it shows no nagios.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: open files

Post by tmcdonald »

Regarding the edits to your original post:

Neither of those files are standard with Nagios XI so they must have been installed by either yourself or another admin on your team. Is count_open_files a binary? What do you mean when you say you can't open it?
Former Nagios employee
srikanth.kallu
Posts: 243
Joined: Thu Jul 26, 2012 10:48 am

Re: open files

Post by srikanth.kallu »

No we havent wrote any scrpits

wcsdev:/opt/nagios/libexec# ls -l check_open_files.pl
-rwxr-xr-x 1 nagios nagios 7504 Oct 11 2012 check_open_files.pl
wcsdev:/opt/nagios/libexec# ls -l count_open_files
-rwsr-xr-x 1 root system 10991 Oct 11 2012 count_open_files
wcsdev:/opt/nagios/libexec#

These are inbuild scripts in libexec which i am thinking check_open_files.pl is used to check ope files in any OS and the script calls this count_open_files for AIX

In other words would you simply tell me what is the command that nagios uses to check open file in AIX
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: open files

Post by tmcdonald »

Okay, so this is on the *remote* system. At first it sounded like this was on your Nagios XI server.

The code for the count_open_files binary is located in the .tar.gz file you downloaded as part of the install process on the AIX machine. Inside the subcomponents/extraplugins/plugins/src is the count_open_files.c source code for that binary. It's not incredibly long, however it appears to be reading the /proc directory and making decisions about each file type to determine if it should be counted. This is of course different than just a "lsof | wc -l". How different are the numbers you are seeing?
Former Nagios employee
srikanth.kallu
Posts: 243
Joined: Thu Jul 26, 2012 10:48 am

Re: open files

Post by srikanth.kallu »

There is always a difference of 2000 files when initially started this post there was a differnce over 10000
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: open files

Post by tmcdonald »

If you're preferring to use the lsof approach, it shouldn't be too hard to modify the perl script to simply run that command and report based off of that result. Use backticks to get the output of "lsof | wc -l":

http://www.perlhowto.com/executing_external_commands
Former Nagios employee
Locked