Commit graph

229 commits

Author SHA1 Message Date
RincewindsHat
513929d796 Remove check for RETSIGTYPE in autoconf stuff
autoupdate tells me, that since C89 I can safely assume RETSIGTYPE
is void.

Therefore to simplify things I removed the corresponding configure.ac
line and replaced all mentions of RETSIGTYPE with void.
2023-09-23 12:31:33 +02:00
Lorenz Kästle
719e27ddc2
Merge pull request #1924 from RincewindsHat/compiler_warnings_4_1
Centralise and refactor maxfd related functionality
2023-09-23 10:47:01 +02:00
RincewindsHat
4295decfbf open_max is a library function now, it should be mp_open_max 2023-09-23 10:33:06 +02:00
RincewindsHat
a3029c5a2e Place _cmd_pids in object not header to avoid unsused variables 2023-09-22 15:28:06 +02:00
RincewindsHat
0162cb2d4f fixup! Rework maxfd/open_max to avoid unused variables 2023-09-22 15:24:26 +02:00
RincewindsHat
7fd0e6f36d Rework maxfd/open_max to avoid unused variables 2023-09-22 15:22:57 +02:00
Lorenz Kästle
d5d0b50e89
Merge branch 'master' into compiler_warning_part_3 2023-09-21 09:22:33 +02:00
RincewindsHat
c5e90822d7 Use memory on stack instead of heap for temporary variables 2023-07-23 22:07:33 +02:00
waja
103217831e
Merge branch 'master' into compiler_warning_part_3 2023-06-28 16:39:09 +02:00
waja
4f4dd3a7a3
Merge branch 'master' into compiler_warning_part_5 2023-06-28 16:38:43 +02:00
Stefan Taferner
0dd11100aa avoid mounting when searching for matching mount points 2023-05-10 19:28:05 +02:00
RincewindsHat
a00c412e7b Fixes for -Wnonnull-compare 2023-04-18 00:35:09 +02:00
RincewindsHat
f6f2ba34c7 Fix hash creation 2023-04-18 00:33:33 +02:00
RincewindsHat
7c98e2b345 Use default OPENSSL sha functions if available 2023-04-18 00:32:43 +02:00
RincewindsHat
6c78f0b5ea Fixes for -Wunused
* lib/utils_base.c
* plugins/check_curl.c
* plugins-root/check_dhcp.c
   Removed a line which theoretically can not do anything, but there was
   comment which indicated something else. Still trying this though.
