Age | Commit message (Collapse) | Author | Files | Lines |
|
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.
|
|
Print a useful error message if opening the configuration file fails.
|
|
Read the configuration file with privileges temporarily dropped if the
code is used by a setuid plugin.
|
|
Our die() function doesn't append a newline character to the message.
|
|
Replace an "if" with the ternary operator.
|
|
Add two path names to the list of default INI file locations, as some
users/distributions prefer to put configuration files into
subdirectories.
|
|
We might want to spit out a warning when NAGIOS_CONFIG_PATH is used.
While at it, move the function that handles this environment variable to
the bottom.
|
|
|
|
|
|
Change the indentation and formatting of the code in lib/parse_ini.c.
This breaks patches against that file and makes it harder to track its
history, but it (hopefully) improves readability a lot.
|
|
There's no need to cast malloc(3)'s return value.
|
|
The lib/parse_ini.c:np_get_defaults() function now dies if no
configuration file is found.
|
|
Read $MP_CONFIG_FILE if that variable is set in the environment.
|
|
Read "monitoring-plugins.ini" if that file exists, but fall back to
reading "plugins.ini" or "nagios-plugins.ini" for backward
compatibility.
|
|
Rewrite the code that looks up the INI configuration file path (used by
the Extra-Opts feature) in order to improve readability. The behaviour
should not have changed.
|
|
Signed-off-by: Davide Madrisan <davide.madrisan@gmail.com>
|
|
check_snmp becomes capable of evaluating negative values properly,
but it might be returning CRITICALs where it used to return OK and was ignored,
if a negative value turns out to actually be a valid value.
If negative values are valid, this can be worked around,
by adding "~:" to the warning/critical threshold : 100 -> ~:100
|
|
|
|
|
|
Also use strcasecmp imported from gnulib for simplicity
|
|
|
|
The change has also been updated in
https://www.monitoring-plugins.org/doc/state-retention.html
|
|
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.
|
|
|
|
Rename NAGIOS_PLUGIN_STATE_DIRECTORY to MP_STATE_DIRECTORY
|
|
|
|
1. libtab is now bundled, so suggest to enable it rather than install it
2. "parse-ini" feature has been called "extra-opts"
|
|
"Monitoring Plugins" is a name.
|
|
|
|
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.
|
|
|
|
The np_expect_match() function now returns one of three possible states
instead of just TRUE or FALSE:
- NP_MATCH_SUCCESS
- NP_MATCH_FAILURE
- NP_MATCH_RETRY
The NP_MATCH_RETRY state indicates that matching might succeed if
np_expect_match() is called with a longer input string. This allows
check_tcp to decide whether it makes sense to wait for additional data
from the server.
|
|
Replace the three boolean parameters of lib/utils_tcp.c's
np_expect_match() function with a single "flags" parameter.
|
|
Fix the issues found by GCC when the -Wimplicit-function-declaration
flag is specified.
|
|
Fix the issues found by GCC when the -Wuninitialized flag is specified.
|
|
|
|
|
|
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>
|
|
group (Bekar - #2973603)
Various values (dused_pct, dfree_pct, inodes_free, inodes_total, ...) are now carried in
the parameter_list structure. Assignments have been moved to a subroutine preventing
code redundancies.
Group metrics are now calculated based on units rather than blocks. This fixes freespace calculation
when blocksizes differ within a group.
|
|
Some commands need the environment to function properly. One such
example is check_ssh and check_by_ssh when a SOCKS proxy is required.
This patch use setenv and extern char **environ to alter and pass the
new environment to the child process Those modules have been added to
Gnulib for portability.
|
|
|
|
|
|
See http://nagiosplugin.org/c-api-private for more details on the API.
Also updated check_snmp -l option to change the perfdata label.
|
|
|
|
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>
|
|
This patch makes use of standard threshold functions. This allows using
doubles as thresholds.
Since SNMP supports only integers, double precision numbers are only
printed when parsed from a STRING type.
In addition, support for printing properly Timeticks type has been added,
and the code has been thoroughly cleaned.
|
|
Add a separator argument passed using defines.
|
|
The die tests are implemented in the test_*3.t files
|
|
|
|
|