local storage for plugins

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
sejtam
Posts: 2
Joined: Fri Feb 27, 2015 8:58 pm

local storage for plugins

Post by sejtam »

I want to develop a plugin which detects changes in (some) of a command's output.

For this of course the plugin needs to remember the previous (one or more) results.

Is there a convention where a plugin should store such info?
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: local storage for plugins

Post by Box293 »

A lot of plugins use files in /tmp/

However for those operating systems that dump /tmp/ on a reboot, /var/tmp/ is a better location.

It all depends on how easy or complicated you want to make things.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
sejtam
Posts: 2
Joined: Fri Feb 27, 2015 8:58 pm

Re: local storage for plugins

Post by sejtam »

Ok. I had played with the thought of using /var/spool or such...
/var/tmp is really for temp files, which are not intended to survive across
calls to the same program, so I consider that less of an option...
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: local storage for plugins

Post by jdalrymple »

Certainly a matter of not only your preference but the reason for the output. If it is simply to measure a rate of change then /tmp should be fine as it will only take 1 iteration of the check to rebase the local storage location. In situations where you're watching for changes that should never occur though you are right, a custom location under var would be more appropriate. There are no documented best practices, feel free to choose the location that suits you and your application best.
Locked