summaryrefslogtreecommitdiffstats
path: root/lib
AgeCommit message (Collapse)AuthorFilesLines
2023-07-23Use memory on stack instead of heap for temporary variablesRincewindsHat1-5/+1
2023-06-28Merge branch 'master' into compiler_warning_part_3waja2-12/+13
2023-05-10avoid mounting when searching for matching mount pointsStefan Taferner1-8/+9
2023-04-17Fix hash creationRincewindsHat1-3/+15
2023-04-17Use default OPENSSL sha functions if availableRincewindsHat2-9/+22
2023-04-17Fixes for -Wunusedrefs/pull/1866/headRincewindsHat1-4/+4
* 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-14Fix a lot of typos reported by codespellrefs/pull/1864/headJan Wagner7-15/+15
2023-02-19Merge remote-tracking branch 'origin/master' into ↵Kristian Schuster5-9/+15
feature_check_disk_add_ignore_missing_option
2023-02-19utils_disk: add name_prev pointer to struct parameter_listKristian Schuster2-2/+18
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-01Fix hashes in tests since we are using sha256 nowLorenz Kästle1-3/+3
2023-02-01Also link LIB_CRYPTO against testsLorenz Kästle1-1/+1
2023-01-31Replace sha1 with sha256 in utils_baseRincewindsHat2-5/+5
2022-12-13check_disk: Find accessible mount path if multiple are available (#1820)christian-21-0/+6
* fixes #1819 * mount entries also have to be accessible according to get_fs_usage()
2021-11-17check_snmp: fix performance thresholds when using multiple oidsSven Nierlein2-1/+2
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-10-26Switch to uint64_tRincewindsHat1-1/+1
2019-02-19Merge pull request #1567 from vdanjean/masterSven Nierlein2-1/+4
[check_disk] add support to display inodes usage in perfdata
2019-02-15check_by_ssh: fix child process leak on timeoutsrefs/pull/1583/headSven Nierlein4-25/+54
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>
2018-12-08[check_disk] add support to display inodes usage in perfdatarefs/pull/1567/headVincent Danjean2-1/+4
This is not enabled by default It can be enabled with the -P (--iperfdata) option
2018-09-29Avoid passing NULL to vprintf().refs/pull/1552/headGuido Falsi1-4/+7
2014-11-28make constants from maxfd values (#1300)refs/pull/1304/headSven Nierlein1-4/+6
its good practice to use constants instead of (random) values. Signed-off-by: Sven Nierlein <sven@nierlein.de>
2014-11-28avoid a segfault, if ulimit is set to unlimitednafets1-0/+8
2014-10-06Revert "Make use of xasprintf instead of asprintf"Holger Weiss1-3/+3
This reverts commit a143739ed286cf9ae003792dbb1ce26ce43f3312. Our current setup doesn't allow lib/*.c files to call functions defined in plugins/utils.[ch].
2014-07-30Make use of xasprintf instead of asprintfrefs/pull/1278/headJan Wagner1-3/+3
--- Closes #1278
2014-07-30lib/utils_base.c: if asprintf fails, string is undefinedRicardo Maraschini1-5/+10
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-06check_icmp/check_dhcp: disable check, if we are rootJan Wagner2-16/+0
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-06-28lib/utils_cmd.c - Free file descriptorrefs/pull/1263/headSpenser Reinhardt1-0/+3
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-21Add UID to state retention file pathHolger Weiss2-3/+9
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-18lib/parse_ini.c: Print proper read error messageHolger Weiss1-1/+2
Print a useful error message if opening the configuration file fails.
2014-06-18lib/parse_ini.c: Drop privileges for reading fileHolger Weiss1-0/+10
Read the configuration file with privileges temporarily dropped if the code is used by a setuid plugin.
2014-06-18lib/parse_ini.c: Add newline to die() callsHolger Weiss1-2/+2
Our die() function doesn't append a newline character to the message.
2014-06-18lib/parse_ini.c: Cosmetic changeHolger Weiss1-4/+1
Replace an "if" with the ternary operator.
2014-06-18lib/parse_ini.c: Search for INI file in subdirsHolger Weiss1-0/+2
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-18lib/parse_ini.c: Add comment on NAGIOS_CONFIG_PATHHolger Weiss1-15/+17
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-18lib/parse_ini.c: Cosmetic changes to commentsHolger Weiss1-16/+20
2014-06-18lib/parse_ini.c: Fix Clang warningsHolger Weiss1-8/+7
2014-06-18lib/parse_ini.[ch]: Change code formattingHolger Weiss2-156/+192
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-17lib/parse_ini.c: Don't cast malloc(3) resultHolger Weiss1-2/+2
There's no need to cast malloc(3)'s return value.
2014-06-17lib/parse_ini.c: Remove outdated comment and codeHolger Weiss1-15/+10
The lib/parse_ini.c:np_get_defaults() function now dies if no configuration file is found.
2014-06-17lib/parse_ini.c: Read $MP_CONFIG_FILEHolger Weiss1-1/+2
Read $MP_CONFIG_FILE if that variable is set in the environment.
2014-06-17lib/parse_ini.c: Read "monitoring-plugins.ini"Holger Weiss1-0/+4
Read "monitoring-plugins.ini" if that file exists, but fall back to reading "plugins.ini" or "nagios-plugins.ini" for backward compatibility.
2014-06-17lib/parse_ini.[ch]: Simplify codeHolger Weiss2-110/+49
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-03-09build - avoid deprecated INCLUDESDavide Madrisan2-6/+4
Signed-off-by: Davide Madrisan <davide.madrisan@gmail.com>
2014-01-31Handle negative values properly with check_snmpStephane Lapie1-1/+1
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
2014-01-31Add tests for negative thresholds in test_utilsThomas Guyot-Sionnest1-2/+17
2014-01-30Add tests for mp_translate_state()Thomas Guyot-Sionnest1-5/+50
2014-01-29Move negate' translate_state() to utils_base.h mp_translate_state()Thomas Guyot-Sionnest2-4/+26
Also use strcasecmp imported from gnulib for simplicity
2014-01-27Rename MP_STATE_DIRECTORY to MP_STATE_PATHThomas Guyot-Sionnest2-5/+5
2014-01-27And release notes for previous change (MP_STATE_DIRECTORY)Thomas Guyot-Sionnest1-1/+0
The change has also been updated in https://www.monitoring-plugins.org/doc/state-retention.html
2014-01-25Ignore MP_STATE_DIRECTORY in suid pluginsThomas Guyot-Sionnest3-9/+21
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.
2014-01-25Clean up parse_ini error messages, add missing newlinesThomas Guyot-Sionnest1-5/+5