Page 1 of 1

CPU Usage UNKNOWN

Posted: Wed Sep 02, 2015 5:09 am
by adminfun
Dear members

I have a problem with a particular service check.
UNKNOWN - Permission denied when trying to store the state data. Sometimes this happens if you have been testing the plugin from the command line as a different user to the Nagio process user. You will need to change the permissions on the file or remove

Other checks work just fine. Testing from the command line also works just fine.
I provided some screenshots in attachement.

Thank you in advance!

Re: CPU Usage UNKNOWN

Posted: Wed Sep 02, 2015 9:04 am
by hsmith
adminfun wrote:Dear members

I have a problem with a particular service check.
UNKNOWN - Permission denied when trying to store the state data. Sometimes this happens if you have been testing the plugin from the command line as a different user to the Nagio process user. You will need to change the permissions on the file or remove

Other checks work just fine. Testing from the command line also works just fine.
I provided some screenshots in attachement.

Thank you in advance!
Can you please post the output of a ls -l /usr/local/nagios/libexec command?

Re: CPU Usage UNKNOWN

Posted: Wed Sep 02, 2015 9:08 am
by lmiltchev
Did you follow the document below for setting up your Windows server?

https://assets.nagios.com/downloads/nag ... ios-XI.pdf

What are the permissions on the "/tmp" directory? Run the following commands and show the output:

Code: Select all

