Nagios .state files showing up in /tmp directory

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
brdr
Posts: 312
Joined: Mon Jun 02, 2014 12:49 pm

Nagios .state files showing up in /tmp directory

Post 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!
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

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

Post 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?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
brdr
Posts: 312
Joined: Mon Jun 02, 2014 12:49 pm

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

Post 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."
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

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

Post by scottwilkerson »

The plugin should clean up old files, keeping just how many it needs.
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
brdr
Posts: 312
Joined: Mon Jun 02, 2014 12:49 pm

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

Post by brdr »

Good to know. Thanks.
Locked