Commit graph

245 commits

Author SHA1 Message Date
Lorenz Kästle
6eb5be9e30 Fix argument order of calloc on several occasions 2024-11-09 10:49:21 +01:00
RincewindsHat
7d90b8200f lib: clang-format for headers too 2024-10-31 01:31:59 +01:00
RincewindsHat
880e57271d lib: clang-format 2024-10-31 01:30:50 +01:00
Lorenz Kästle
9462819774 lib: Update copyright 2024-10-17 18:01:49 +02:00
Lorenz Kästle
ee1ba32099 lib: clang-format 2024-10-17 17:57:50 +02:00
RincewindsHat
ae4294ff5b Ini Parser: Avoid freeing symbols from text section by remembering where they are from 2024-01-07 11:57:13 +01:00
RincewindsHat
07f9c438f3 Fixes for -Wsign-compare 2023-10-19 12:10:55 +02:00
RincewindsHat
392ee835ee Include maxfd.h in lib Makefile
This fixes a regression which was introduced with 719e27ddc2
It prevents the creation of working release tarballs with the
current toolchain.

This commit add the header file maxfd.h to list of needed files.
2023-10-18 10:30:18 +02:00
RincewindsHat
6972242126 Fixes for compiler warning -Wparentheses 2023-10-16 00:45:33 +02:00
RincewindsHat
ddbabaa3b6 Replace all old school booleans in lib witch C99 ones 2023-10-15 18:21:31 +02:00
RincewindsHat
4b9d90f31c Whitespace fixes in lib 2023-10-15 18:17:36 +02:00
Lorenz Kästle
128a24be22 Fix typo 2023-09-30 12:59:26 +02:00
Lorenz Kästle
51aa8b2d9d Document new np_add_regex more and add error handling 2023-09-30 12:55:49 +02:00
Alexander A. Klimov
1f694195b4 Introduce np_find_regmatch() 2023-09-28 13:20:24 +02:00
Alexander A. Klimov
d31a696cad Introduce np_add_regex() 2023-09-28 13:20:24 +02:00
Alexander A. Klimov
f457615d84 Introduce regex_list 2023-09-28 13:20:24 +02:00
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