Commit graph

89 commits

Author SHA1 Message Date
Lorenz Kästle
d496d6523b Rename tmp variable to get even with master 2022-01-03 14:07:54 +01:00
Lorenz
2714df42fd
Merge branch 'master' into master 2022-01-03 13:48:39 +01:00
RincewindsHat
d28bab4dbd More wrong printf formatting 2021-11-24 19:02:17 +01:00
RincewindsHat
e2f24a5af3 Fix CodeQL checks 2021-11-24 14:25:42 +01:00
RincewindsHat
ee3449dee7 Small fix to threshold validation and style (indentation) fixes 2021-11-19 00:34:44 +01:00
RincewindsHat
46c5327e34 Revert to poor man's logic 2021-10-02 23:37:12 +02:00
RincewindsHat
d2f2da175e Change all to comments to old comment style 2021-10-02 12:47:50 +02:00
RincewindsHat
f55ea7632f Fix comparing logic 2021-09-26 01:34:45 +02:00
rincewind
4621427ba8 check_swap: Fix perfdata und thresholds for big values and simplify code
The original problem was https://github.com/monitoring-plugins/monitoring-plugins/pull/1705
where the performance data output of check_swap did not conform to
the parser logic of a monitoring system (which decided to go for
"correct" SI or IEC units.
The PR was accompanied by a change to byte values in the performance
data which broke the _perfdata_ helper function which could not handle
values of this size.
The fix for this, was to use _fperfdata_ which could, but would
use float values.

I didn't like that (since all values here are discreet) and this
is my proposal for a fix for the problem.

It introduces some helper functions which do now explicitely work
with (u)int64_t, including a special version of the _perfdata_ helper.

In the process of introducing this to check_swap, I stumbled over
several sections of the check_swap code which I found problematic.
Therefore I tried to simplify the code and make it more readable
and less redundant.

I am kinda sorry about this, but sincerely hope my changes can
be helpful.
2021-09-25 23:24:45 +02:00
mdavranche
11af74de38 check_swap: Handle cached swap 2020-08-18 15:37:38 -04:00
Christopher Odenbach
6995b51075 repaired "-n" behaviour. If run with "-n ok" a host which ran
completely out of swap space would return "ok" which is
not desired. It should only return "ok" if there is no
swap space configured at all.
2017-05-31 14:15:47 +02:00
Sven Nierlein
edca257e20 use unknown exit code for help/version in plugins
Signed-off-by: Sven Nierlein <sven@nierlein.de>
2015-10-04 19:24:30 +02:00
Jan Wagner
40c870ed3a Improving output when swap space has zero size 2014-10-19 23:24:12 +02:00
Davide Madrisan
bd56c4a2d0 check_swap - fix comment
Signed-off-by: Davide Madrisan <davide.madrisan@gmail.com>
2014-10-19 14:54:57 +02:00
Davide Madrisan
ac438ccfe5 check_swap: Fix the plugin name that appears in the comment
Signed-off-by: Davide Madrisan <davide.madrisan@gmail.com>
2014-02-20 15:52:56 +01:00
Thomas Guyot-Sionnest
813c02364f Update check_swap usage 2014-01-29 03:59:48 -05:00
Thomas Guyot-Sionnest
7afbca0b8c check_swap: add supports for a configurable state when there is no swap
Check_swap used to allow no swap when thresholds were only specified in
percent. This is no longer the case and the state now must be specified
explicitly. The default is to always return CRITICAL when the swap is
absent regardless of thresholds.
2014-01-29 03:40:11 -05:00
Thomas Guyot-Sionnest
6f2d545244 Fix check_swap returning OK on & thresholds and no swap
Return 0% free instead of 100% free when total swap is 0
2014-01-29 01:44:22 -05:00
Holger Weiss
c3e756a855 Capitalize "Monitoring" when it's the first word 2014-01-20 03:12:50 +01:00
Monitoring Plugins Development Team
63734f52ab Project rename initial commit.
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.
2014-01-19 14:18:47 -05:00
Anders Kaseorg
028d50d6f9 Die when asprintf fails
Fixes many instances of
warning: ignoring return value of 'asprintf', declared with attribute warn_unused_result [-Wunused-result]

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2012-06-29 13:39:11 +02:00
Thomas Guyot-Sionnest
eaf3cb27f4 Add newline after "Usage:" in --help 2010-04-22 08:57:14 -04:00
Thomas Guyot-Sionnest
884aee0667 Standardize the extra-opts notes 2010-04-21 23:29:18 -04:00
Thomas Guyot-Sionnest
25d1ee331d Fix translations when extra-opts aren't enabled
Bug #2832884 reported problem with translations outputting pot file
headers. This is caused by "" matching the header of the translation
files.

This patch moves gettext macros inside utils macros and update some
french translations.
2010-04-14 08:33:06 -04:00
Thomas Guyot-Sionnest
6fbd14fea5 Removing CVS/SVN tags and replacing with git-based versioning
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-23 05:38:47 +00:00
Thomas Guyot-Sionnest
caa8bd6423 Bulk EOL cleanup
$ 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-11-19 06:45:18 +00:00
Thomas Guyot-Sionnest
44f8455b2c Added support for --extra-opts in all C plugins (disabled by default, see configure --help)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1991 f882894a-f735-0410-b71e-b25c423dba1c
2008-05-07 10:02:42 +00:00
Thomas Guyot-Sionnest
ed62784a0b --help output cleanup (plus removal of spaces on blank lines)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1984 f882894a-f735-0410-b71e-b25c423dba1c
2008-04-27 14:35:26 +00:00
Thomas Guyot-Sionnest
6c4468a728 Bump plugin/ to GPLv3 (check_overcr to check_users)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1917 f882894a-f735-0410-b71e-b25c423dba1c
2008-01-31 10:44:26 +00:00
Thomas Guyot-Sionnest
2af978187c Plenty of french translations (and a few fixes BTW)
- No more fuzzy french translations
 - Only (!) 355 strings to translate


git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1859 f882894a-f735-0410-b71e-b25c423dba1c
2007-12-10 07:52:00 +00:00
Holger Weiss
c391272975 Include <sys/param.h> before <sys/swap.h> in order to fix compilation on
OpenBSD (nsturm - 1653934)


git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1613 f882894a-f735-0410-b71e-b25c423dba1c
2007-02-07 14:06:11 +00:00
Holger Weiss
fd329a1e91 Don't try to print `optarg' (which will be a NULL pointer) if an unknown
command line option was used, as this leads to a segfault on some
systems.  The unknown option will be printed by getopt(3) anyway.  So,
simply call print_usage() and exit UNKNOWN via the new usage5() instead.


git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1590 f882894a-f735-0410-b71e-b25c423dba1c
2007-01-28 21:46:41 +00:00
Ton Voon
df3662bf3a Fix coredump on 64bit Solaris. Also adds more error conditions and moves
swap specific includes out of common.h (Duncan Ferguson - 1588031)


git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1546 f882894a-f735-0410-b71e-b25c423dba1c
2006-12-07 16:07:42 +00:00
Benoit Mortier
d8ecf6bfc2 another round of localization cleaning
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1509 f882894a-f735-0410-b71e-b25c423dba1c
2006-10-19 23:53:28 +00:00
M. Sean Finney
edf94c7d2a fix for (tracker id 1420741)
"check_swap: incorrect totals for multiple partitions (BSD)"
thanks to scott thompson


git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1323 f882894a-f735-0410-b71e-b25c423dba1c
2006-03-13 17:59:23 +00:00
Ton Voon
3887355958 Problem where absolute thresholds not working on /proc/meminfo
systems. Suffixed all variables with the unit of measurement


git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1278 f882894a-f735-0410-b71e-b25c423dba1c
2005-11-09 16:37:55 +00:00
M. Sean Finney
3038819fef code cleanups, largely resulting from turning on -Wall. mostly
unused variables and explicit casting issues, but there were a
couple gotchas in there too.


git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1267 f882894a-f735-0410-b71e-b25c423dba1c
2005-10-31 20:03:19 +00:00
Ton Voon
79e5b12d89 - Cleanup minor compile errors on Irix
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1222 f882894a-f735-0410-b71e-b25c423dba1c
2005-09-15 08:27:58 +00:00
Ton Voon
9ea5f808f6 Updated help file to remove swap -s reference (Sivakumar Nellurandi)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1200 f882894a-f735-0410-b71e-b25c423dba1c
2005-07-06 22:10:04 +00:00
M. Sean Finney
49b7afb027 divide by 0 fix for check_swap
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1196 f882894a-f735-0410-b71e-b25c423dba1c
2005-06-29 01:04:10 +00:00
M. Sean Finney
d4c0948266 scanf parsing fix for check_swap from tracker id 1123292. now use floor(3)
to round down floating point numbers.  requires -lm on many systems,
so support for testing for this was added to the configure.in and
automake template


git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1194 f882894a-f735-0410-b71e-b25c423dba1c
2005-06-28 00:26:53 +00:00
M. Sean Finney
d92fac77cc "asprintf madness" fix from andreas' patch to np-d, minus the comments.
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1190 f882894a-f735-0410-b71e-b25c423dba1c
2005-06-26 01:23:47 +00:00
Ton Voon
311ee9e792 Fixed parsing of AIX lsps command (1093522)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1084 f882894a-f735-0410-b71e-b25c423dba1c
2005-01-19 21:14:47 +00:00
Ton Voon
d866b45fdd Use floats for holding memory values to avoid different types on different
OSes. Seems to have a problem with the perf data for check_swap on Sol 2.6,
but not critical


git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1080 f882894a-f735-0410-b71e-b25c423dba1c
2005-01-13 18:24:52 +00:00
Benoit Mortier
7df9bd7bab more internationalization fixes
internationalization freeze for beta1


git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1067 f882894a-f735-0410-b71e-b25c423dba1c
2004-12-30 00:41:41 +00:00
Benoit Mortier
e9ccc6b21a various fixes for localization
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1061 f882894a-f735-0410-b71e-b25c423dba1c
2004-12-25 23:17:46 +00:00
Benoit Mortier
2ab4d8fc27 fix patch 998291
fix patch 1078934 expect check_ssh fix and check_nt perfdata should stay
on one word like in nagios


git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1004 f882894a-f735-0410-b71e-b25c423dba1c
2004-12-05 00:54:09 +00:00
Benoit Mortier
81bee45f6e internationalization fixes
bugfixes


git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1001 f882894a-f735-0410-b71e-b25c423dba1c
2004-12-04 12:12:30 +00:00
Benoit Mortier
b467ed427c Bug Fix [ 1024735 ] check_swap providing inaccurate swap information on Sol6
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@999 f882894a-f735-0410-b71e-b25c423dba1c
2004-12-04 00:23:41 +00:00
Benoit Mortier
30a4266a3a reverting my changes from !=TRUE to == ERROR, that's not good ;-( sorry
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@998 f882894a-f735-0410-b71e-b25c423dba1c
2004-12-03 23:55:29 +00:00