Page 1 of 2
NAGIOS XI check Number of file threads
Posted: Wed Dec 20, 2017 1:22 am
by junqian1992
Hi,
how to monitor the Number of file threads in the nagios XI?
command : ps -eLf | awk '{sum += $6}END{print "Threads:\t" sum}' , how to configure on the nagios XI services?
Thank you.
Re: NAGIOS XI check Number of file threads
Posted: Wed Dec 20, 2017 11:19 am
by npolovenko
Hello,
@junqian1992.
You can just create a plugin based on this command. On your Nagios server navigate to /usr/local/nagios/libexec/ and create a new file called check_threads.sh. Paste the code into the file:
Code: Select all
ps -eLf | awk '{sum += $6}END{print "Threads:\t" sum}'
Save and exit.
Run the following command to give the permissions to your plugin:
After that you can create a command in XI. Go to the Configure/Core Configuration Manager, then commands, then "Add New":
screenshot-192.168.4.172-2017-12-20-10-12-09-830.png
Click on Save. Then Apply COnfiguration.
Now, go to the Core COnfiguration Manager again, click on services, and then Add New. In check_command field choose the command that you have just created. Fill out other required fileds. In manage Hosts, you may select localhost. Click on Save, then Apply configuration.
That should do it. Here's a reference just in case:
https://assets.nagios.com/downloads/nag ... ios-XI.pdf
Re: NAGIOS XI check Number of file threads
Posted: Thu Dec 21, 2017 3:48 am
by junqian1992
Hi npolovenko,
Yes, this configuration i was do it before, but the result is showing the current nagios server file threads, whatever i change to the server which i want to monitor also showing the nagios server status, not the server i specific one.
Re: NAGIOS XI check Number of file threads
Posted: Thu Dec 21, 2017 11:07 am
by kyang
Are you using this script to check another server? Is that correct?
What's in your script? Could you post it?
Did you script it to pass a -H argument?
If you haven't scripted it to connect to another server and execute, it's best to do so through an agent like (NRPE or NCPA) or by SSH. If you want to check another server for the number of file threads.
Let us know!
Re: NAGIOS XI check Number of file threads
Posted: Mon Dec 25, 2017 8:32 pm
by junqian1992
hi kyang,
script check_threads.sh as below:
#!/bin/bash
ps -eLf | awk '{sum += $6}END{print "Threads:\t" sum}'
Did you script it to pass a -H argument?
ans: i need to add -H argument in the script ? how to i add ? can provide me some example?
Re: NAGIOS XI check Number of file threads
Posted: Wed Dec 27, 2017 9:40 am
by mcapra
If you want to run that script from the Nagios XI machine and have it check the file threads on a completely different machine, you'll need some sort of transport method. It would indicate a
massive security problem on the destination machine if one could execute arbitrary commands on it with no additional configuration.
NRPE, NCPA, or simple SSH checks should work. Here's documentation on all of those things:
NRPE:
https://assets.nagios.com/downloads/nag ... _Agent.pdf
https://support.nagios.com/kb/article/n ... d-612.html
NCPA:
https://assets.nagios.com/downloads/nag ... ios-XI.pdf
https://www.nagios.org/ncpa/help.php#ap ... ng-plugins
check_by_ssh:
https://assets.nagios.com/downloads/nag ... ng_SSH.pdf
Re: NAGIOS XI check Number of file threads
Posted: Wed Dec 27, 2017 10:20 am
by kyang
Thanks
@mcapra!
junqian1992, please take a look at the suggestions for running your plugin on another remote machine.
Re: NAGIOS XI check Number of file threads
Posted: Wed Dec 27, 2017 9:12 pm
by junqian1992
Thanks mcapra and kyang.
I found out what i miss configuration.
it is working now, i added the command[check_threads]=/usr/local/nagios/libexec/check_threads.sh in the /usr/local/nagios/etc/nrpe/common.cfg it can work now. Thank you very much.
Re: NAGIOS XI check Number of file threads
Posted: Thu Dec 28, 2017 10:18 am
by kyang
Sounds good!
Glad it's working, are we okay to close this thread?
Or did you have any more questions?
Re: NAGIOS XI check Number of file threads
Posted: Mon Jan 08, 2018 2:55 am
by junqian1992
Hi Kyang,
You can close this ticket.
Thank you very much.