2023-04-18 00:13:24 +02:00
Jan Wagner
0f3703e641 Fix a lot of typos reported by codespell 2023-04-14 18:35:00 +00:00
Kristian Schuster
a0d4277721
Merge remote-tracking branch 'origin/master' into feature_check_disk_add_ignore_missing_option 2023-02-19 23:49:18 +01:00
Kristian Schuster
9898a8ad7d
utils_disk: add name_prev pointer to struct parameter_list
Also added handling of name_prev in np_add_parameter and np_delete_parameter.
This make calling the np_delete_parameter function easier, because it requires
the previous element as second argument.
2023-02-19 13:44:04 +01:00
Lorenz Kästle
ce1453a45a Fix hashes in tests since we are using sha256 now 2023-02-01 11:46:52 +01:00
Lorenz Kästle
dd91860a46 Also link LIB_CRYPTO against tests 2023-02-01 01:23:04 +01:00
RincewindsHat
34c6fae0ca Replace sha1 with sha256 in utils_base 2023-01-31 15:17:51 +01:00
christian-2
dd249c5d4b
check_disk: Find accessible mount path if multiple are available (#1820)
* fixes #1819
* mount entries also have to be accessible according to get_fs_usage()
2022-12-13 23:48:36 +01:00
Sven Nierlein
024d268386 check_snmp: fix performance thresholds when using multiple oids
when using check_snmp with multiple oids it simply printed the unparsed content
from -w/-c into the thresholds for each oid. So each oid contained the hole -w
from all oids.

./check_snmp ... -o iso.3.6.1.2.1.25.1.3.0,iso.3.6.1.2.1.25.1.5.0 -w '1,2' -c '3,4'

before:
  SNMP ... | HOST-RESOURCES-MIB::hrSystemInitialLoadDevice.0=393216;1,2;3,4 HOST-RESOURCES-MIB::hrSystemNumUsers.0=24;1,2;3,4

after:
  SNMP ... | HOST-RESOURCES-MIB::hrSystemInitialLoadDevice.0=393216;1;3 HOST-RESOURCES-MIB::hrSystemNumUsers.0=24;2;4

This also applies to fixed thresholds since check_snmp translates negative infinities from: '~:-1' to '@-1:~'
2021-11-17 14:04:09 +01:00
RincewindsHat
50fc9b73a2 Switch to uint64_t 2021-10-26 17:07:09 +02:00
Sven Nierlein
555559fd30
Merge pull request #1567 from vdanjean/master
[check_disk] add support to display inodes usage in perfdata
2019-02-19 21:49:13 +01:00
Sven Nierlein
7cafb0e845 check_by_ssh: fix child process leak on timeouts
When check_by_ssh runs into a timeout it simply exits keeping all child processes running.
Simply adopting the kill loop from runcmd_timeout_alarm_handler() fixes this.

Signed-off-by: Sven Nierlein <sven@nierlein.de>
2019-02-15 10:36:28 +01:00
Vincent Danjean
270e7cba38 [check_disk] add support to display inodes usage in perfdata
This is not enabled by default
It can be enabled with the -P (--iperfdata) option
2018-12-08 22:44:42 +01:00
Guido Falsi
c76f59bcc0 Avoid passing NULL to vprintf(). 2018-09-29 16:22:44 +02:00
Sven Nierlein
7660540c31 make constants from maxfd values (#1300)
its good practice to use constants instead of (random) values.

Signed-off-by: Sven Nierlein <sven@nierlein.de>
2014-11-28 15:25:43 +01:00
nafets
6bb5e1db52 avoid a segfault, if ulimit is set to unlimited 2014-11-28 15:21:23 +01:00
Holger Weiss
f40fc650f7 Revert "Make use of xasprintf instead of asprintf"
This reverts commit a143739ed2.

Our current setup doesn't allow lib/*.c files to call functions defined
in plugins/utils.[ch].
2014-10-06 22:09:10 +02:00
Jan Wagner
a143739ed2 Make use of xasprintf instead of asprintf
---
Closes #1278
2014-07-30 14:53:07 +02:00
Ricardo Maraschini
15d14d28bb lib/utils_base.c: if asprintf fails, string is undefined
if asprintf fails, string content becomes invalid. we need
to check if it ran OK by checking the returned value.

in case of fail, asprintf returns -1, otherwise the number
of writen bytes is returned.

also, on ubuntu 13.10 i've receiving a lot of warnings:

"warning: ignoring return value of ‘asprintf’"

this patches fixes some of them

Signed-off-by: Ricardo Maraschini <ricardo.maraschini@gmail.com>
---
Closes #1227
2014-07-30 14:48:09 +02:00
Jan Wagner
ba21e26443 check_icmp/check_dhcp: disable check, if we are root
As it is possible to use capabilities(7) on linux or solaris
privileges for example, it is not necessary in all cases to
have those binaries making use of setuid.
2014-07-06 13:29:24 +02:00
Spenser Reinhardt
9123f6146c lib/utils_cmd.c - Free file descriptor
Coverity 66502 - File descriptor fd in cmd_file_read is never closed, and thus file is left open after usage throughout runtime. - SR
2014-06-28 18:24:46 +02:00
Holger Weiss
eb85a612a3 Add UID to state retention file path
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-06-21 15:15:44 +02:00
Holger Weiss
dc0f25cf76 lib/parse_ini.c: Print proper read error message
Print a useful error message if opening the configuration file fails.
2014-06-18 23:42:57 +02:00
Holger Weiss
48025ff39c lib/parse_ini.c: Drop privileges for reading file
Read the configuration file with privileges temporarily dropped if the
code is used by a setuid plugin.
2014-06-18 23:22:12 +02:00
Holger Weiss
2bf7647be6 lib/parse_ini.c: Add newline to die() calls
Our die() function doesn't append a newline character to the message.
2014-06-18 23:15:21 +02:00
Holger Weiss
b81c10e00c lib/parse_ini.c: Cosmetic change
Replace an "if" with the ternary operator.
2014-06-18 23:09:02 +02:00
Holger Weiss
f0b22b37f9 lib/parse_ini.c: Search for INI file in subdirs
Add two path names to the list of default INI file locations, as some
users/distributions prefer to put configuration files into
subdirectories.
2014-06-18 18:39:32 +02:00
Holger Weiss
6da7dba782 lib/parse_ini.c: Add comment on NAGIOS_CONFIG_PATH
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.
2014-06-18 10:53:44 +02:00
Holger Weiss
1890cfccdf lib/parse_ini.c: Cosmetic changes to comments 2014-06-18 10:52:09 +02:00
Holger Weiss
f627b3f33b lib/parse_ini.c: Fix Clang warnings 2014-06-18 10:45:14 +02:00
Holger Weiss
11bfb0def2 lib/parse_ini.[ch]: Change code formatting
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.
2014-06-18 10:37:10 +02:00
Holger Weiss
e2b8169869 lib/parse_ini.c: Don't cast malloc(3) result
There's no need to cast malloc(3)'s return value.
2014-06-18 01:21:31 +02:00
Holger Weiss
95ed0a996c lib/parse_ini.c: Remove outdated comment and code
The lib/parse_ini.c:np_get_defaults() function now dies if no
configuration file is found.
2014-06-18 00:50:48 +02:00
Holger Weiss
fbe13d8f32 lib/parse_ini.c: Read $MP_CONFIG_FILE
Read $MP_CONFIG_FILE if that variable is set in the environment.
2014-06-18 00:47:35 +02:00
Holger Weiss
f94e95785c lib/parse_ini.c: Read "monitoring-plugins.ini"
Read "monitoring-plugins.ini" if that file exists, but fall back to
reading "plugins.ini" or "nagios-plugins.ini" for backward
compatibility.
2014-06-18 00:39:38 +02:00
Holger Weiss
f02b3f6b28 lib/parse_ini.[ch]: Simplify code
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.
2014-06-18 00:37:45 +02:00