how to check server resource using check_nmon.pl
how to check server resource using check_nmon.pl
hi,
i'm trying use check_nmon.pl plugin for check cpu, mem, paging space.....
when i run the plugin on servers i need check it work fine. But UNKNOW error once run via check_ncpa.py.
don't know if anything incorrect?
Thank you.
bash-4.3# ./check_nmon.pl -F /backup/nmon_log/srv_06_210128_0600.nmon -k CPU_ID -s User%,Sys%,Wait%,Idl
OK - All counters within specified thresholds
[root@nagiosxi libexec]#/usr/local/nagios/libexec/check_ncpa.py -H 192.168.xxx.x -P 5693 -t aaa -M 'plugins/check_nmon.pl' -a '-F /backup/nmon_log/srv_06_210128_0600.nmon -k CPU_ID -s User%,Sys%,Wait%,Idl'
UNKNOWN - NMON file backup older than an hour. NMON is stopped!
i'm trying use check_nmon.pl plugin for check cpu, mem, paging space.....
when i run the plugin on servers i need check it work fine. But UNKNOW error once run via check_ncpa.py.
don't know if anything incorrect?
Thank you.
bash-4.3# ./check_nmon.pl -F /backup/nmon_log/srv_06_210128_0600.nmon -k CPU_ID -s User%,Sys%,Wait%,Idl
OK - All counters within specified thresholds
[root@nagiosxi libexec]#/usr/local/nagios/libexec/check_ncpa.py -H 192.168.xxx.x -P 5693 -t aaa -M 'plugins/check_nmon.pl' -a '-F /backup/nmon_log/srv_06_210128_0600.nmon -k CPU_ID -s User%,Sys%,Wait%,Idl'
UNKNOWN - NMON file backup older than an hour. NMON is stopped!
-
benjaminsmith
- Posts: 5324
- Joined: Wed Aug 22, 2018 4:39 pm
- Location: saint paul
Re: how to check server resource using check_nmon.pl
HI @sacom01,
So it's failing right away in the script where it checks the options if the log file is older than 1 hour.
There maybe a time issue here. I'm don't have a test AIX system here, but what does the time on the file read?
And what is the system time? Also, from the Nagos XI side, please test the plugin as the Nagios user account instead of root to rule out any variations there.
Lastly, check the file permission on the log file, it maybe that the nagios user account cannot read the file, and therefore that part of the plugin is failing. You can try to relax the permissions and test again.
--Benjamin
So it's failing right away in the script where it checks the options if the log file is older than 1 hour.
Code: Select all
if ((stat($options{'F'}))[9] + 3600 < time) {
print "UNKNOWN - NMON file $options{'F'} older than an hour. NMON is stopped!";
exit 3;
}
Code: Select all
stat /backup/nmon_log/srv_06_210128_0600.nmon
Code: Select all
date
--Benjamin
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: how to check server resource using check_nmon.pl
hi Ben,
thanks for you reply
The problem is : it work fine on local server but can not work with check_ncpa when i do check on the same time. And nmon file have been updated every 2 minutes bro.
ON LOCAL SERVER:
bash-4.3$ cd /backup/nmon_log/
bash-4.3$ ls -l | grep 210201
-rw-r--r-- 1 root system 914069 Feb 01 08:38 srv_210201_0600.nmon
bash-4.3$ date
Mon Feb 1 08:39:19 ICT 2021
bash-4.3$ cd /usr/local/ncpa/plugins/
bash-4.3$ ./check_nmon.pl -F /backup/nmon_log/srv_210201_0600.nmon -k CPU_ID -s User%,Sys%,Wait%,Idl
OK - All counters within specified thresholds
ON NAGIOS SRV :
[root@nagiosxi- libexec]# date
Mon Feb 1 08:42:20 +07 2021
[root@nagiosxi- libexec]# /usr/local/nagios/libexec/check_ncpa.py -H 192.168.xxx.xx -P 5693 -t mytoken -M 'plugins/check_nmon.pl' -a '-F /backup/nmon_log/srv_210201_0600.nmon -k CPU_ID -s User%,Sys%,Wait%,Idl'
UNKNOWN - NMON file backup older than an hour. NMON is stopped!
thanks for you reply
The problem is : it work fine on local server but can not work with check_ncpa when i do check on the same time. And nmon file have been updated every 2 minutes bro.
ON LOCAL SERVER:
bash-4.3$ cd /backup/nmon_log/
bash-4.3$ ls -l | grep 210201
-rw-r--r-- 1 root system 914069 Feb 01 08:38 srv_210201_0600.nmon
bash-4.3$ date
Mon Feb 1 08:39:19 ICT 2021
bash-4.3$ cd /usr/local/ncpa/plugins/
bash-4.3$ ./check_nmon.pl -F /backup/nmon_log/srv_210201_0600.nmon -k CPU_ID -s User%,Sys%,Wait%,Idl
OK - All counters within specified thresholds
ON NAGIOS SRV :
[root@nagiosxi- libexec]# date
Mon Feb 1 08:42:20 +07 2021
[root@nagiosxi- libexec]# /usr/local/nagios/libexec/check_ncpa.py -H 192.168.xxx.xx -P 5693 -t mytoken -M 'plugins/check_nmon.pl' -a '-F /backup/nmon_log/srv_210201_0600.nmon -k CPU_ID -s User%,Sys%,Wait%,Idl'
UNKNOWN - NMON file backup older than an hour. NMON is stopped!
-
benjaminsmith
- Posts: 5324
- Joined: Wed Aug 22, 2018 4:39 pm
- Location: saint paul
Re: how to check server resource using check_nmon.pl
Hi @sacom01
Hmmm. we think this is an issue with the path to the plugin not getting escaped properly or the permissions. Can you relax the permissions on permissions on this file temporarily for testing to rule that out as a factor?
While I don't have any AIX system, going to try run some tests with NCPA on the plugin arguments and follow up with you shortly.
Best Regards,
Benjamin
Hmmm. we think this is an issue with the path to the plugin not getting escaped properly or the permissions. Can you relax the permissions on permissions on this file temporarily for testing to rule that out as a factor?
While I don't have any AIX system, going to try run some tests with NCPA on the plugin arguments and follow up with you shortly.
Best Regards,
Benjamin
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: how to check server resource using check_nmon.pl
Try running this command with double quotes around the log file path and see if it works.
Code: Select all
/usr/local/nagios/libexec/check_ncpa.py -H 192.168.xxx.xx -P 5693 -t mytoken -M 'plugins/check_nmon.pl' -a '-F "/backup/nmon_log/srv_210201_0600.nmon" -k CPU_ID -s User%,Sys%,Wait%,Idl'Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: how to check server resource using check_nmon.pl
hi tgriep,
well, it work fine now with your suggest.
[root@dc-nagiosxi-uat01 libexec]# /usr/local/nagios/libexec/check_ncpa.py -H 192.168.xxx.xx -P 5693 -t mytoken -M 'plugins/check_nmon.pl' -a '-F "/backup/nmon_log/210203_0600.nmon" -k CPU_ID -s User%,Sys%,Wait%,Idl'
OK - All counters within specified thresholds |
Many thanks tgriep and ben.
well, it work fine now with your suggest.
[root@dc-nagiosxi-uat01 libexec]# /usr/local/nagios/libexec/check_ncpa.py -H 192.168.xxx.xx -P 5693 -t mytoken -M 'plugins/check_nmon.pl' -a '-F "/backup/nmon_log/210203_0600.nmon" -k CPU_ID -s User%,Sys%,Wait%,Idl'
OK - All counters within specified thresholds |
Many thanks tgriep and ben.
Re: how to check server resource using check_nmon.pl
hi bro,
i have try check on nagios xi, but no luck, i'm getting another error UNKNOWN - NMON file
Everyday we have 2 nmon files, so i want indicate file name is dynamic with $ARG3$
Note : i already tried with exact path : /backup/nmon_log/_210203_0600.nmon but not work as well.
pls help
i have try check on nagios xi, but no luck, i'm getting another error UNKNOWN - NMON file
Everyday we have 2 nmon files, so i want indicate file name is dynamic with $ARG3$
Note : i already tried with exact path : /backup/nmon_log/_210203_0600.nmon but not work as well.
pls help
You do not have the required permissions to view the files attached to this post.
Re: how to check server resource using check_nmon.pl
If you go to that folder does the file exist when the plugin runs?
Can you clarify what you mean by this?
"file name is dynamic"
Does the file name change periodically?
Sometimes when using the Run Check Command button, it adds extra escaping on special characters and cause the test to fail.
What you should do it to create the service check, save and apply it to the system and see if it runs in the Home > Service Status menu.
Another thing to do is to change the command to use $ARG3$ for all of the arguments you are sending the plugin and them put this in $ARG3$ after you edit it.
Can you clarify what you mean by this?
"file name is dynamic"
Does the file name change periodically?
Sometimes when using the Run Check Command button, it adds extra escaping on special characters and cause the test to fail.
What you should do it to create the service check, save and apply it to the system and see if it runs in the Home > Service Status menu.
Another thing to do is to change the command to use $ARG3$ for all of the arguments you are sending the plugin and them put this in $ARG3$ after you edit it.
Code: Select all
-a '-F "/backup/nmon_log/210203_0600.nmon" -k CPU_ID -s User%,Sys%,Wait%,Idl'Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: how to check server resource using check_nmon.pl
hi tgriep,
Does the file name change periodically? --> yes bro
The file name have structure like this : servername_yymmdd_hhmm.nmon
i want to use yymmdd as an argument. I have tried YYMMDD, yymmdd, %YYMMDD%, `date +%Y%m%d` on $ARG3$
but did not work as well
Does the file name change periodically? --> yes bro
The file name have structure like this : servername_yymmdd_hhmm.nmon
i want to use yymmdd as an argument. I have tried YYMMDD, yymmdd, %YYMMDD%, `date +%Y%m%d` on $ARG3$
but did not work as well
Re: how to check server resource using check_nmon.pl
First thing, because of the quotes, escaping, etc that the plugin is setup to use, sometimes it causes the Run Check Command button to fail as it adds extra escaping to the check.
There is not a way to change the name of the file on the fly but adding the $ARGx$ to the command should work if you use the alternate way to send arguments for the NCPA plugin.
Create the NCPA command like the following example.
Put in the name of the file in $ARG3$ and it should pass it on.
We do not have access to a server to test this but it should work.
There is not a way to change the name of the file on the fly but adding the $ARGx$ to the command should work if you use the alternate way to send arguments for the NCPA plugin.
Create the NCPA command like the following example.
Code: Select all
$USER1$/check_ncpa.py -H $HOSTADDRESS$ -P $ARG1$ -t $ARG2$ -M 'plugins/check_nmon.pl' -q "args=-F "/backup/mon_log/$ARG3$",args=-k 'CPU_ID',args=-s 'User%,Sys%,Wait%,Idl'"We do not have access to a server to test this but it should work.
Be sure to check out our Knowledgebase for helpful articles and solutions!