ll -d /tmp
ll /tmp/*.state
What is the version of the plugin that you are using?

Code: Select all

/usr/local/nagios/libexec/check_wmi_plus.pl --version
Do you get the expected output when you run the command as "nagios" user?

Code: Select all

su -l  nagios -c "/usr/local/nagios/libexec/check_wmi_plus.pl -H 10.20.1.224 -u <username> -p <password> -m checkcpu -w '80' -c '90'"

Re: CPU Usage UNKNOWN

Posted: Wed Sep 02, 2015 9:53 am
by adminfun
What are the permissions on the "/tmp" directory? Run the following commands and show the output:

ll -d /tmp
drwxrwxrwt. 4 root root 4096 Sep 2 16:41 /tmp

ll /tmp/*.state
-rw-r--r-- 1 nagios nagios 204 Sep 2 16:42 /tmp/cwpss_checkcpu_10201110___.state
-rw-r--r-- 1 nagios nagios 205 Sep 2 16:40 /tmp/cwpss_checkcpu_10201140___.state
-rw-r--r-- 1 nagios nagios 205 Sep 2 16:42 /tmp/cwpss_checkcpu_10201141___.state
-rw-r--r-- 1 nagios nagios 202 May 19 16:18 /tmp/cwpss_checkcpu_10201145___.state
-rw-r--r-- 1 nagios nagios 202 Sep 2 16:38 /tmp/cwpss_checkcpu_10201146___.state
-rw-r--r-- 1 nagios nagios 202 Sep 2 16:41 /tmp/cwpss_checkcpu_10201147___.state
-rw-r--r-- 1 nagios nagios 202 Sep 2 16:41 /tmp/cwpss_checkcpu_10201148___.state
-rw-r--r-- 1 nagios nagios 202 Sep 2 16:39 /tmp/cwpss_checkcpu_10201149___.state
-rw-r--r-- 1 nagios nagios 202 Sep 2 16:42 /tmp/cwpss_checkcpu_10201150___.state
-rw-r--r-- 1 nagios nagios 202 Sep 2 16:40 /tmp/cwpss_checkcpu_10201151___.state
-rw-r--r-- 1 nagios nagios 203 Sep 2 16:42 /tmp/cwpss_checkcpu_10201152___.state
-rw-r--r-- 1 nagios nagios 204 Sep 2 16:39 /tmp/cwpss_checkcpu_10201178___.state
-rw-r--r-- 1 nagios nagios 205 Sep 2 16:38 /tmp/cwpss_checkcpu_10201187___.state
-rw-r--r-- 1 nagios nagios 205 Sep 2 16:39 /tmp/cwpss_checkcpu_10201201___.state
-rw-r--r-- 1 apache apache 203 May 8 09:19 /tmp/cwpss_checkcpu_10201203___.state
-rw-r--r-- 1 nagios nagios 200 Sep 2 16:39 /tmp/cwpss_checkcpu_10201204___.state
-rw-r--r-- 1 nagios nagios 197 Sep 2 16:42 /tmp/cwpss_checkcpu_10201212___.state
-rw-r--r-- 1 nagios nagios 204 Sep 2 16:41 /tmp/cwpss_checkcpu_10201213___.state
-rw-r--r-- 1 nagios nagios 204 Sep 2 16:41 /tmp/cwpss_checkcpu_10201214___.state
-rw-r--r-- 1 nagios nagios 202 Sep 2 16:41 /tmp/cwpss_checkcpu_10201215___.state
-rw-r--r-- 1 nagios nagios 206 Sep 2 16:39 /tmp/cwpss_checkcpu_10201216___.state
-rw-r--r-- 1 nagios nagios 200 Sep 2 16:39 /tmp/cwpss_checkcpu_10201218___.state
-rw-r--r-- 1 nagios nagios 200 Sep 2 16:39 /tmp/cwpss_checkcpu_10201219___.state
-rw-r--r-- 1 nagios nagios 204 Sep 2 16:38 /tmp/cwpss_checkcpu_10201220___.state
-rw-r--r-- 1 nagios nagios 204 Sep 2 16:39 /tmp/cwpss_checkcpu_10201221___.state
-rw-r--r-- 1 nagios nagios 204 Sep 2 16:38 /tmp/cwpss_checkcpu_10201223___.state
-rw-r--r-- 1 apache apache 204 Sep 2 12:27 /tmp/cwpss_checkcpu_10201224___.state
-rw-r--r-- 1 nagios nagios 202 Sep 2 16:41 /tmp/cwpss_checkcpu_10201226___.state
-rw-r--r-- 1 nagios nagios 200 Sep 2 16:43 /tmp/cwpss_checkcpu_10201228___.state
-rw-r--r-- 1 nagios nagios 204 Sep 2 16:43 /tmp/cwpss_checkcpu_10201247___.state
-rw-r--r-- 1 nagios nagios 203 Sep 2 16:41 /tmp/cwpss_checkcpu_1020149___.state
-rw-r--r-- 1 nagios nagios 204 Sep 2 16:39 /tmp/cwpss_checkcpu_1020156___.state
-rw-r--r-- 1 nagios nagios 205 Sep 2 16:42 /tmp/cwpss_checkcpu_1020161___.state
-rw-r--r-- 1 nagios nagios 205 Sep 2 16:42 /tmp/cwpss_checkcpu_1020174___.state
-rw-r--r-- 1 nagios nagios 205 Sep 2 16:41 /tmp/cwpss_checkcpu_1020175___.state
-rw-r--r-- 1 nagios nagios 202 Sep 2 16:40 /tmp/cwpss_checkcpu_1020176___.state
-rw-r--r-- 1 nagios nagios 205 Sep 2 16:40 /tmp/cwpss_checkcpu_1020181___.state
-rw-r--r-- 1 nagios nagios 201 Sep 2 16:41 /tmp/cwpss_checkcpu_1020188___.state
-rw-r--r-- 1 nagios nagios 198 Sep 2 16:42 /tmp/cwpss_checkcpu_1020191___.state
-rw-r--r-- 1 nagios nagios 205 Sep 2 16:43 /tmp/cwpss_checkcpu_1020195___.state
-rw-r--r-- 1 nagios nagios 204 Sep 2 16:43 /tmp/cwpss_checkcpu_10271200___.state
-rw-r--r-- 1 nagios nagios 205 Sep 2 16:42 /tmp/cwpss_checkcpu_10272200___.state
-rw-r--r-- 1 nagios nagios 204 Sep 2 16:43 /tmp/cwpss_checkcpu_192168101200___.state
-rw-r--r-- 1 nagios nagios 205 Sep 2 16:42 /tmp/cwpss_checkcpu_192168102200___.state
-rw-r--r-- 1 nagios nagios 205 Sep 2 16:42 /tmp/cwpss_checkcpu_192168108200___.state
-rw-r--r-- 1 nagios nagios 205 Sep 2 16:43 /tmp/cwpss_checkcpu_192168109200___.state
-rw-r--r-- 1 nagios nagios 205 Sep 2 16:39 /tmp/cwpss_checkcpu_192168110200___.state
-rw-r--r-- 1 nagios nagios 205 Sep 2 16:41 /tmp/cwpss_checkcpu_19216811200___.state
-rw-r--r-- 1 nagios nagios 204 Sep 2 16:42 /tmp/cwpss_checkcpu_192168112200___.state
-rw-r--r-- 1 nagios nagios 205 Sep 2 16:39 /tmp/cwpss_checkcpu_192168113200___.state
-rw-r--r-- 1 nagios nagios 205 Sep 2 16:43 /tmp/cwpss_checkcpu_192168114200___.state
-rw-r--r-- 1 nagios nagios 204 Sep 2 16:41 /tmp/cwpss_checkcpu_192168115200___.state
-rw-r--r-- 1 nagios nagios 204 Sep 2 16:41 /tmp/cwpss_checkcpu_192168117200___.state
-rw-r--r-- 1 nagios nagios 205 Sep 2 16:43 /tmp/cwpss_checkcpu_192168118200___.state
-rw-r--r-- 1 nagios nagios 205 Sep 2 16:43 /tmp/cwpss_checkcpu_192168122200___.state
-rw-r--r-- 1 nagios nagios 205 Sep 2 16:42 /tmp/cwpss_checkcpu_192168123200___.state
-rw-r--r-- 1 nagios nagios 203 Sep 2 16:42 /tmp/cwpss_checkcpu_192168131101___.state
-rw-r--r-- 1 nagios nagios 203 Sep 2 16:42 /tmp/cwpss_checkcpu_19216813197___.state
-rw-r--r-- 1 nagios nagios 205 Sep 2 16:43 /tmp/cwpss_checkcpu_192168135200___.state
-rw-r--r-- 1 nagios nagios 205 Sep 2 16:39 /tmp/cwpss_checkcpu_19216814200___.state
-rw-r--r-- 1 nagios nagios 205 Sep 2 16:42 /tmp/cwpss_checkcpu_19216815200___.state
-rw-r--r-- 1 nagios nagios 205 Sep 2 16:41 /tmp/cwpss_checkcpu_19216816200___.state
-rw-r--r-- 1 nagios nagios 205 Sep 2 16:43 /tmp/cwpss_checkcpu_192168201200___.state
-rw-r--r-- 1 nagios nagios 204 Sep 2 16:40 /tmp/cwpss_checkcpu_19216823200___.state
-rw-r--r-- 1 nagios nagios 205 Sep 2 16:41 /tmp/cwpss_checkcpu_19216836200___.state
-rw-r--r-- 1 nagios nagios 205 Sep 2 16:43 /tmp/cwpss_checkcpu_19216838200___.state
-rw-r--r-- 1 nagios nagios 205 Sep 2 16:42 /tmp/cwpss_checkcpu_19216839200___.state
-rw-r--r-- 1 nagios nagios 205 Sep 2 16:41 /tmp/cwpss_checkcpu_1921684200___.state
-rw-r--r-- 1 nagios nagios 205 Sep 2 16:42 /tmp/cwpss_checkcpu_19216847200___.state
-rw-r--r-- 1 nagios nagios 205 Sep 2 16:41 /tmp/cwpss_checkcpu_19216851200___.state
-rw-r--r-- 1 nagios nagios 205 Sep 2 16:39 /tmp/cwpss_checkcpu_19216867200___.state
-rw-r--r-- 1 nagios nagios 204 Sep 2 16:42 /tmp/cwpss_checkcpu_1929200200___.state

What is the version of the plugin that you are using?

/usr/local/nagios/libexec/check_wmi_plus.pl --version
Version: 1.49

Do you get the expected output when you run the command as "nagios" user?

su -l nagios -c "/usr/local/nagios/libexec/check_wmi_plus.pl -H 10.20.1.224 -u <username> -p <password> -m checkcpu -w '80' -c '90'"
No, I receive the same error as posted before.
UNKNOWN - Permission denied when trying to store the state data. Sometimes this happens if you have been testing the plugin from the command line as a different user to the Nagio process user. You will need to change the permissions on the file or remove it. The actual error text is: can't create /tmp/cwpss_checkcpu_10201224___.state: Permission denied at ./check_wmi_plus.pl line 1710

I have to say, checking the CPU on a different server does work with the Nagios user.
[nagios@localhost libexec]$ ./check_wmi_plus.pl -H 10.20.1.223 -u <user> -p <password> -m checkcpu -w 80 -c 90
OK (Sample Period 271 sec) - Average CPU Utilisation 18.42%|'Avg CPU Utilisation'=18.42%;80;90;

Re: CPU Usage UNKNOWN

Posted: Wed Sep 02, 2015 9:56 am
by jdalrymple
This is because you "tested" the check from CCM using the test command button which created the state file with the Apache user, then when the Nagios process tried to run the check it failed because it didn't own the state file.

Or... vice versa.

Easiest solution, `rm -f /tmp/cwpss*`

All WMI checks relying on a state file will then fail once, but work after that. DO NOT use the test command button in CCM.

Re: CPU Usage UNKNOWN

Posted: Thu Sep 03, 2015 2:26 am
by adminfun
Dear jdalrymple

Removing al the cwpss-files fixed the problem.
Thanks you very much for the support!

Re: CPU Usage UNKNOWN

Posted: Thu Sep 03, 2015 9:04 am
by hsmith
adminfun wrote:Dear jdalrymple

Removing al the cwpss-files fixed the problem.
Thanks you very much for the support!
Awesome, I am going to close this one out. Please post if you run into anything else!

Thanks.