I am having trouble pulling process/cpu information for a specific process. On our Linux server we have two processes that have the same name but use different arguments. We are using the check_snmp_process_wizard.pl plug-in/script and the following syntax to identify each process:
./check_snmp_process_wizard.pl -H 192.168.2.101 --v2c -C Public -f -A -n '/opt/test/bin/check/test/test -l /opt/test/bin/test/config -c test.xml' -u 195,200
This works great for up/down and memory usage but returns No data for CPU (1 lines(s)):UNKNOWN when using the CPU check.
I tried editing the my $delta_of_time_to_make_average in the script but it doesn't seem to make a difference. Is there any way to obtain CPU data for a process this way?
SNMP Process/CPU Check Error
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: SNMP Process/CPU Check Error
This plugin is going to store some information in /tmp/tmp_Nagios_proc.*
It needs to run for several times (exactly the same command) before it can make the calculation., if it cannot it will return the (1 lines(s)):UNKNOWN you describe.
On the second run you should see
(2 lines(s)):UNKNOWN
You should be able to open the /tmp/tmp_Nagios_proc.* files and see the data it has collected.
Once you have several data points and the delta has been reached you should get the cpu percentage.
As I mentioned before, the command must be exactly the same or it will change the tmp filename and it will start over
It needs to run for several times (exactly the same command) before it can make the calculation., if it cannot it will return the (1 lines(s)):UNKNOWN you describe.
On the second run you should see
(2 lines(s)):UNKNOWN
You should be able to open the /tmp/tmp_Nagios_proc.* files and see the data it has collected.
Once you have several data points and the delta has been reached you should get the cpu percentage.
As I mentioned before, the command must be exactly the same or it will change the tmp filename and it will start over
Re: SNMP Process/CPU Check Error
Thanks for your help. I was able to narrorw it down to the $o_desc variable in the script/plug-in. It couldn't write the file as the arguments used to define the service were outside the range for what a file could be named. I modified the script, editited the command.cfg and it now writes the file and produces the correct result.