Commit graph

119 commits

Author SHA1 Message Date
Lorenz Kästle
e04d2ec8c6 check_swap: Fixes on NetBSD 2025-03-17 12:58:12 +01:00
Lorenz Kästle
72fd885f4f Transform output format to a global state
This commit removes the format parameter from the mp_check
object and creates a module global variable instead.
This prevents thread safe usage of different mp_check objects
which should likely not present a big problem for now.
The reason for this change is effectively the very same,
the format was lost if an exit was triggered by a signal
handler (timeout in this example).
2025-03-07 23:38:50 +01:00
Lorenz Kästle
07873c765b Place output-format help string with the other common ones 2025-02-20 23:49:22 +01:00
Lorenz Kästle
3cd29d86cc Remove output formats one-line and summary-only 2025-02-20 23:45:13 +01:00
Lorenz Kästle
5acd14fcfb Implement new output functionality for check_swap 2025-02-18 21:58:59 +01:00
Lorenz Kästle
152cdcf3e4 check_swap: change threshold handling again 2024-11-10 10:42:17 +01:00
Lorenz Kästle
9679551b20 check_swap: stricter error handling 2024-11-10 10:37:19 +01:00
Lorenz Kästle
651925dffc check_swap: Make check_swap work without thresholds 2024-11-10 01:58:41 +01:00
Lorenz Kästle
14342ac87a check_swap: Small improvements 2024-11-10 00:19:03 +01:00
Lorenz Kästle
ed01d53447 Small fixes to check_swap stuff 2024-11-02 13:53:33 +01:00
Lorenz Kästle
3faeed07c4 Merge branch 'master' into check_swap_again 2024-11-02 13:37:39 +01:00
Napsty
9b4fab0664 Allow single threshold 2024-04-12 16:50:15 +02:00
Napsty
ee0f70486f Possibility to run check_swap without thresholds 2024-04-12 16:50:15 +02:00
Lorenz Kästle
8698a6d976
check_swap: replace another fake boolen and small improvements (#1996)
* check_swap: Change another fake boolen to a real one

* check_swap: Rename type since *_t is reserved for C standard types

* check_swap: Update copyright
2024-03-23 11:22:06 +01:00
RincewindsHat
2dec5182c5 check_swap: refactor to improve readability 2023-12-20 10:02:47 +01:00
RincewindsHat
2289d094ae check_swap: Hopefully fix stuff on BSD 2023-12-20 10:02:47 +01:00
RincewindsHat
6011cdf554 check_swap: hopefully fix SRV4 stuff 2023-12-20 10:02:47 +01:00
RincewindsHat
8cdcb1a8ad Update copyright 2023-12-20 10:02:47 +01:00
RincewindsHat
06c3393963 check_swap: clang-format + minor cosmetics/debugging/etc 2023-12-20 10:02:47 +01:00
RincewindsHat
22a423ad5d check_swap: Return byte number (in linux) and simplify code after that 2023-12-20 10:02:47 +01:00
RincewindsHat
3a10773c09 check_swap: Heavily refactored linux part 2023-12-20 10:02:47 +01:00
RincewindsHat
b32d7421ee check_swap: Rename type since *_t is reserved for C standard types 2023-12-20 10:02:47 +01:00
RincewindsHat
42f5f16578 check_swap: Change another fake boolen to a real one 2023-12-20 10:02:47 +01:00
RincewindsHat
0722dbfb8a check_swap: Use C99 booleans 2023-10-18 20:58:18 +02:00
Lorenz Kästle
a359667f2b Changing remaining sscanf format specifier to unsigned long 2023-04-26 18:19:23 +02:00
Jan Wagner
0f3703e641 Fix a lot of typos reported by codespell 2023-04-14 18:35:00 +00:00
RincewindsHat
8a8ee58e89 check_swap: Remove unnecessary and problematic includes 2023-03-16 15:26:52 +01:00
Lorenz
fbbc9fcbd5
Check swap compiler warnings (#1756)
* Fix compiler warnings

* Fix superfluous whitespaces
2022-09-11 06:29:17 +02:00
Lorenz
3ad5fe9d84
check_swap: Fix unit for total in perfdata (#1779)
* check_swap: Fix unit for total in perfdata

* Remove trailing whitespaces
2022-07-25 10:11:43 +02:00
Sven Nierlein
a01de7b33d
fix parsing swap values (#1780)
tmp_KB changed from float to uint64, so change the sscanf format accordingly.
2022-07-25 10:00:18 +02:00
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