[Nagiosplug-devel] Please can I have GIT access - PATCH ATTACHED
Alain Williams
addw at phcomp.co.uk
Wed Sep 9 22:47:43 CEST 2009
Well, I started this thread and what I heard was:
the basic patch that I made to check_procs although:
1) it was a bit big.
2) it saved state in files. This led to a long discussion where it was thought
that the ability to save state would be nice but via a generalised API that
also allowed the possibility of saving to something else.
There not much that I can do about (1), although most of the new code was in
new functions at the bottom of the codeand is associated with save/restore of state.
About (2). I have written an API that, I think, meets the requirement.
It is implemented using files but the API makes no reference to files so a different
mechanism could be plugged in.
This is implemented in:
lib/state_save.c
lib/state_save.h
This provides the simple functions:
int np_state_save_serial(const char* name, const char* instance, int version, const char* serial);
that may be used to save state, resored with:
char* np_state_restore_serial(const char* name, const char* instance, int version);
There are other functions that may be more convenient for C programmers.
These allow storing/restoring of typed strings (ie record types) and others
that save/restore binary C structures.
The files have a header where the date is kept and comments inserted.
I have modified the check_procs plugin to use this mechanism so that you can see it working.
The functions are exercised in a test program:
config_test/plugin_save_test.c
This provides examples as to how the functions are intended to be used.
Finally it is all documented:
doc/state_file.txt
The patch is against nagios-plugins-trunk-200909091200.
I am content to give copyright to the new code and documentation that I have written,
or code and documentation derived from it, to the Nagios Plugins Development Team on condition:
1) that I may freely use this code, or parts of it, elsewhere under any license and title
that I choose.
2) that the code that I give shall not be distributed under a license that is not open
source according to:
http://opensource.org/docs/osd
3) That my authorship remain in the source files.
Having said that: enjoy!
--
Alain Williams
Linux/GNU Consultant - Mail systems, Web sites, Networking, Programmer, IT Lecturer.
+44 (0) 787 668 0256 http://www.phcomp.co.uk/
Parliament Hill Computers Ltd. Registration Information: http://www.phcomp.co.uk/contact.php
Past chairman of UKUUG: http://www.ukuug.org/
#include <std_disclaimer.h>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nagios-plugins-trunk-200909091200.patch.gz
Type: application/x-gzip
Size: 20793 bytes
Desc: not available
URL: <https://www.monitoring-plugins.org/archive/devel/attachments/20090909/5ef54342/attachment.bin>
More information about the Devel
mailing list