summaryrefslogtreecommitdiffstats
path: root/lib/utils_base.c
AgeCommit message (Collapse)AuthorFilesLines
2014-06-21Add UID to state retention file pathHolger Weiss1-1/+3
Add the UID of the invoking user to the state retention file path. This helps solving permission issues when different users run the same plugin.
2014-01-29Move negate' translate_state() to utils_base.h mp_translate_state()Thomas Guyot-Sionnest1-0/+17
Also use strcasecmp imported from gnulib for simplicity
2014-01-27Rename MP_STATE_DIRECTORY to MP_STATE_PATHThomas Guyot-Sionnest1-2/+2
2014-01-27And release notes for previous change (MP_STATE_DIRECTORY)Thomas Guyot-Sionnest1-1/+0
The change has also been updated in https://www.monitoring-plugins.org/doc/state-retention.html
2014-01-25Ignore MP_STATE_DIRECTORY in suid pluginsThomas Guyot-Sionnest1-8/+14
If a plugin still has suid privileges at the time np_enable_state() is called, the MP_STATE_DIRECTORY environment will be ignored. There is no need for a NEWS entry as no suid plugins use np_enable_state yet.
2014-01-25Rename ENV variable, keep backward compatibilityThomas Guyot-Sionnest1-0/+6
Rename NAGIOS_PLUGIN_STATE_DIRECTORY to MP_STATE_DIRECTORY
2014-01-19Project rename initial commit.Monitoring Plugins Development Team1-50/+50
This is an initial take at renaming the project to Monitoring Plugins. It's not expected to be fully complete, and it is expected to break things (The perl module for instance). More testing will be required before this goes mainline.
2013-09-10Fix GCC's -Wimplicit-function-declaration warningsHolger Weiss1-0/+3
Fix the issues found by GCC when the -Wimplicit-function-declaration flag is specified.
2013-08-20added missing header to fix build on freebsdSven Nierlein1-0/+1
2012-11-03lib/utils_base.c: Stop dumping core on bad args to check_snmpAndreas Ericsson1-8/+8
Since the state patch introduction, we've been freeing uninitialized memory in lib/utils_base.c::np_cleanup(), which caused coredumps with check_snmp when illegal threshold ranges (for example) were passed, or when we called 'die' without having read any state. This patch fixes it by replacing the malloc() calls in there (all of them, since using malloc() is almost always an error) with calloc(). malloc() either doesn't initialize the memory at all, or taints it with a special marker so it can tell us when we're free()'ing memory that hasn't been initialized. calloc() explicitly initializes the allocated memory to nul bytes, which is a zero-cost operation when we get the memory from the kernel (which alread does that) and almost always desirable everywhere else. Signed-off-by: Andreas Ericsson <ae@op5.se>
2010-06-24Cleanup some warnings displayed from IRIX tinderbox serverTon Voon1-4/+1
2010-06-23Added state retention APIs. Implemented for check_snmp with --rate option.Ton Voon1-1/+353
See http://nagiosplugin.org/c-api-private for more details on the API. Also updated check_snmp -l option to change the perfdata label.
2009-06-01Fix the memory allocation for the thresholds dataHolger Weiss1-1/+3
Allocate the appropriate amount of memory for storing the thresholds data. Before, we allocated the amount of memory required for storing a _pointer_ to the thresholds data. This crashed (at least) check_mysql when using its "-S" option on FreeBSD/amd64 (as reported and analyzed by Nikita Kalabukhov - 2797757). Signed-off-by: Holger Weiss <holger@zedat.fu-berlin.de>
2009-01-26Make extract_value more generic:Thomas Guyot-Sionnest1-3/+3
Add a separator argument passed using defines.
2009-01-21Move check_ntp's extract_value to utils_base.c.Thomas Guyot-Sionnest1-0/+57
This function can also be used to parse performance data strings which could be useful in the future.
2008-11-23Removing CVS/SVN tags and replacing with git-based versioningThomas Guyot-Sionnest1-3/+0
For contrib/, full tags have been imported from subversion git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@2091 f882894a-f735-0410-b71e-b25c423dba1c
2008-11-19Bulk EOL cleanupThomas Guyot-Sionnest1-2/+2
$ git diff --ignore-space-change|diffstat 0 files changed git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@2087 f882894a-f735-0410-b71e-b25c423dba1c
2008-03-11Fixed link -m64 problems on pst3 for solaris. Fixed _FILE_OFFSET_BITSTon Voon1-1/+1
redefinition warnings. Fixed helper ar error in ./configure git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1938 f882894a-f735-0410-b71e-b25c423dba1c
2008-02-13set_thresholds now let the user free the thresolds. (P.S.: When you set ↵Thomas Guyot-Sionnest1-4/+0
twice the thresholds for a path in check disk (like using -C followed by -p ) it overrides them. All new elements are created with np_add_parameter which initialises the thresholds to NULL.) git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1930 f882894a-f735-0410-b71e-b25c423dba1c
2008-01-30Bump /lib to GPLv3Thomas Guyot-Sionnest1-12/+27
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1913 f882894a-f735-0410-b71e-b25c423dba1c
2007-07-29Don't use C++ style comments.Holger Weiss1-1/+1
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1768 f882894a-f735-0410-b71e-b25c423dba1c
2007-05-27added functions to utils_base:M. Sean Finney1-0/+15
np_check_if_root() - returns nonzero if geteuid()==0 np_warn_if_not_root() - uses the above to print an informative warning added uses of these functions to check_dhcp and check_icmp. git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1718 f882894a-f735-0410-b71e-b25c423dba1c
2007-01-27Change the variable names `true' and `false' (which are keywords in C99)Holger Weiss1-11/+11
to `yes' and `no'. Fixes compilation when using SGI's MIPSpro c99(1). git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1588 f882894a-f735-0410-b71e-b25c423dba1c
2006-10-18Cater for different errors when setting thresholdsTon Voon1-4/+8
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1496 f882894a-f735-0410-b71e-b25c423dba1c
2006-07-14Missing header filesTon Voon1-0/+1
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1454 f882894a-f735-0410-b71e-b25c423dba1c
2006-07-13Major fixes to check_disk. Now should return same data as dfTon Voon1-0/+225
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1452 f882894a-f735-0410-b71e-b25c423dba1c