Page 1 of 1

Nagios .state files showing up in /tmp directory

Posted: Fri Dec 12, 2014 2:56 pm
by brdr
Hi,

We are using Nagios XI 2014R2.0.

We are seeing hundreds of nagios files showing up in the /tmp directory.

-rw-r--r-- 1 nagios nagios 204 Dec 12 14:24 cwpjs_checkpage_172172388_auto__PageMap.state
-rw-r--r-- 1 nagios nagios 204 Dec 12 14:22 cwpjs_checkpage_172172389_auto__PageMap.state
-rw-r--r-- 1 nagios nagios 202 Dec 12 14:49 cwpss_checkcpu__1021250122___.state
-rw-r--r-- 1 nagios nagios 203 Dec 12 14:49 cwpss_checkcpu__1021250148___.state

Any idea as to why?

In the nagios.log I see entries like:

[1418413992] SERVICE ALERT: bed-940-74;CPU Usage;UNKNOWN;SOFT;1;Collecting first WMI sample because the previous state data file (/tmp/cwpss_checkcpu__172172219___.state) contained no data. Results will be shown the next time the plugin runs.

Will nagios clean these files up?

Thanks!

Re: Nagios .state files showing up in /tmp directory

Posted: Fri Dec 12, 2014 4:39 pm
by abrist
brdr wrote: Will nagios clean these files up?
Nagios will not, as these files are generated from the plugin. I am unsure if the plugin will clean them up or not. Can you post a link or the plugin script itself?

Re: Nagios .state files showing up in /tmp directory

Posted: Tue Dec 16, 2014 10:17 am
by brdr
The .state files are generated by the plugin check_wmi_plus.pl (Version 1.59).

Here is the detail around how/why the .state files are created. Some level of monitoring will be required but shouldn't be a challenge. Thanks abrist!

"
KEEPING STATE
This only applies to checks that need to perform 2 WMI queries to get a complete result eg checkcpu, checkio, checknetwork etc. Keeping State is used by default.

Checks like this take 2 samples of WMI values (with a DELAY in between) and then calculate a result by differencing the values. By default, the plugin will "keepstate", which means that 1 WMI sample will be collected each time the plugin runs and it will calculate the difference using the values from the previous plugin run. For something like checkcpu, this means that the plugin gives you an average CPU utilisation between runs of the plugin. Even if you are 0% utilisation each time the plugin runs but 100% in between, checkcpu will still report a very high utilisation percentage. This makes for a very accurate plugin result. Another benefit of keeping state is that it results in fewer WMI queries and the plugin runs faster. If you disable keeping state, then, for these types of checks, the plugin reverts to taking 2 WMI samples with a DELAY each time it runs and works out the result then and there. This means that, for example, any CPU activity that happens between plugin runs is never detected."

Re: Nagios .state files showing up in /tmp directory

Posted: Tue Dec 16, 2014 4:23 pm
by scottwilkerson
The plugin should clean up old files, keeping just how many it needs.

Re: Nagios .state files showing up in /tmp directory

Posted: Wed Dec 17, 2014 1:10 pm
by brdr
Good to know. Thanks.