diff options
author | Lorenz Kästle <lorenz.kaestle@netways.de> | 2023-04-28 11:00:05 +0200 |
---|---|---|
committer | Lorenz Kästle <lorenz.kaestle@netways.de> | 2023-04-28 11:00:05 +0200 |
commit | 34c4d13edd8ece1e928c578974218c10d25600c4 (patch) | |
tree | 96eaf64dc46c8b785d437250d42471180597a699 | |
parent | e4ddeb7bb722b50613108da1cb51a48e84068701 (diff) | |
parent | 7cb82e6486e662fa4d2530523787d3eced266545 (diff) | |
download | monitoring-plugins-34c4d13.tar.gz |
Merge branch 'master' into RincewindsHat-patch-1
74 files changed, 464 insertions, 223 deletions
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 60b60c3f..11823aee 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml | |||
@@ -20,8 +20,41 @@ jobs: | |||
20 | - name: make | 20 | - name: make |
21 | run: make | 21 | run: make |
22 | 22 | ||
23 | codespell: | ||
24 | name: codespell | ||
25 | strategy: | ||
26 | fail-fast: false | ||
27 | runs-on: ubuntu-latest | ||
28 | steps: | ||
29 | - name: Checkout | ||
30 | uses: actions/checkout@v3 | ||
31 | - name: Codespell | ||
32 | uses: codespell-project/actions-codespell@master | ||
33 | with: | ||
34 | skip: "./.git,./.gitignore,./ABOUT-NLS,*.po,./gl,./po,./tools/squid.conf,./build-aux/ltmain.sh" | ||
35 | ignore_words_list: allright,gord,didi,hda,nd,alis,clen,scrit,ser,fot,te,parm,isnt,consol,oneliners | ||
36 | check_filenames: true | ||
37 | check_hidden: true | ||
38 | # super-linter: | ||
39 | # name: super-linter | ||
40 | # strategy: | ||
41 | # fail-fast: false | ||
42 | # runs-on: ubuntu-latest | ||
43 | # steps: | ||
44 | # - name: Checkout | ||
45 | # uses: actions/checkout@v3 | ||
46 | # - name: Lint Code Base | ||
47 | # uses: github/super-linter@v5.0.0 | ||
48 | # env: | ||
49 | # DEFAULT_BRANCH: master | ||
50 | # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
51 | # macos: | ||
52 | # ... | ||
23 | linux: | 53 | linux: |
24 | needs: build-test | 54 | needs: |
55 | - build-test | ||
56 | - codespell | ||
57 | # - super-linter | ||
25 | runs-on: ubuntu-latest | 58 | runs-on: ubuntu-latest |
26 | name: Running tests on ${{ matrix.distro }} | 59 | name: Running tests on ${{ matrix.distro }} |
27 | strategy: | 60 | strategy: |
@@ -246,6 +246,7 @@ NP-VERSION-FILE | |||
246 | /plugins-scripts/check_ircd | 246 | /plugins-scripts/check_ircd |
247 | /plugins-scripts/check_log | 247 | /plugins-scripts/check_log |
248 | /plugins-scripts/check_mailq | 248 | /plugins-scripts/check_mailq |
249 | /plugins-scripts/check_mssql | ||
249 | /plugins-scripts/check_ntp | 250 | /plugins-scripts/check_ntp |
250 | /plugins-scripts/check_oracle | 251 | /plugins-scripts/check_oracle |
251 | /plugins-scripts/check_rpc | 252 | /plugins-scripts/check_rpc |
diff --git a/ACKNOWLEDGEMENTS b/ACKNOWLEDGEMENTS index d73be549..af29c154 100644 --- a/ACKNOWLEDGEMENTS +++ b/ACKNOWLEDGEMENTS | |||
@@ -20,7 +20,7 @@ Using the DLPI support on SysV systems to get the host MAC address in check_dhcp | |||
20 | Stenberg, Daniel | 20 | Stenberg, Daniel |
21 | Copyright (c) 1996 - 2004, Daniel Stenberg, <daniel@haxx.se> | 21 | Copyright (c) 1996 - 2004, Daniel Stenberg, <daniel@haxx.se> |
22 | http://curl.haxx.se/ | 22 | http://curl.haxx.se/ |
23 | Use of duplication of macros in m4/np_curl.m4 (slighly adapted for m4/uriparser.m4 too) | 23 | Use of duplication of macros in m4/np_curl.m4 (slightly adapted for m4/uriparser.m4 too) |
24 | 24 | ||
25 | Coreutils team | 25 | Coreutils team |
26 | Copyright (C) 91, 1995-2004 Free Software Foundation, Inc. | 26 | Copyright (C) 91, 1995-2004 Free Software Foundation, Inc. |
@@ -9,12 +9,12 @@ This file documents the major additions and syntax changes between releases. | |||
9 | check_http/check_curl: add chunked encoding test | 9 | check_http/check_curl: add chunked encoding test |
10 | check_log: Added --exclude to exclude patterns | 10 | check_log: Added --exclude to exclude patterns |
11 | check_log: Add tests | 11 | check_log: Add tests |
12 | check_disk: Clarify usage possibilites | 12 | check_disk: Clarify usage possibilities |
13 | 13 | ||
14 | FIXES | 14 | FIXES |
15 | fixed two PRId64 to PRIu64 in perfdata_uint64 | 15 | fixed two PRId64 to PRIu64 in perfdata_uint64 |
16 | check_pgsql: Removing is_pg_dbname alltogether,using postgres API. | 16 | check_pgsql: Removing is_pg_dbname altogether,using postgres API. |
17 | check_http: Remove superflous CRLF in HTTP-Requests | 17 | check_http: Remove superfluous CRLF in HTTP-Requests |
18 | check_curl: detect ipv6 | 18 | check_curl: detect ipv6 |
19 | check_icmp: fix parsing help/version long options | 19 | check_icmp: fix parsing help/version long options |
20 | check_http: fix test plan | 20 | check_http: fix test plan |
@@ -40,7 +40,7 @@ This file documents the major additions and syntax changes between releases. | |||
40 | 40 | ||
41 | 2.3.2 20th Oct 2022 | 41 | 2.3.2 20th Oct 2022 |
42 | GENERAL | 42 | GENERAL |
43 | Use netcat-openbsd for debian explicitely (by @RincewindsHat #1704) | 43 | Use netcat-openbsd for debian explicitly (by @RincewindsHat #1704) |
44 | Replace egrep with grep -E (by @RincewindsHat #1791) | 44 | Replace egrep with grep -E (by @RincewindsHat #1791) |
45 | Use silent automake by default (by @RincewindsHat #1747) | 45 | Use silent automake by default (by @RincewindsHat #1747) |
46 | 46 | ||
@@ -123,7 +123,7 @@ This file documents the major additions and syntax changes between releases. | |||
123 | check_log: Modernize check log (by @RincewindsHat #1692) | 123 | check_log: Modernize check log (by @RincewindsHat #1692) |
124 | check_mailq: remove duplicate W=i/C=i args in check_mailq.pl (by @ichdasich #1755) | 124 | check_mailq: remove duplicate W=i/C=i args in check_mailq.pl (by @ichdasich #1755) |
125 | check_ntp: Check ntp remove unused variables (by @RincewindsHat #1781) | 125 | check_ntp: Check ntp remove unused variables (by @RincewindsHat #1781) |
126 | check_pgsql: Using snprintf which honors the buffers size and guarantees null temination. (Closes: #1601) (by @waja #1663) | 126 | check_pgsql: Using snprintf which honors the buffers size and guarantees null termination. (Closes: #1601) (by @waja #1663) |
127 | check_procs: Fix double percentage sign in usage (by @RincewindsHat #1743) | 127 | check_procs: Fix double percentage sign in usage (by @RincewindsHat #1743) |
128 | check_sensors.sh: Make shellcheck happier (by @RincewindsHat #1679) | 128 | check_sensors.sh: Make shellcheck happier (by @RincewindsHat #1679) |
129 | check_snmp: Fixed option description authpassword -> authpasswd + whitespaces (by @RincewindsHat #1676) | 129 | check_snmp: Fixed option description authpassword -> authpasswd + whitespaces (by @RincewindsHat #1676) |
@@ -165,7 +165,7 @@ This file documents the major additions and syntax changes between releases. | |||
165 | check_apt: adding packages-warning option | 165 | check_apt: adding packages-warning option |
166 | check_load: Adding top consuming processes option | 166 | check_load: Adding top consuming processes option |
167 | check_http: Adding Proxy-Authorization and extra headers | 167 | check_http: Adding Proxy-Authorization and extra headers |
168 | check_snmp: make calcualtion of timeout value in help output more clear | 168 | check_snmp: make calculation of timeout value in help output more clear |
169 | check_uptime: new plugin for checking uptime to see how long the system is running | 169 | check_uptime: new plugin for checking uptime to see how long the system is running |
170 | check_curl: check_http replacement based on libcurl | 170 | check_curl: check_http replacement based on libcurl |
171 | check_http: Allow user to specify HTTP method after proxy CONNECT | 171 | check_http: Allow user to specify HTTP method after proxy CONNECT |
@@ -195,7 +195,7 @@ This file documents the major additions and syntax changes between releases. | |||
195 | check_procs: improve command examples for 'at least' processes | 195 | check_procs: improve command examples for 'at least' processes |
196 | check_swap: repaired "-n" behaviour | 196 | check_swap: repaired "-n" behaviour |
197 | check_disk: include -P switch in help | 197 | check_disk: include -P switch in help |
198 | check_mailq: restore accidentially removed options | 198 | check_mailq: restore accidentally removed options |
199 | 199 | ||
200 | 2.2 29th November 2016 | 200 | 2.2 29th November 2016 |
201 | ENHANCEMENTS | 201 | ENHANCEMENTS |
@@ -236,7 +236,7 @@ This file documents the major additions and syntax changes between releases. | |||
236 | check_ssh now returns CRITICAL for protocol/version errors | 236 | check_ssh now returns CRITICAL for protocol/version errors |
237 | If a plugin is invoked with -h/--help or -V/--version, the exit status | 237 | If a plugin is invoked with -h/--help or -V/--version, the exit status |
238 | is now UNKNOWN | 238 | is now UNKNOWN |
239 | The superseeded check_ntp.pl was removed, please use check_ntp_peer or | 239 | The superseded check_ntp.pl was removed, please use check_ntp_peer or |
240 | check_ntp_time instead | 240 | check_ntp_time instead |
241 | 241 | ||
242 | 2.1.2 16th October 2015 | 242 | 2.1.2 16th October 2015 |
@@ -263,7 +263,7 @@ This file documents the major additions and syntax changes between releases. | |||
263 | New check_mysql -n option to ignore authentication failures | 263 | New check_mysql -n option to ignore authentication failures |
264 | Added IP and port or socket name to error messages | 264 | Added IP and port or socket name to error messages |
265 | New check_ntp_time -o option to add expected offset | 265 | New check_ntp_time -o option to add expected offset |
266 | check_disk shows now troubled partions in verbose mode | 266 | check_disk shows now troubled partitions in verbose mode |
267 | check_dig has now support for drill and dig | 267 | check_dig has now support for drill and dig |
268 | check_dig has now support for -6 option | 268 | check_dig has now support for -6 option |
269 | Add performance data to check_file_age | 269 | Add performance data to check_file_age |
@@ -357,10 +357,10 @@ This file documents the major additions and syntax changes between releases. | |||
357 | New check_procs -k option to ignore kernel threads (on Linux) | 357 | New check_procs -k option to ignore kernel threads (on Linux) |
358 | Let check_procs use /proc/<PID>/exe (if available) instead of getpid(2), unless -T is specified | 358 | Let check_procs use /proc/<PID>/exe (if available) instead of getpid(2), unless -T is specified |
359 | Let check_mysql support SSL | 359 | Let check_mysql support SSL |
360 | Let check_mysql add perfromance metrics for all checks | 360 | Let check_mysql add performance metrics for all checks |
361 | New check_mysql -f option to specify a client options file | 361 | New check_mysql -f option to specify a client options file |
362 | New check_mysql -g option to specify a client options group | 362 | New check_mysql -g option to specify a client options group |
363 | New check_snmp --offset option to allow for adding/substracting an offset value to sensor data | 363 | New check_snmp --offset option to allow for adding/subtracting an offset value to sensor data |
364 | Let check_snmp support an arbitrary number of OIDs | 364 | Let check_snmp support an arbitrary number of OIDs |
365 | Let check_ide_smart support NetBSD | 365 | Let check_ide_smart support NetBSD |
366 | 366 | ||
@@ -375,7 +375,7 @@ This file documents the major additions and syntax changes between releases. | |||
375 | Fix deprecated imports of check_nmap.py | 375 | Fix deprecated imports of check_nmap.py |
376 | 376 | ||
377 | WARNINGS | 377 | WARNINGS |
378 | check_http behaviour of -k/--header changed since it does not seperate multiple headers by semicolons anymore. Use multiple -k switches instead. | 378 | check_http behaviour of -k/--header changed since it does not separate multiple headers by semicolons anymore. Use multiple -k switches instead. |
379 | check_http's --proxy_authorization option is now called --proxy-authorization (it was always documented this way) | 379 | check_http's --proxy_authorization option is now called --proxy-authorization (it was always documented this way) |
380 | The contrib directory has been removed from this distribution | 380 | The contrib directory has been removed from this distribution |
381 | 381 | ||
@@ -526,7 +526,7 @@ This file documents the major additions and syntax changes between releases. | |||
526 | check_ntp and check_ntp_peer now show proper jitter/stratum thresholds longopts in --help | 526 | check_ntp and check_ntp_peer now show proper jitter/stratum thresholds longopts in --help |
527 | check_dns now allow to repeat -a to match multiple possibly returned address (common with load balancers) | 527 | check_dns now allow to repeat -a to match multiple possibly returned address (common with load balancers) |
528 | check_mysql and check_radius now try clearing password in processlist just like check_mysql_query | 528 | check_mysql and check_radius now try clearing password in processlist just like check_mysql_query |
529 | check_mysql and check_mysql_query now support sockets explicitely (-s, --socket) | 529 | check_mysql and check_mysql_query now support sockets explicitly (-s, --socket) |
530 | negate now has the ability to replace the status text as well (-s, --substitute) | 530 | negate now has the ability to replace the status text as well (-s, --substitute) |
531 | Added performance data to check_ping | 531 | Added performance data to check_ping |
532 | Added support for --extra-opts in all C plugins (disabled by default, see configure --help) | 532 | Added support for --extra-opts in all C plugins (disabled by default, see configure --help) |
@@ -566,7 +566,7 @@ This file documents the major additions and syntax changes between releases. | |||
566 | New check_disk option -L: Only check local filesystems, but call stat() on remote ones, too. | 566 | New check_disk option -L: Only check local filesystems, but call stat() on remote ones, too. |
567 | Thus accessibility of remote filesystems can be checked without any threshold comparison. | 567 | Thus accessibility of remote filesystems can be checked without any threshold comparison. |
568 | Check_disk's --help now prints some examples for the new features introduced in 1.4.8 | 568 | Check_disk's --help now prints some examples for the new features introduced in 1.4.8 |
569 | New check_disk -i/-I option to ignore pathes/partitions based on regular expressions | 569 | New check_disk -i/-I option to ignore paths/partitions based on regular expressions |
570 | New check_disk -A option to select all filesystems explicitly | 570 | New check_disk -A option to select all filesystems explicitly |
571 | WARNING: check_disk's -E option must now be passed before -p or -r/-R arguments | 571 | WARNING: check_disk's -E option must now be passed before -p or -r/-R arguments |
572 | Passing -E after -p or -r results in UNKNOWN state, now | 572 | Passing -E after -p or -r results in UNKNOWN state, now |
@@ -615,7 +615,7 @@ This file documents the major additions and syntax changes between releases. | |||
615 | Fixed MKINSTALLDIRS problem in po/ | 615 | Fixed MKINSTALLDIRS problem in po/ |
616 | ./configure now detects if possible to compile check_mysql | 616 | ./configure now detects if possible to compile check_mysql |
617 | Fixed broken HELO in check_smtp | 617 | Fixed broken HELO in check_smtp |
618 | check_icmp now allows to set a minimum number of hosts required for successs (-m) | 618 | check_icmp now allows to set a minimum number of hosts required for success (-m) |
619 | check_icmp fix for *BSD when running for long time | 619 | check_icmp fix for *BSD when running for long time |
620 | check_ping times out 1 second quicker if host is unreachable | 620 | check_ping times out 1 second quicker if host is unreachable |
621 | Root plugins installed with world executable | 621 | Root plugins installed with world executable |
@@ -151,14 +151,14 @@ of testing against a set of desired exit status values. | |||
151 | =item * | 151 | =item * |
152 | 152 | ||
153 | Firstly, if C<$desiredExitStatus> is a reference to an array of exit | 153 | Firstly, if C<$desiredExitStatus> is a reference to an array of exit |
154 | stati, if the actual exit status of the command is present in the | 154 | statuses, if the actual exit status of the command is present in the |
155 | array, it is used in the call to C<Test::ok(...)> when testing the | 155 | array, it is used in the call to C<Test::ok(...)> when testing the |
156 | exit status. | 156 | exit status. |
157 | 157 | ||
158 | =item * | 158 | =item * |
159 | 159 | ||
160 | Alternatively, if C<$desiredExitStatus> is a reference to a hash of | 160 | Alternatively, if C<$desiredExitStatus> is a reference to a hash of |
161 | exit stati (mapped to the strings "continue" or "skip"), similar | 161 | exit statuses(mapped to the strings "continue" or "skip"), similar |
162 | processing to the above occurs with the side affect of determining if | 162 | processing to the above occurs with the side affect of determining if |
163 | any generated output testing should proceed. Note: only the string | 163 | any generated output testing should proceed. Note: only the string |
164 | "skip" will result in generated output testing being skipped. | 164 | "skip" will result in generated output testing being skipped. |
@@ -207,7 +207,7 @@ under the same terms as the Monitoring Plugins release. | |||
207 | 207 | ||
208 | my( %CACHE ) = (); | 208 | my( %CACHE ) = (); |
209 | 209 | ||
210 | # I'm not really sure wether to house a site-specific cache inside | 210 | # I'm not really sure whether to house a site-specific cache inside |
211 | # or outside of the extracted source / build tree - lets default to outside | 211 | # or outside of the extracted source / build tree - lets default to outside |
212 | my( $CACHEFILENAME ) = ( exists( $ENV{'NPTEST_CACHE'} ) && $ENV{'NPTEST_CACHE'} ) | 212 | my( $CACHEFILENAME ) = ( exists( $ENV{'NPTEST_CACHE'} ) && $ENV{'NPTEST_CACHE'} ) |
213 | ? $ENV{'NPTEST_CACHE'} : "/var/tmp/NPTest.cache"; # "../Cache.pdd"; | 213 | ? $ENV{'NPTEST_CACHE'} : "/var/tmp/NPTest.cache"; # "../Cache.pdd"; |
@@ -7,7 +7,7 @@ With that done, it's time to figure out what we are doing for release | |||
7 | 1.3 development. I have a few ideas. Maybe others do as well. | 7 | 1.3 development. I have a few ideas. Maybe others do as well. |
8 | 8 | ||
9 | DOCUMENTATION: | 9 | DOCUMENTATION: |
10 | We pretty much have decieded that we will doing something along | 10 | We pretty much have decided that we will doing something along |
11 | the lines of a literate programming model. So far, we have site | 11 | the lines of a literate programming model. So far, we have site |
12 | documentation in DocBook. I have some ideas here, which I will | 12 | documentation in DocBook. I have some ideas here, which I will |
13 | discuss in a separate thread. | 13 | discuss in a separate thread. |
@@ -39,9 +39,9 @@ inconsistent mess and I'd love to ditch it. I only created it to | |||
39 | satisfy people that wanted reverse compatibility and did not have | 39 | satisfy people that wanted reverse compatibility and did not have |
40 | GNU getopt. | 40 | GNU getopt. |
41 | 41 | ||
42 | Bu I would like to urge that all standard plugins contain | 42 | But I would like to urge that all standard plugins contain |
43 | validate_arguments(). I think this will help convey the idea that | 43 | validate_arguments(). I think this will help convey the idea that |
44 | validations hould be done, even if we don't insist on the specific | 44 | validations should be done, even if we don't insist on the specific |
45 | extent that each plugin must do that validation. | 45 | extent that each plugin must do that validation. |
46 | 46 | ||
47 | This is the set of standard options I envision: | 47 | This is the set of standard options I envision: |
@@ -59,7 +59,7 @@ Reserved: | |||
59 | -F, --file = STRING (usually input) | 59 | -F, --file = STRING (usually input) |
60 | -O, --output = STRING (output file) | 60 | -O, --output = STRING (output file) |
61 | 61 | ||
62 | Recommended, but not reserverd: | 62 | Recommended, but not reserved: |
63 | 63 | ||
64 | -I, --ipaddress = STRING | 64 | -I, --ipaddress = STRING |
65 | -C, --community = STRING | 65 | -C, --community = STRING |
@@ -69,7 +69,7 @@ Recommended, but not reserverd: | |||
69 | -P, --port = INT | 69 | -P, --port = INT |
70 | -u, --url = STRING (also --username if --url is not needed) | 70 | -u, --url = STRING (also --username if --url is not needed) |
71 | 71 | ||
72 | I am suggesting that port alway be '-P' (uppercase) -- we are | 72 | I am suggesting that port always be '-P' (uppercase) -- we are |
73 | currently inconsistent in that regard. | 73 | currently inconsistent in that regard. |
74 | 74 | ||
75 | I am also adding '-q' for silent running. This is totally self | 75 | I am also adding '-q' for silent running. This is totally self |
@@ -87,12 +87,12 @@ Programming: | |||
87 | length character assignments, at least to the extent possible, | 87 | length character assignments, at least to the extent possible, |
88 | from the C-based plugins. To that end, I have made strscpy and | 88 | from the C-based plugins. To that end, I have made strscpy and |
89 | friends in utils.c -- I'd like to deploy them. I have comments | 89 | friends in utils.c -- I'd like to deploy them. I have comments |
90 | that there is alot of duplicated code, and techniques used that | 90 | that there is a lot of duplicated code, and techniques used that |
91 | should be cleaned up. Details in a separate thread. | 91 | should be cleaned up. Details in a separate thread. |
92 | 92 | ||
93 | Remote checks: | 93 | Remote checks: |
94 | I have a proposal in hand to incorporate ssh check into spopen() | 94 | I have a proposal in hand to incorporate ssh check into spopen() |
95 | so that remote machine checks can be seemless. A nice idea, but | 95 | so that remote machine checks can be seamless. A nice idea, but |
96 | complex enough to require discussion. Another thread. | 96 | complex enough to require discussion. Another thread. |
97 | 97 | ||
98 | I also have a wish list, and I'm sure I've forgot some items. I'll | 98 | I also have a wish list, and I'm sure I've forgot some items. I'll |
@@ -405,3 +405,4 @@ Robert Bohne | |||
405 | Wolfgang Nieder | 405 | Wolfgang Nieder |
406 | andrew bezella | 406 | andrew bezella |
407 | Lorenz Gruenwald | 407 | Lorenz Gruenwald |
408 | John Morrissey | ||
diff --git a/build-aux/ltmain.sh b/build-aux/ltmain.sh index 33f642a0..2e8548d3 100644 --- a/build-aux/ltmain.sh +++ b/build-aux/ltmain.sh | |||
@@ -189,7 +189,7 @@ func_basename () | |||
189 | # to NONDIR_REPLACEMENT. | 189 | # to NONDIR_REPLACEMENT. |
190 | # value returned in "$func_dirname_result" | 190 | # value returned in "$func_dirname_result" |
191 | # basename: Compute filename of FILE. | 191 | # basename: Compute filename of FILE. |
192 | # value retuned in "$func_basename_result" | 192 | # value returned in "$func_basename_result" |
193 | # Implementation must be kept synchronized with func_dirname | 193 | # Implementation must be kept synchronized with func_dirname |
194 | # and func_basename. For efficiency, we do not delegate to | 194 | # and func_basename. For efficiency, we do not delegate to |
195 | # those functions but instead duplicate the functionality here. | 195 | # those functions but instead duplicate the functionality here. |
@@ -522,7 +522,7 @@ func_mkdir_p () | |||
522 | # While some portion of DIR does not yet exist... | 522 | # While some portion of DIR does not yet exist... |
523 | while test ! -d "$my_directory_path"; do | 523 | while test ! -d "$my_directory_path"; do |
524 | # ...make a list in topmost first order. Use a colon delimited | 524 | # ...make a list in topmost first order. Use a colon delimited |
525 | # list incase some portion of path contains whitespace. | 525 | # list in case some portion of path contains whitespace. |
526 | my_dir_list="$my_directory_path:$my_dir_list" | 526 | my_dir_list="$my_directory_path:$my_dir_list" |
527 | 527 | ||
528 | # If the last portion added has no slash in it, the list is done | 528 | # If the last portion added has no slash in it, the list is done |
@@ -4394,7 +4394,7 @@ EOF | |||
4394 | { | 4394 | { |
4395 | /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX | 4395 | /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX |
4396 | namespace, but it is not one of the ones we know about and | 4396 | namespace, but it is not one of the ones we know about and |
4397 | have already dealt with, above (inluding dump-script), then | 4397 | have already dealt with, above (including dump-script), then |
4398 | report an error. Otherwise, targets might begin to believe | 4398 | report an error. Otherwise, targets might begin to believe |
4399 | they are allowed to use options in the LTWRAPPER_OPTION_PREFIX | 4399 | they are allowed to use options in the LTWRAPPER_OPTION_PREFIX |
4400 | namespace. The first time any user complains about this, we'll | 4400 | namespace. The first time any user complains about this, we'll |
diff --git a/config_test/child_test.c b/config_test/child_test.c index 4bf85049..2add3bcf 100644 --- a/config_test/child_test.c +++ b/config_test/child_test.c | |||
@@ -30,7 +30,7 @@ int main(){ | |||
30 | /* pipefd[1] is for writing to the pipe. We want the output | 30 | /* pipefd[1] is for writing to the pipe. We want the output |
31 | * that used to go to the standard output (file descriptor 1) | 31 | * that used to go to the standard output (file descriptor 1) |
32 | * to be written to the pipe. The following command does this, | 32 | * to be written to the pipe. The following command does this, |
33 | * creating a new file descripter 1 (the lowest available) | 33 | * creating a new file descriptor 1 (the lowest available) |
34 | * that writes where pipefd[1] goes. */ | 34 | * that writes where pipefd[1] goes. */ |
35 | dup (pipefd[1]); /* points pipefd at file descriptor */ | 35 | dup (pipefd[1]); /* points pipefd at file descriptor */ |
36 | /* the child isn't going to read from the pipe, so | 36 | /* the child isn't going to read from the pipe, so |
diff --git a/configure.ac b/configure.ac index 0c7169e8..bad5c53c 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -932,7 +932,7 @@ elif ps -Ao 's comm vsz rss uid user pid ppid args' 2>/dev/null | \ | |||
932 | then | 932 | then |
933 | ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]" | 933 | ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]" |
934 | ac_cv_ps_command="$PATH_TO_PS -Ao 's uid pid ppid vsz rss pcpu comm args'" | 934 | ac_cv_ps_command="$PATH_TO_PS -Ao 's uid pid ppid vsz rss pcpu comm args'" |
935 | # There must be no space between the %s and %n due to a wierd problem in sscanf where | 935 | # There must be no space between the %s and %n due to a weird problem in sscanf where |
936 | # it will return %n as longer than the line length | 936 | # it will return %n as longer than the line length |
937 | ac_cv_ps_format="%s %d %d %d %d %d %f %s%n" | 937 | ac_cv_ps_format="%s %d %d %d %d %d %f %s%n" |
938 | ac_cv_ps_cols=9 | 938 | ac_cv_ps_cols=9 |
@@ -1552,7 +1552,7 @@ if test -n "$PATH_TO_SUDO" | |||
1552 | then | 1552 | then |
1553 | AC_DEFINE_UNQUOTED(PATH_TO_SUDO,"$PATH_TO_SUDO",[path to sudo]) | 1553 | AC_DEFINE_UNQUOTED(PATH_TO_SUDO,"$PATH_TO_SUDO",[path to sudo]) |
1554 | else | 1554 | else |
1555 | AC_MSG_WARN([Could not find sudo or eqivalent]) | 1555 | AC_MSG_WARN([Could not find sudo or equivalent]) |
1556 | fi | 1556 | fi |
1557 | 1557 | ||
1558 | AC_PATH_PROG(PATH_TO_MAILQ,mailq) | 1558 | AC_PATH_PROG(PATH_TO_MAILQ,mailq) |
@@ -1563,7 +1563,7 @@ if test -n "$PATH_TO_MAILQ" | |||
1563 | then | 1563 | then |
1564 | AC_DEFINE_UNQUOTED(PATH_TO_MAILQ,"$PATH_TO_MAILQ",[path to mailq]) | 1564 | AC_DEFINE_UNQUOTED(PATH_TO_MAILQ,"$PATH_TO_MAILQ",[path to mailq]) |
1565 | else | 1565 | else |
1566 | AC_MSG_WARN([Could not find mailq or eqivalent]) | 1566 | AC_MSG_WARN([Could not find mailq or equivalent]) |
1567 | fi | 1567 | fi |
1568 | 1568 | ||
1569 | AC_PATH_PROG(PATH_TO_QMAIL_QSTAT,qmail-qstat) | 1569 | AC_PATH_PROG(PATH_TO_QMAIL_QSTAT,qmail-qstat) |
@@ -1574,7 +1574,7 @@ if test -n "$PATH_TO_QMAIL_QSTAT" | |||
1574 | then | 1574 | then |
1575 | AC_DEFINE_UNQUOTED(PATH_TO_QMAIL_QSTAT,"$PATH_TO_QMAIL_QSTAT",[path to qmail-qstat]) | 1575 | AC_DEFINE_UNQUOTED(PATH_TO_QMAIL_QSTAT,"$PATH_TO_QMAIL_QSTAT",[path to qmail-qstat]) |
1576 | else | 1576 | else |
1577 | AC_MSG_WARN([Could not find qmail-qstat or eqivalent]) | 1577 | AC_MSG_WARN([Could not find qmail-qstat or equivalent]) |
1578 | fi | 1578 | fi |
1579 | 1579 | ||
1580 | dnl SWAP info required is amount allocated/available and amount free | 1580 | dnl SWAP info required is amount allocated/available and amount free |
@@ -1832,7 +1832,7 @@ AM_GNU_GETTEXT([external], [need-ngettext]) | |||
1832 | AM_GNU_GETTEXT_VERSION(0.15) | 1832 | AM_GNU_GETTEXT_VERSION(0.15) |
1833 | 1833 | ||
1834 | dnl Check for Redhat spopen problem | 1834 | dnl Check for Redhat spopen problem |
1835 | dnl Wierd problem where ECHILD is returned from a wait call in error | 1835 | dnl Weird problem where ECHILD is returned from a wait call in error |
1836 | dnl Only appears to affect nslookup and dig calls. Only affects redhat around | 1836 | dnl Only appears to affect nslookup and dig calls. Only affects redhat around |
1837 | dnl 2.6.9-11 (okay in 2.6.9-5). Redhat investigating root cause | 1837 | dnl 2.6.9-11 (okay in 2.6.9-5). Redhat investigating root cause |
1838 | dnl We patch plugins/popen.c | 1838 | dnl We patch plugins/popen.c |
diff --git a/doc/developer-guidelines.sgml b/doc/developer-guidelines.sgml index 28674e05..1982974f 100644 --- a/doc/developer-guidelines.sgml +++ b/doc/developer-guidelines.sgml | |||
@@ -31,7 +31,7 @@ | |||
31 | 31 | ||
32 | <preface id="preface"><title>Preface</title> | 32 | <preface id="preface"><title>Preface</title> |
33 | <para>The purpose of this guidelines is to provide a reference for | 33 | <para>The purpose of this guidelines is to provide a reference for |
34 | the plugin developers and encourage the standarization of the | 34 | the plugin developers and encourage the standardization of the |
35 | different kind of plugins: C, shell, perl, python, etc.</para> | 35 | different kind of plugins: C, shell, perl, python, etc.</para> |
36 | 36 | ||
37 | <para>Monitoring Plugins Development Guidelines Copyright (C) 2000-2013 | 37 | <para>Monitoring Plugins Development Guidelines Copyright (C) 2000-2013 |
@@ -374,7 +374,7 @@ | |||
374 | <listitem><para>s - seconds (also us, ms)</para></listitem> | 374 | <listitem><para>s - seconds (also us, ms)</para></listitem> |
375 | <listitem><para>% - percentage</para></listitem> | 375 | <listitem><para>% - percentage</para></listitem> |
376 | <listitem><para>B - bytes (also KB, MB, TB)</para></listitem> | 376 | <listitem><para>B - bytes (also KB, MB, TB)</para></listitem> |
377 | <listitem><para>c - a continous counter (such as bytes | 377 | <listitem><para>c - a continuous counter (such as bytes |
378 | transmitted on an interface)</para></listitem> | 378 | transmitted on an interface)</para></listitem> |
379 | </orderedlist> | 379 | </orderedlist> |
380 | </listitem> | 380 | </listitem> |
@@ -397,7 +397,7 @@ | |||
397 | <section><title>Don't execute system commands without specifying their | 397 | <section><title>Don't execute system commands without specifying their |
398 | full path</title> | 398 | full path</title> |
399 | <para>Don't use exec(), popen(), etc. to execute external | 399 | <para>Don't use exec(), popen(), etc. to execute external |
400 | commands without explicity using the full path of the external | 400 | commands without explicitly using the full path of the external |
401 | program.</para> | 401 | program.</para> |
402 | 402 | ||
403 | <para>Doing otherwise makes the plugin vulnerable to hijacking | 403 | <para>Doing otherwise makes the plugin vulnerable to hijacking |
@@ -655,7 +655,7 @@ | |||
655 | <para>If possible when writing lists, use tokens to make the | 655 | <para>If possible when writing lists, use tokens to make the |
656 | list easy to remember and non-order dependent - so | 656 | list easy to remember and non-order dependent - so |
657 | check_disk uses '-c 10000,10%' so that it is clear which is | 657 | check_disk uses '-c 10000,10%' so that it is clear which is |
658 | the precentage and which is the KB values (note that due to | 658 | the percentage and which is the KB values (note that due to |
659 | my own lack of foresight, that used to be '-c 10000:10%' but | 659 | my own lack of foresight, that used to be '-c 10000:10%' but |
660 | such constructs should all be changed for consistency, | 660 | such constructs should all be changed for consistency, |
661 | though providing reverse compatibility is fairly | 661 | though providing reverse compatibility is fairly |
@@ -686,7 +686,7 @@ all the current tests and report an overall success rate. | |||
686 | <para>These use perl's Test::More. To do a one time test, run "cd plugins && perl t/check_disk.t". | 686 | <para>These use perl's Test::More. To do a one time test, run "cd plugins && perl t/check_disk.t". |
687 | </para> | 687 | </para> |
688 | 688 | ||
689 | <para>There will somtimes be failures seen in this output which are known failures that | 689 | <para>There will sometimes be failures seen in this output which are known failures that |
690 | need to be fixed. As long as the return code is 0, it will be reported as "test pass". | 690 | need to be fixed. As long as the return code is 0, it will be reported as "test pass". |
691 | (If you have a fix so that the specific test passes, that will be gratefully received!) | 691 | (If you have a fix so that the specific test passes, that will be gratefully received!) |
692 | </para> | 692 | </para> |
@@ -846,7 +846,7 @@ setup the tests. Run "make test" to run all the tests. | |||
846 | <para>It is determined to be not redundant (for instance, we would not | 846 | <para>It is determined to be not redundant (for instance, we would not |
847 | add a new version of check_disk just because someone had provide | 847 | add a new version of check_disk just because someone had provide |
848 | a plugin that had perf checking - we would incorporate the features | 848 | a plugin that had perf checking - we would incorporate the features |
849 | into an exisiting plugin)</para> | 849 | into an existing plugin)</para> |
850 | </listitem> | 850 | </listitem> |
851 | <listitem> | 851 | <listitem> |
852 | <para>One of the developers has had the time to audit the code and declare | 852 | <para>One of the developers has had the time to audit the code and declare |
diff --git a/lib/parse_ini.c b/lib/parse_ini.c index 25abc89b..547af433 100644 --- a/lib/parse_ini.c +++ b/lib/parse_ini.c | |||
@@ -78,7 +78,7 @@ static char *default_file_in_path(void); | |||
78 | /* | 78 | /* |
79 | * Parse_locator decomposes a string of the form | 79 | * Parse_locator decomposes a string of the form |
80 | * [stanza][@filename] | 80 | * [stanza][@filename] |
81 | * into its seperate parts. | 81 | * into its separate parts. |
82 | */ | 82 | */ |
83 | static void | 83 | static void |
84 | parse_locator(const char *locator, const char *def_stanza, np_ini_info *i) | 84 | parse_locator(const char *locator, const char *def_stanza, np_ini_info *i) |
@@ -169,7 +169,7 @@ read_defaults(FILE *f, const char *stanza, np_arg_list **opts) | |||
169 | if (isspace(c)) | 169 | if (isspace(c)) |
170 | continue; | 170 | continue; |
171 | switch (c) { | 171 | switch (c) { |
172 | /* globble up coment lines */ | 172 | /* globble up comment lines */ |
173 | case ';': | 173 | case ';': |
174 | case '#': | 174 | case '#': |
175 | GOBBLE_TO(f, c, '\n'); | 175 | GOBBLE_TO(f, c, '\n'); |
diff --git a/lib/tests/test_cmd.c b/lib/tests/test_cmd.c index 29ca42ac..4bb60aac 100644 --- a/lib/tests/test_cmd.c +++ b/lib/tests/test_cmd.c | |||
@@ -176,14 +176,14 @@ main (int argc, char **argv) | |||
176 | ok (result == UNSET, "(initialised) Checking exit code is reset"); | 176 | ok (result == UNSET, "(initialised) Checking exit code is reset"); |
177 | 177 | ||
178 | command = (char *)malloc(COMMAND_LINE); | 178 | command = (char *)malloc(COMMAND_LINE); |
179 | strcpy(command, "/bin/echo3456 non-existant command"); | 179 | strcpy(command, "/bin/echo3456 non-existent command"); |
180 | result = cmd_run (command, &chld_out, &chld_err, 0); | 180 | result = cmd_run (command, &chld_out, &chld_err, 0); |
181 | 181 | ||
182 | ok (chld_out.lines == 0, | 182 | ok (chld_out.lines == 0, |
183 | "Non existant command, so no output"); | 183 | "Non existent command, so no output"); |
184 | ok (chld_err.lines == 0, | 184 | ok (chld_err.lines == 0, |
185 | "No stderr either"); | 185 | "No stderr either"); |
186 | ok (result == 3, "Get return code 3 (?) for non-existant command"); | 186 | ok (result == 3, "Get return code 3 (?) for non-existent command"); |
187 | 187 | ||
188 | 188 | ||
189 | /* ensure everything is empty again */ | 189 | /* ensure everything is empty again */ |
@@ -192,14 +192,14 @@ main (int argc, char **argv) | |||
192 | result = UNSET; | 192 | result = UNSET; |
193 | 193 | ||
194 | command = (char *)malloc(COMMAND_LINE); | 194 | command = (char *)malloc(COMMAND_LINE); |
195 | strcpy(command, "/bin/sh non-existant-file"); | 195 | strcpy(command, "/bin/sh non-existent-file"); |
196 | result = cmd_run (command, &chld_out, &chld_err, 0); | 196 | result = cmd_run (command, &chld_out, &chld_err, 0); |
197 | 197 | ||
198 | ok (chld_out.lines == 0, | 198 | ok (chld_out.lines == 0, |
199 | "/bin/sh returns no stdout when file is missing..."); | 199 | "/bin/sh returns no stdout when file is missing..."); |
200 | ok (chld_err.lines == 1, | 200 | ok (chld_err.lines == 1, |
201 | "...but does give an error line"); | 201 | "...but does give an error line"); |
202 | ok (strstr(chld_err.line[0],"non-existant-file") != NULL, "And missing filename is in error message"); | 202 | ok (strstr(chld_err.line[0],"non-existent-file") != NULL, "And missing filename is in error message"); |
203 | ok (result != 0, "Get non-zero return code from /bin/sh"); | 203 | ok (result != 0, "Get non-zero return code from /bin/sh"); |
204 | 204 | ||
205 | 205 | ||
@@ -219,11 +219,11 @@ main (int argc, char **argv) | |||
219 | result = UNSET; | 219 | result = UNSET; |
220 | 220 | ||
221 | command = (char *)malloc(COMMAND_LINE); | 221 | command = (char *)malloc(COMMAND_LINE); |
222 | strcpy(command, "/bin/non-existant-command"); | 222 | strcpy(command, "/bin/non-existent-command"); |
223 | result = cmd_run (command, &chld_out, &chld_err, 0); | 223 | result = cmd_run (command, &chld_out, &chld_err, 0); |
224 | 224 | ||
225 | ok (chld_out.lines == 0, | 225 | ok (chld_out.lines == 0, |
226 | "/bin/non-existant-command returns no stdout..."); | 226 | "/bin/non-existent-command returns no stdout..."); |
227 | ok (chld_err.lines == 0, | 227 | ok (chld_err.lines == 0, |
228 | "...and no stderr output either"); | 228 | "...and no stderr output either"); |
229 | ok (result == 3, "Get return code 3 = UNKNOWN when command does not exist"); | 229 | ok (result == 3, "Get return code 3 = UNKNOWN when command does not exist"); |
diff --git a/lib/tests/test_disk.c b/lib/tests/test_disk.c index f6477ac4..9bd68c7a 100644 --- a/lib/tests/test_disk.c +++ b/lib/tests/test_disk.c | |||
@@ -88,10 +88,10 @@ main (int argc, char **argv) | |||
88 | cflags, 3,strdup("regex on dev names:")); | 88 | cflags, 3,strdup("regex on dev names:")); |
89 | np_test_mount_entry_regex(dummy_mount_list, strdup("/foo"), | 89 | np_test_mount_entry_regex(dummy_mount_list, strdup("/foo"), |
90 | cflags, 0, | 90 | cflags, 0, |
91 | strdup("regex on non existant dev/path:")); | 91 | strdup("regex on non existent dev/path:")); |
92 | np_test_mount_entry_regex(dummy_mount_list, strdup("/Foo"), | 92 | np_test_mount_entry_regex(dummy_mount_list, strdup("/Foo"), |
93 | cflags | REG_ICASE,0, | 93 | cflags | REG_ICASE,0, |
94 | strdup("regi on non existant dev/path:")); | 94 | strdup("regi on non existent dev/path:")); |
95 | np_test_mount_entry_regex(dummy_mount_list, strdup("/c.t0"), | 95 | np_test_mount_entry_regex(dummy_mount_list, strdup("/c.t0"), |
96 | cflags, 3, | 96 | cflags, 3, |
97 | strdup("partial devname regex match:")); | 97 | strdup("partial devname regex match:")); |
diff --git a/lib/tests/test_ini3.t b/lib/tests/test_ini3.t index a2ca94a4..41169dbc 100755 --- a/lib/tests/test_ini3.t +++ b/lib/tests/test_ini3.t | |||
@@ -10,7 +10,7 @@ if (! -e "./test_ini3") { | |||
10 | # array of argument arrays | 10 | # array of argument arrays |
11 | # - First value is the expected return code | 11 | # - First value is the expected return code |
12 | # - 2nd value is the NAGIOS_CONFIG_PATH | 12 | # - 2nd value is the NAGIOS_CONFIG_PATH |
13 | # TODO: looks like we look in default path after looking trough this variable - shall we? | 13 | # TODO: looks like we look in default path after looking through this variable - shall we? |
14 | # - 3rd value is the plugin name | 14 | # - 3rd value is the plugin name |
15 | # - 4th is the ini locator | 15 | # - 4th is the ini locator |
16 | my @TESTS = ( | 16 | my @TESTS = ( |
diff --git a/lib/tests/test_opts3.t b/lib/tests/test_opts3.t index 8d974ca0..d77a35ce 100755 --- a/lib/tests/test_opts3.t +++ b/lib/tests/test_opts3.t | |||
@@ -10,7 +10,7 @@ if (! -e "./test_opts3") { | |||
10 | # array of argument arrays | 10 | # array of argument arrays |
11 | # - First value is the expected return code | 11 | # - First value is the expected return code |
12 | # - 2nd value is the NAGIOS_CONFIG_PATH | 12 | # - 2nd value is the NAGIOS_CONFIG_PATH |
13 | # TODO: looks like we look in default path after looking trough this variable - shall we? | 13 | # TODO: looks like we look in default path after looking through this variable - shall we? |
14 | # - 3rd value is the plugin name | 14 | # - 3rd value is the plugin name |
15 | # - 4th and up are arguments | 15 | # - 4th and up are arguments |
16 | my @TESTS = ( | 16 | my @TESTS = ( |
diff --git a/lib/tests/test_utils.c b/lib/tests/test_utils.c index bc00fac1..7b10494c 100644 --- a/lib/tests/test_utils.c +++ b/lib/tests/test_utils.c | |||
@@ -395,7 +395,7 @@ main (int argc, char **argv) | |||
395 | ok( temp_state_data==NULL, "Older data version gives NULL" ); | 395 | ok( temp_state_data==NULL, "Older data version gives NULL" ); |
396 | temp_state_key->data_version=54; | 396 | temp_state_key->data_version=54; |
397 | 397 | ||
398 | temp_state_key->_filename="var/nonexistant"; | 398 | temp_state_key->_filename="var/nonexistent"; |
399 | temp_state_data = np_state_read(); | 399 | temp_state_data = np_state_read(); |
400 | ok( temp_state_data==NULL, "Missing file gives NULL" ); | 400 | ok( temp_state_data==NULL, "Missing file gives NULL" ); |
401 | ok( this_monitoring_plugin->state->state_data==NULL, "No state information" ); | 401 | ok( this_monitoring_plugin->state->state_data==NULL, "No state information" ); |
diff --git a/lib/utils_cmd.c b/lib/utils_cmd.c index 795840d3..8b8e5708 100644 --- a/lib/utils_cmd.c +++ b/lib/utils_cmd.c | |||
@@ -161,7 +161,7 @@ _cmd_open (char *const *argv, int *pfd, int *pfderr) | |||
161 | } | 161 | } |
162 | 162 | ||
163 | /* parent picks up execution here */ | 163 | /* parent picks up execution here */ |
164 | /* close childs descriptors in our address space */ | 164 | /* close children descriptors in our address space */ |
165 | close (pfd[1]); | 165 | close (pfd[1]); |
166 | close (pfderr[1]); | 166 | close (pfderr[1]); |
167 | 167 | ||
diff --git a/lib/utils_disk.c b/lib/utils_disk.c index 4f16068a..468769b1 100644 --- a/lib/utils_disk.c +++ b/lib/utils_disk.c | |||
@@ -47,9 +47,10 @@ np_add_parameter(struct parameter_list **list, const char *name) | |||
47 | struct parameter_list *current = *list; | 47 | struct parameter_list *current = *list; |
48 | struct parameter_list *new_path; | 48 | struct parameter_list *new_path; |
49 | new_path = (struct parameter_list *) malloc (sizeof *new_path); | 49 | new_path = (struct parameter_list *) malloc (sizeof *new_path); |
50 | new_path->name = (char *) name; | 50 | new_path->name = (char *) malloc(strlen(name) + 1); |
51 | new_path->best_match = NULL; | 51 | new_path->best_match = NULL; |
52 | new_path->name_next = NULL; | 52 | new_path->name_next = NULL; |
53 | new_path->name_prev = NULL; | ||
53 | new_path->freespace_bytes = NULL; | 54 | new_path->freespace_bytes = NULL; |
54 | new_path->freespace_units = NULL; | 55 | new_path->freespace_units = NULL; |
55 | new_path->freespace_percent = NULL; | 56 | new_path->freespace_percent = NULL; |
@@ -75,13 +76,17 @@ np_add_parameter(struct parameter_list **list, const char *name) | |||
75 | new_path->dused_inodes_percent = 0; | 76 | new_path->dused_inodes_percent = 0; |
76 | new_path->dfree_inodes_percent = 0; | 77 | new_path->dfree_inodes_percent = 0; |
77 | 78 | ||
79 | strcpy(new_path->name, name); | ||
80 | |||
78 | if (current == NULL) { | 81 | if (current == NULL) { |
79 | *list = new_path; | 82 | *list = new_path; |
83 | new_path->name_prev = NULL; | ||
80 | } else { | 84 | } else { |
81 | while (current->name_next) { | 85 | while (current->name_next) { |
82 | current = current->name_next; | 86 | current = current->name_next; |
83 | } | 87 | } |
84 | current->name_next = new_path; | 88 | current->name_next = new_path; |
89 | new_path->name_prev = current; | ||
85 | } | 90 | } |
86 | return new_path; | 91 | return new_path; |
87 | } | 92 | } |
@@ -90,6 +95,9 @@ np_add_parameter(struct parameter_list **list, const char *name) | |||
90 | struct parameter_list * | 95 | struct parameter_list * |
91 | np_del_parameter(struct parameter_list *item, struct parameter_list *prev) | 96 | np_del_parameter(struct parameter_list *item, struct parameter_list *prev) |
92 | { | 97 | { |
98 | if (item == NULL) { | ||
99 | return NULL; | ||
100 | } | ||
93 | struct parameter_list *next; | 101 | struct parameter_list *next; |
94 | 102 | ||
95 | if (item->name_next) | 103 | if (item->name_next) |
@@ -97,10 +105,17 @@ np_del_parameter(struct parameter_list *item, struct parameter_list *prev) | |||
97 | else | 105 | else |
98 | next = NULL; | 106 | next = NULL; |
99 | 107 | ||
100 | free(item); | 108 | if (next) |
109 | next->name_prev = prev; | ||
110 | |||
101 | if (prev) | 111 | if (prev) |
102 | prev->name_next = next; | 112 | prev->name_next = next; |
103 | 113 | ||
114 | if (item->name) { | ||
115 | free(item->name); | ||
116 | } | ||
117 | free(item); | ||
118 | |||
104 | return next; | 119 | return next; |
105 | } | 120 | } |
106 | 121 | ||
diff --git a/lib/utils_disk.h b/lib/utils_disk.h index bf52e4ce..3b5a45f8 100644 --- a/lib/utils_disk.h +++ b/lib/utils_disk.h | |||
@@ -24,6 +24,7 @@ struct parameter_list | |||
24 | char *group; | 24 | char *group; |
25 | struct mount_entry *best_match; | 25 | struct mount_entry *best_match; |
26 | struct parameter_list *name_next; | 26 | struct parameter_list *name_next; |
27 | struct parameter_list *name_prev; | ||
27 | uintmax_t total, available, available_to_root, used, | 28 | uintmax_t total, available, available_to_root, used, |
28 | inodes_free, inodes_free_to_root, inodes_used, inodes_total; | 29 | inodes_free, inodes_free_to_root, inodes_used, inodes_total; |
29 | double dfree_pct, dused_pct; | 30 | double dfree_pct, dused_pct; |
diff --git a/m4/np_mysqlclient.m4 b/m4/np_mysqlclient.m4 index 5099a02b..9f533ea3 100644 --- a/m4/np_mysqlclient.m4 +++ b/m4/np_mysqlclient.m4 | |||
@@ -81,7 +81,7 @@ AC_DEFUN([np_check_lib_mariadbclient], | |||
81 | ], [with_mysql=no], [$np_mysql_libs]) | 81 | ], [with_mysql=no], [$np_mysql_libs]) |
82 | ]) | 82 | ]) |
83 | 83 | ||
84 | dnl Will take $1, find last occurrance of -LDIR and add DIR to LD_RUN_PATH | 84 | dnl Will take $1, find last occurrence of -LDIR and add DIR to LD_RUN_PATH |
85 | AC_DEFUN([np_add_to_runpath], | 85 | AC_DEFUN([np_add_to_runpath], |
86 | [ | 86 | [ |
87 | dnl Need [[ ]] so autoconf gives us just one set | 87 | dnl Need [[ ]] so autoconf gives us just one set |
diff --git a/m4/uriparser.m4 b/m4/uriparser.m4 index dbb8a551..5113638f 100644 --- a/m4/uriparser.m4 +++ b/m4/uriparser.m4 | |||
@@ -1,4 +1,4 @@ | |||
1 | # (this check is rougly based on and inspired libcurl.m4) | 1 | # (this check is roughly based on and inspired libcurl.m4) |
2 | # URIPARSER_CHECK ([DEFAULT-ACTION], [MINIMUM-VERSION], | 2 | # URIPARSER_CHECK ([DEFAULT-ACTION], [MINIMUM-VERSION], |
3 | # [ACTION-IF-YES], [ACTION-IF-NO]) | 3 | # [ACTION-IF-YES], [ACTION-IF-NO]) |
4 | # Checks for uriparser library. DEFAULT-ACTION is the string yes or no to | 4 | # Checks for uriparser library. DEFAULT-ACTION is the string yes or no to |
diff --git a/plugins-root/check_icmp.c b/plugins-root/check_icmp.c index c3be2efd..9ceb35b2 100644 --- a/plugins-root/check_icmp.c +++ b/plugins-root/check_icmp.c | |||
@@ -274,7 +274,7 @@ get_icmp_error_msg(unsigned char icmp_type, unsigned char icmp_code) | |||
274 | break; | 274 | break; |
275 | 275 | ||
276 | case ICMP_TIMXCEED: | 276 | case ICMP_TIMXCEED: |
277 | /* really 'out of reach', or non-existant host behind a router serving | 277 | /* really 'out of reach', or non-existent host behind a router serving |
278 | * two different subnets */ | 278 | * two different subnets */ |
279 | switch(icmp_code) { | 279 | switch(icmp_code) { |
280 | case ICMP_TIMXCEED_INTRANS: msg = "Time to live exceeded in transit"; break; | 280 | case ICMP_TIMXCEED_INTRANS: msg = "Time to live exceeded in transit"; break; |
diff --git a/plugins-root/pst3.c b/plugins-root/pst3.c index c3589f0a..1f69f3a6 100644 --- a/plugins-root/pst3.c +++ b/plugins-root/pst3.c | |||
@@ -257,6 +257,6 @@ void usage() { | |||
257 | printf("\tRSS - Real memory usage (kilobytes)\n"); | 257 | printf("\tRSS - Real memory usage (kilobytes)\n"); |
258 | printf("\t%%CPU - CPU usage\n"); | 258 | printf("\t%%CPU - CPU usage\n"); |
259 | printf("\tCOMMAND - Command being run\n"); | 259 | printf("\tCOMMAND - Command being run\n"); |
260 | printf("\tARGS - Full command line with arguements\n"); | 260 | printf("\tARGS - Full command line with arguments\n"); |
261 | return; | 261 | return; |
262 | } | 262 | } |
diff --git a/plugins-root/t/check_icmp.t b/plugins-root/t/check_icmp.t index f6aa6813..96addd3b 100644 --- a/plugins-root/t/check_icmp.t +++ b/plugins-root/t/check_icmp.t | |||
@@ -92,5 +92,5 @@ like( $res->output, $successOutput, "Output OK" ); | |||
92 | $res = NPTest->testCmd( | 92 | $res = NPTest->testCmd( |
93 | "$sudo ./check_icmp -H $host_responsive -b 65507" | 93 | "$sudo ./check_icmp -H $host_responsive -b 65507" |
94 | ); | 94 | ); |
95 | is( $res->return_code, 0, "Try max paket size" ); | 95 | is( $res->return_code, 0, "Try max packet size" ); |
96 | like( $res->output, $successOutput, "Output OK - Didn't overflow" ); | 96 | like( $res->output, $successOutput, "Output OK - Didn't overflow" ); |
diff --git a/plugins-scripts/Makefile.am b/plugins-scripts/Makefile.am index 088a4459..7879791f 100644 --- a/plugins-scripts/Makefile.am +++ b/plugins-scripts/Makefile.am | |||
@@ -16,13 +16,13 @@ VPATH=$(top_srcdir) $(top_srcdir)/plugins-scripts $(top_srcdir)/plugins-scripts/ | |||
16 | libexec_SCRIPTS = check_breeze check_disk_smb check_flexlm check_ircd \ | 16 | libexec_SCRIPTS = check_breeze check_disk_smb check_flexlm check_ircd \ |
17 | check_log check_oracle check_rpc check_sensors check_wave \ | 17 | check_log check_oracle check_rpc check_sensors check_wave \ |
18 | check_ifstatus check_ifoperstatus check_mailq check_file_age \ | 18 | check_ifstatus check_ifoperstatus check_mailq check_file_age \ |
19 | check_uptime \ | 19 | check_uptime check_mssql \ |
20 | utils.sh utils.pm | 20 | utils.sh utils.pm |
21 | 21 | ||
22 | EXTRA_DIST=check_breeze.pl check_disk_smb.pl check_flexlm.pl check_ircd.pl \ | 22 | EXTRA_DIST=check_breeze.pl check_disk_smb.pl check_flexlm.pl check_ircd.pl \ |
23 | check_log.sh check_oracle.sh check_rpc.pl check_sensors.sh \ | 23 | check_log.sh check_oracle.sh check_rpc.pl check_sensors.sh \ |
24 | check_ifstatus.pl check_ifoperstatus.pl check_wave.pl check_mailq.pl check_file_age.pl \ | 24 | check_ifstatus.pl check_ifoperstatus.pl check_wave.pl check_mailq.pl check_file_age.pl \ |
25 | check_uptime.pl \ | 25 | check_uptime.pl check_mssql.pl \ |
26 | utils.sh.in utils.pm.in t | 26 | utils.sh.in utils.pm.in t |
27 | 27 | ||
28 | EDIT = sed \ | 28 | EDIT = sed \ |
diff --git a/plugins-scripts/check_disk_smb.pl b/plugins-scripts/check_disk_smb.pl index 15d16340..f4d33a7b 100644 --- a/plugins-scripts/check_disk_smb.pl +++ b/plugins-scripts/check_disk_smb.pl | |||
@@ -28,7 +28,7 @@ use FindBin; | |||
28 | use lib "$FindBin::Bin"; | 28 | use lib "$FindBin::Bin"; |
29 | use utils qw($TIMEOUT %ERRORS &print_revision &support &usage); | 29 | use utils qw($TIMEOUT %ERRORS &print_revision &support &usage); |
30 | 30 | ||
31 | # make us session leader which makes all childs exit if we do | 31 | # make us session leader which makes all children exit if we do |
32 | setsid; | 32 | setsid; |
33 | 33 | ||
34 | sub print_help (); | 34 | sub print_help (); |
diff --git a/plugins-scripts/check_ifoperstatus.pl b/plugins-scripts/check_ifoperstatus.pl index c190ce95..e335cdad 100755 --- a/plugins-scripts/check_ifoperstatus.pl +++ b/plugins-scripts/check_ifoperstatus.pl | |||
@@ -134,7 +134,7 @@ if (defined $ifdescr || defined $iftype) { | |||
134 | } | 134 | } |
135 | if ($status==0) { | 135 | if ($status==0) { |
136 | $state = "UNKNOWN"; | 136 | $state = "UNKNOWN"; |
137 | printf "$state: could not retrive ifdescr/iftype snmpkey - $status-$snmpkey\n"; | 137 | printf "$state: could not retrieve ifdescr/iftype snmpkey - $status-$snmpkey\n"; |
138 | $session->close; | 138 | $session->close; |
139 | exit $ERRORS{$state}; | 139 | exit $ERRORS{$state}; |
140 | } | 140 | } |
@@ -187,7 +187,7 @@ if (defined $ifXTable) { | |||
187 | $name = $response->{$snmpIfDescr} ; | 187 | $name = $response->{$snmpIfDescr} ; |
188 | } | 188 | } |
189 | 189 | ||
190 | ## if AdminStatus is down - some one made a consious effort to change config | 190 | ## if AdminStatus is down - some one made a conscious effort to change config |
191 | ## | 191 | ## |
192 | if ( not ($response->{$snmpIfAdminStatus} == 1) ) { | 192 | if ( not ($response->{$snmpIfAdminStatus} == 1) ) { |
193 | $answer = "Interface $name (index $snmpkey) is administratively down."; | 193 | $answer = "Interface $name (index $snmpkey) is administratively down."; |
@@ -286,7 +286,7 @@ sub print_usage() { | |||
286 | printf "check_ifoperstatus -k <IF_KEY> -H <HOSTNAME> [-C <community>]\n"; | 286 | printf "check_ifoperstatus -k <IF_KEY> -H <HOSTNAME> [-C <community>]\n"; |
287 | printf "Copyright (C) 2000 Christoph Kron\n"; | 287 | printf "Copyright (C) 2000 Christoph Kron\n"; |
288 | printf "check_ifoperstatus.pl comes with ABSOLUTELY NO WARRANTY\n"; | 288 | printf "check_ifoperstatus.pl comes with ABSOLUTELY NO WARRANTY\n"; |
289 | printf "This programm is licensed under the terms of the "; | 289 | printf "This program is licensed under the terms of the "; |
290 | printf "GNU General Public License\n(check source code for details)\n"; | 290 | printf "GNU General Public License\n(check source code for details)\n"; |
291 | printf "\n\n"; | 291 | printf "\n\n"; |
292 | } | 292 | } |
@@ -424,7 +424,7 @@ sub process_arguments() { | |||
424 | if (defined $seclevel && defined $secname) { | 424 | if (defined $seclevel && defined $secname) { |
425 | $session_opts{'-username'} = $secname; | 425 | $session_opts{'-username'} = $secname; |
426 | 426 | ||
427 | # Must define a security level even though defualt is noAuthNoPriv | 427 | # Must define a security level even though default is noAuthNoPriv |
428 | unless ( grep /^$seclevel$/, qw(noAuthNoPriv authNoPriv authPriv) ) { | 428 | unless ( grep /^$seclevel$/, qw(noAuthNoPriv authNoPriv authPriv) ) { |
429 | usage("Must define a valid security level even though default is noAuthNoPriv"); | 429 | usage("Must define a valid security level even though default is noAuthNoPriv"); |
430 | } | 430 | } |
diff --git a/plugins-scripts/check_ifstatus.pl b/plugins-scripts/check_ifstatus.pl index 32984e53..38b87fcc 100755 --- a/plugins-scripts/check_ifstatus.pl +++ b/plugins-scripts/check_ifstatus.pl | |||
@@ -354,7 +354,7 @@ sub process_arguments() { | |||
354 | if (defined $seclevel && defined $secname) { | 354 | if (defined $seclevel && defined $secname) { |
355 | $session_opts{'-username'} = $secname; | 355 | $session_opts{'-username'} = $secname; |
356 | 356 | ||
357 | # Must define a security level even though defualt is noAuthNoPriv | 357 | # Must define a security level even though default is noAuthNoPriv |
358 | unless ( grep /^$seclevel$/, qw(noAuthNoPriv authNoPriv authPriv) ) { | 358 | unless ( grep /^$seclevel$/, qw(noAuthNoPriv authNoPriv authPriv) ) { |
359 | usage("Must define a valid security level even though default is noAuthNoPriv"); | 359 | usage("Must define a valid security level even though default is noAuthNoPriv"); |
360 | } | 360 | } |
diff --git a/plugins-scripts/check_ircd.pl b/plugins-scripts/check_ircd.pl index d869ae7b..84f20229 100755 --- a/plugins-scripts/check_ircd.pl +++ b/plugins-scripts/check_ircd.pl | |||
@@ -60,7 +60,7 @@ sub print_usage (); | |||
60 | sub connection ($$$$); | 60 | sub connection ($$$$); |
61 | sub bindRemote ($$); | 61 | sub bindRemote ($$); |
62 | 62 | ||
63 | # -------------------------------------------------------------[ Enviroment ]-- | 63 | # -------------------------------------------------------------[ Environment ]-- |
64 | 64 | ||
65 | $ENV{'PATH'}='@TRUSTED_PATH@'; | 65 | $ENV{'PATH'}='@TRUSTED_PATH@'; |
66 | $ENV{'BASH_ENV'}=''; | 66 | $ENV{'BASH_ENV'}=''; |
@@ -208,7 +208,7 @@ MAIN: | |||
208 | 208 | ||
209 | # Just in case of problems, let's not hang the monitoring system | 209 | # Just in case of problems, let's not hang the monitoring system |
210 | $SIG{'ALRM'} = sub { | 210 | $SIG{'ALRM'} = sub { |
211 | print "Somthing is Taking a Long Time, Increase Your TIMEOUT (Currently Set At $TIMEOUT Seconds)\n"; | 211 | print "Something is Taking a Long Time, Increase Your TIMEOUT (Currently Set At $TIMEOUT Seconds)\n"; |
212 | exit $ERRORS{"UNKNOWN"}; | 212 | exit $ERRORS{"UNKNOWN"}; |
213 | }; | 213 | }; |
214 | 214 | ||
diff --git a/plugins-scripts/check_mailq.pl b/plugins-scripts/check_mailq.pl index 27073d3c..49156af3 100755 --- a/plugins-scripts/check_mailq.pl +++ b/plugins-scripts/check_mailq.pl | |||
@@ -4,7 +4,7 @@ | |||
4 | # transmittal. | 4 | # transmittal. |
5 | # | 5 | # |
6 | # Initial version support sendmail's mailq command | 6 | # Initial version support sendmail's mailq command |
7 | # Support for mutiple sendmail queues (Carlos Canau) | 7 | # Support for multiple sendmail queues (Carlos Canau) |
8 | # Support for qmail (Benjamin Schmid) | 8 | # Support for qmail (Benjamin Schmid) |
9 | 9 | ||
10 | # License Information: | 10 | # License Information: |
@@ -149,7 +149,26 @@ if ($mailq eq "sendmail") { | |||
149 | ##/var/spool/mqueue/qF/df is empty | 149 | ##/var/spool/mqueue/qF/df is empty |
150 | ## Total Requests: 1 | 150 | ## Total Requests: 1 |
151 | 151 | ||
152 | 152 | # separate submission/transport queues, empty | |
153 | ## MSP Queue status... | ||
154 | ## /var/spool/mqueue-client is empty | ||
155 | ## Total requests: 0 | ||
156 | ## MTA Queue status... | ||
157 | ## /var/spool/mqueue is empty | ||
158 | ## Total requests: 0 | ||
159 | # separate submission/transport queues: 1 | ||
160 | ## MSP Queue status... | ||
161 | ## /var/spool/mqueue-client (1 request) | ||
162 | ## -----Q-ID----- --Size-- -----Q-Time----- ------------Sender/Recipient----------- | ||
163 | ## oAJEfhdW014123 5 Fri Nov 19 14:41 jwm | ||
164 | ## (Deferred: Connection refused by [127.0.0.1]) | ||
165 | ## root | ||
166 | ## Total requests: 1 | ||
167 | ## MTA Queue status... | ||
168 | ## /var/spool/mqueue is empty | ||
169 | ## Total requests: 0 | ||
170 | |||
171 | my $this_msg_q = 0; | ||
153 | while (<MAILQ>) { | 172 | while (<MAILQ>) { |
154 | 173 | ||
155 | # match email addr on queue listing | 174 | # match email addr on queue listing |
@@ -189,13 +208,18 @@ if ($mailq eq "sendmail") { | |||
189 | # | 208 | # |
190 | # single queue: first line | 209 | # single queue: first line |
191 | # multi queue: one for each queue. overwrite on multi queue below | 210 | # multi queue: one for each queue. overwrite on multi queue below |
192 | $msg_q = $1 ; | 211 | $this_msg_q = $1 ; |
212 | $msg_q += $1 ; | ||
193 | } | 213 | } |
194 | } elsif (/^\s+Total\sRequests:\s(\d+)$/i) { | 214 | } elsif (/^\s+Total\sRequests:\s(\d+)$/i) { |
195 | print "$utils::PATH_TO_MAILQ = $_ \n" if $verbose ; | 215 | if ($this_msg_q) { |
196 | # | 216 | $this_msg_q = 0 ; |
197 | # multi queue: last line | 217 | } else { |
198 | $msg_q = $1 ; | 218 | print "$utils::PATH_TO_MAILQ = $_ \n" if $verbose ; |
219 | # | ||
220 | # multi queue: last line | ||
221 | $msg_q += $1 ; | ||
222 | } | ||
199 | } | 223 | } |
200 | 224 | ||
201 | } | 225 | } |
diff --git a/plugins-scripts/check_rpc.pl b/plugins-scripts/check_rpc.pl index 47d6e49e..8a56b9fc 100755 --- a/plugins-scripts/check_rpc.pl +++ b/plugins-scripts/check_rpc.pl | |||
@@ -5,7 +5,7 @@ | |||
5 | # usage: | 5 | # usage: |
6 | # check_rpc host service | 6 | # check_rpc host service |
7 | # | 7 | # |
8 | # Check if an rpc serice is registered and running | 8 | # Check if an rpc service is registered and running |
9 | # using rpcinfo - $proto $host $prognum 2>&1 |"; | 9 | # using rpcinfo - $proto $host $prognum 2>&1 |"; |
10 | # | 10 | # |
11 | # Use these hosts.cfg entries as examples | 11 | # Use these hosts.cfg entries as examples |
diff --git a/plugins-scripts/check_uptime.pl b/plugins-scripts/check_uptime.pl index f9542872..d73e40e1 100755 --- a/plugins-scripts/check_uptime.pl +++ b/plugins-scripts/check_uptime.pl | |||
@@ -110,7 +110,7 @@ $pretty_uptime .= sprintf( "%d week%s, ", $weeks, $weeks == 1 ? "" : "s" ) if | |||
110 | $pretty_uptime .= sprintf( "%d day%s, ", $days, $days == 1 ? "" : "s" ) if $days; | 110 | $pretty_uptime .= sprintf( "%d day%s, ", $days, $days == 1 ? "" : "s" ) if $days; |
111 | $pretty_uptime .= sprintf( "%d hour%s, ", $hours, $hours == 1 ? "" : "s" ) if $hours; | 111 | $pretty_uptime .= sprintf( "%d hour%s, ", $hours, $hours == 1 ? "" : "s" ) if $hours; |
112 | $pretty_uptime .= sprintf( "%d minute%s, ", $mins, $mins == 1 ? "" : "s" ) if $mins; | 112 | $pretty_uptime .= sprintf( "%d minute%s, ", $mins, $mins == 1 ? "" : "s" ) if $mins; |
113 | # Replace last occurence of comma with "and" | 113 | # Replace last occurrence of comma with "and" |
114 | $pretty_uptime =~ s/, $/ and /; | 114 | $pretty_uptime =~ s/, $/ and /; |
115 | # Always print the seconds (though it may be 0 seconds) | 115 | # Always print the seconds (though it may be 0 seconds) |
116 | $pretty_uptime .= sprintf( "%d second%s", $secs, $secs == 1 ? "" : "s" ); | 116 | $pretty_uptime .= sprintf( "%d second%s", $secs, $secs == 1 ? "" : "s" ); |
diff --git a/plugins/check_curl.c b/plugins/check_curl.c index c37d45d9..be5740d7 100644 --- a/plugins/check_curl.c +++ b/plugins/check_curl.c | |||
@@ -55,6 +55,7 @@ const char *email = "devel@monitoring-plugins.org"; | |||
55 | #include "uriparser/Uri.h" | 55 | #include "uriparser/Uri.h" |
56 | 56 | ||
57 | #include <arpa/inet.h> | 57 | #include <arpa/inet.h> |
58 | #include <netinet/in.h> | ||
58 | 59 | ||
59 | #if defined(HAVE_SSL) && defined(USE_OPENSSL) | 60 | #if defined(HAVE_SSL) && defined(USE_OPENSSL) |
60 | #include <openssl/opensslv.h> | 61 | #include <openssl/opensslv.h> |
@@ -384,8 +385,11 @@ int | |||
384 | lookup_host (const char *host, char *buf, size_t buflen) | 385 | lookup_host (const char *host, char *buf, size_t buflen) |
385 | { | 386 | { |
386 | struct addrinfo hints, *res, *result; | 387 | struct addrinfo hints, *res, *result; |
388 | char addrstr[100]; | ||
389 | size_t addrstr_len; | ||
387 | int errcode; | 390 | int errcode; |
388 | void *ptr; | 391 | void *ptr; |
392 | size_t buflen_remaining = buflen - 1; | ||
389 | 393 | ||
390 | memset (&hints, 0, sizeof (hints)); | 394 | memset (&hints, 0, sizeof (hints)); |
391 | hints.ai_family = address_family; | 395 | hints.ai_family = address_family; |
@@ -395,26 +399,40 @@ lookup_host (const char *host, char *buf, size_t buflen) | |||
395 | errcode = getaddrinfo (host, NULL, &hints, &result); | 399 | errcode = getaddrinfo (host, NULL, &hints, &result); |
396 | if (errcode != 0) | 400 | if (errcode != 0) |
397 | return errcode; | 401 | return errcode; |
398 | 402 | ||
403 | strcpy(buf, ""); | ||
399 | res = result; | 404 | res = result; |
400 | 405 | ||
401 | while (res) { | 406 | while (res) { |
402 | inet_ntop (res->ai_family, res->ai_addr->sa_data, buf, buflen); | 407 | switch (res->ai_family) { |
403 | switch (res->ai_family) { | 408 | case AF_INET: |
404 | case AF_INET: | 409 | ptr = &((struct sockaddr_in *) res->ai_addr)->sin_addr; |
405 | ptr = &((struct sockaddr_in *) res->ai_addr)->sin_addr; | 410 | break; |
406 | break; | 411 | case AF_INET6: |
407 | case AF_INET6: | 412 | ptr = &((struct sockaddr_in6 *) res->ai_addr)->sin6_addr; |
408 | ptr = &((struct sockaddr_in6 *) res->ai_addr)->sin6_addr; | 413 | break; |
409 | break; | ||
410 | } | 414 | } |
411 | inet_ntop (res->ai_family, ptr, buf, buflen); | 415 | |
412 | if (verbose >= 1) | 416 | inet_ntop (res->ai_family, ptr, addrstr, 100); |
417 | if (verbose >= 1) { | ||
413 | printf ("* getaddrinfo IPv%d address: %s\n", | 418 | printf ("* getaddrinfo IPv%d address: %s\n", |
414 | res->ai_family == PF_INET6 ? 6 : 4, buf); | 419 | res->ai_family == PF_INET6 ? 6 : 4, addrstr); |
420 | } | ||
421 | |||
422 | // Append all IPs to buf as a comma-separated string | ||
423 | addrstr_len = strlen(addrstr); | ||
424 | if (buflen_remaining > addrstr_len + 1) { | ||
425 | if (buf[0] != '\0') { | ||
426 | strncat(buf, ",", buflen_remaining); | ||
427 | buflen_remaining -= 1; | ||
428 | } | ||
429 | strncat(buf, addrstr, buflen_remaining); | ||
430 | buflen_remaining -= addrstr_len; | ||
431 | } | ||
432 | |||
415 | res = res->ai_next; | 433 | res = res->ai_next; |
416 | } | 434 | } |
417 | 435 | ||
418 | freeaddrinfo(result); | 436 | freeaddrinfo(result); |
419 | 437 | ||
420 | return 0; | 438 | return 0; |
@@ -445,7 +463,7 @@ check_http (void) | |||
445 | int i; | 463 | int i; |
446 | char *force_host_header = NULL; | 464 | char *force_host_header = NULL; |
447 | struct curl_slist *host = NULL; | 465 | struct curl_slist *host = NULL; |
448 | char addrstr[100]; | 466 | char addrstr[DEFAULT_BUFFER_SIZE/2]; |
449 | char dnscache[DEFAULT_BUFFER_SIZE]; | 467 | char dnscache[DEFAULT_BUFFER_SIZE]; |
450 | 468 | ||
451 | /* initialize curl */ | 469 | /* initialize curl */ |
@@ -497,7 +515,7 @@ check_http (void) | |||
497 | 515 | ||
498 | // fill dns resolve cache to make curl connect to the given server_address instead of the host_name, only required for ssl, because we use the host_name later on to make SNI happy | 516 | // fill dns resolve cache to make curl connect to the given server_address instead of the host_name, only required for ssl, because we use the host_name later on to make SNI happy |
499 | if(use_ssl && host_name != NULL) { | 517 | if(use_ssl && host_name != NULL) { |
500 | if ( (res=lookup_host (server_address, addrstr, 100)) != 0) { | 518 | if ( (res=lookup_host (server_address, addrstr, DEFAULT_BUFFER_SIZE/2)) != 0) { |
501 | snprintf (msg, DEFAULT_BUFFER_SIZE, _("Unable to lookup IP address for '%s': getaddrinfo returned %d - %s"), | 519 | snprintf (msg, DEFAULT_BUFFER_SIZE, _("Unable to lookup IP address for '%s': getaddrinfo returned %d - %s"), |
502 | server_address, res, gai_strerror (res)); | 520 | server_address, res, gai_strerror (res)); |
503 | die (STATE_CRITICAL, "HTTP CRITICAL - %s\n", msg); | 521 | die (STATE_CRITICAL, "HTTP CRITICAL - %s\n", msg); |
@@ -524,7 +542,7 @@ check_http (void) | |||
524 | /* compose URL: use the address we want to connect to, set Host: header later */ | 542 | /* compose URL: use the address we want to connect to, set Host: header later */ |
525 | snprintf (url, DEFAULT_BUFFER_SIZE, "%s://%s:%d%s", | 543 | snprintf (url, DEFAULT_BUFFER_SIZE, "%s://%s:%d%s", |
526 | use_ssl ? "https" : "http", | 544 | use_ssl ? "https" : "http", |
527 | use_ssl & host_name != NULL ? host_name : server_address, | 545 | ( use_ssl & ( host_name != NULL ) ) ? host_name : server_address, |
528 | server_port, | 546 | server_port, |
529 | server_url | 547 | server_url |
530 | ); | 548 | ); |
@@ -600,7 +618,7 @@ check_http (void) | |||
600 | 618 | ||
601 | #ifdef LIBCURL_FEATURE_SSL | 619 | #ifdef LIBCURL_FEATURE_SSL |
602 | 620 | ||
603 | /* set SSL version, warn about unsecure or unsupported versions */ | 621 | /* set SSL version, warn about insecure or unsupported versions */ |
604 | if (use_ssl) { | 622 | if (use_ssl) { |
605 | handle_curl_option_return_code (curl_easy_setopt (curl, CURLOPT_SSLVERSION, ssl_version), "CURLOPT_SSLVERSION"); | 623 | handle_curl_option_return_code (curl_easy_setopt (curl, CURLOPT_SSLVERSION, ssl_version), "CURLOPT_SSLVERSION"); |
606 | } | 624 | } |
@@ -792,6 +810,9 @@ check_http (void) | |||
792 | /* free header and server IP resolve lists, we don't need it anymore */ | 810 | /* free header and server IP resolve lists, we don't need it anymore */ |
793 | curl_slist_free_all (header_list); header_list = NULL; | 811 | curl_slist_free_all (header_list); header_list = NULL; |
794 | curl_slist_free_all (server_ips); server_ips = NULL; | 812 | curl_slist_free_all (server_ips); server_ips = NULL; |
813 | if (host) { | ||
814 | curl_slist_free_all (host); host = NULL; | ||
815 | } | ||
795 | 816 | ||
796 | /* Curl errors, result in critical Nagios state */ | 817 | /* Curl errors, result in critical Nagios state */ |
797 | if (res != CURLE_OK) { | 818 | if (res != CURLE_OK) { |
@@ -965,7 +986,7 @@ GOT_FIRST_CERT: | |||
965 | } | 986 | } |
966 | } else { | 987 | } else { |
967 | /* this is a specific code in the command line to | 988 | /* this is a specific code in the command line to |
968 | * be returned when a redirection is encoutered | 989 | * be returned when a redirection is encountered |
969 | */ | 990 | */ |
970 | } | 991 | } |
971 | result = max_state_alt (onredirect, result); | 992 | result = max_state_alt (onredirect, result); |
@@ -2030,7 +2051,7 @@ print_usage (void) | |||
2030 | printf (" %s -H <vhost> | -I <IP-address> [-u <uri>] [-p <port>]\n",progname); | 2051 | printf (" %s -H <vhost> | -I <IP-address> [-u <uri>] [-p <port>]\n",progname); |
2031 | printf (" [-J <client certificate file>] [-K <private key>] [--ca-cert <CA certificate file>] [-D]\n"); | 2052 | printf (" [-J <client certificate file>] [-K <private key>] [--ca-cert <CA certificate file>] [-D]\n"); |
2032 | printf (" [-w <warn time>] [-c <critical time>] [-t <timeout>] [-L] [-E] [-a auth]\n"); | 2053 | printf (" [-w <warn time>] [-c <critical time>] [-t <timeout>] [-L] [-E] [-a auth]\n"); |
2033 | printf (" [-b proxy_auth] [-f <ok|warning|critcal|follow|sticky|stickyport|curl>]\n"); | 2054 | printf (" [-b proxy_auth] [-f <ok|warning|critical|follow|sticky|stickyport|curl>]\n"); |
2034 | printf (" [-e <expect>] [-d string] [-s string] [-l] [-r <regex> | -R <case-insensitive regex>]\n"); | 2055 | printf (" [-e <expect>] [-d string] [-s string] [-l] [-r <regex> | -R <case-insensitive regex>]\n"); |
2035 | printf (" [-P string] [-m <min_pg_size>:<max_pg_size>] [-4|-6] [-N] [-M <age>]\n"); | 2056 | printf (" [-P string] [-m <min_pg_size>:<max_pg_size>] [-4|-6] [-N] [-M <age>]\n"); |
2036 | printf (" [-A string] [-k string] [-S <version>] [--sni]\n"); | 2057 | printf (" [-A string] [-k string] [-S <version>] [--sni]\n"); |
diff --git a/plugins/check_disk.c b/plugins/check_disk.c index 935acce0..a99f35e3 100644 --- a/plugins/check_disk.c +++ b/plugins/check_disk.c | |||
@@ -112,11 +112,12 @@ enum | |||
112 | { | 112 | { |
113 | SYNC_OPTION = CHAR_MAX + 1, | 113 | SYNC_OPTION = CHAR_MAX + 1, |
114 | NO_SYNC_OPTION, | 114 | NO_SYNC_OPTION, |
115 | BLOCK_SIZE_OPTION | 115 | BLOCK_SIZE_OPTION, |
116 | IGNORE_MISSING | ||
116 | }; | 117 | }; |
117 | 118 | ||
118 | #ifdef _AIX | 119 | #ifdef _AIX |
119 | #pragma alloca | 120 | #pragma alloca |
120 | #endif | 121 | #endif |
121 | 122 | ||
122 | int process_arguments (int, char **); | 123 | int process_arguments (int, char **); |
@@ -126,7 +127,7 @@ int validate_arguments (uintmax_t, uintmax_t, double, double, double, double, ch | |||
126 | void print_help (void); | 127 | void print_help (void); |
127 | void print_usage (void); | 128 | void print_usage (void); |
128 | double calculate_percent(uintmax_t, uintmax_t); | 129 | double calculate_percent(uintmax_t, uintmax_t); |
129 | void stat_path (struct parameter_list *p); | 130 | bool stat_path (struct parameter_list *p); |
130 | void get_stats (struct parameter_list *p, struct fs_usage *fsp); | 131 | void get_stats (struct parameter_list *p, struct fs_usage *fsp); |
131 | void get_path_stats (struct parameter_list *p, struct fs_usage *fsp); | 132 | void get_path_stats (struct parameter_list *p, struct fs_usage *fsp); |
132 | 133 | ||
@@ -140,6 +141,7 @@ int verbose = 0; | |||
140 | int erronly = FALSE; | 141 | int erronly = FALSE; |
141 | int display_mntp = FALSE; | 142 | int display_mntp = FALSE; |
142 | int exact_match = FALSE; | 143 | int exact_match = FALSE; |
144 | bool ignore_missing = false; | ||
143 | int freespace_ignore_reserved = FALSE; | 145 | int freespace_ignore_reserved = FALSE; |
144 | int display_inodes_perfdata = FALSE; | 146 | int display_inodes_perfdata = FALSE; |
145 | char *warn_freespace_units = NULL; | 147 | char *warn_freespace_units = NULL; |
@@ -155,6 +157,7 @@ char *crit_usedinodes_percent = NULL; | |||
155 | char *warn_freeinodes_percent = NULL; | 157 | char *warn_freeinodes_percent = NULL; |
156 | char *crit_freeinodes_percent = NULL; | 158 | char *crit_freeinodes_percent = NULL; |
157 | int path_selected = FALSE; | 159 | int path_selected = FALSE; |
160 | bool path_ignored = false; | ||
158 | char *group = NULL; | 161 | char *group = NULL; |
159 | struct stat *stat_buf; | 162 | struct stat *stat_buf; |
160 | struct name_list *seen = NULL; | 163 | struct name_list *seen = NULL; |
@@ -166,10 +169,12 @@ main (int argc, char **argv) | |||
166 | int result = STATE_UNKNOWN; | 169 | int result = STATE_UNKNOWN; |
167 | int disk_result = STATE_UNKNOWN; | 170 | int disk_result = STATE_UNKNOWN; |
168 | char *output; | 171 | char *output; |
172 | char *ignored; | ||
169 | char *details; | 173 | char *details; |
170 | char *perf; | 174 | char *perf; |
171 | char *perf_ilabel; | 175 | char *perf_ilabel; |
172 | char *preamble; | 176 | char *preamble = " - free space:"; |
177 | char *ignored_preamble = " - ignored paths:"; | ||
173 | char *flag_header; | 178 | char *flag_header; |
174 | int temp_result; | 179 | int temp_result; |
175 | 180 | ||
@@ -181,8 +186,8 @@ main (int argc, char **argv) | |||
181 | char mountdir[32]; | 186 | char mountdir[32]; |
182 | #endif | 187 | #endif |
183 | 188 | ||
184 | preamble = strdup (" - free space:"); | ||
185 | output = strdup (""); | 189 | output = strdup (""); |
190 | ignored = strdup (""); | ||
186 | details = strdup (""); | 191 | details = strdup (""); |
187 | perf = strdup (""); | 192 | perf = strdup (""); |
188 | perf_ilabel = strdup (""); | 193 | perf_ilabel = strdup (""); |
@@ -203,7 +208,7 @@ main (int argc, char **argv) | |||
203 | /* If a list of paths has not been selected, find entire | 208 | /* If a list of paths has not been selected, find entire |
204 | mount list and create list of paths | 209 | mount list and create list of paths |
205 | */ | 210 | */ |
206 | if (path_selected == FALSE) { | 211 | if (path_selected == FALSE && path_ignored == false) { |
207 | for (me = mount_list; me; me = me->me_next) { | 212 | for (me = mount_list; me; me = me->me_next) { |
208 | if (! (path = np_find_parameter(path_select_list, me->me_mountdir))) { | 213 | if (! (path = np_find_parameter(path_select_list, me->me_mountdir))) { |
209 | path = np_add_parameter(&path_select_list, me->me_mountdir); | 214 | path = np_add_parameter(&path_select_list, me->me_mountdir); |
@@ -213,17 +218,40 @@ main (int argc, char **argv) | |||
213 | set_all_thresholds(path); | 218 | set_all_thresholds(path); |
214 | } | 219 | } |
215 | } | 220 | } |
216 | np_set_best_match(path_select_list, mount_list, exact_match); | 221 | |
222 | if (path_ignored == false) { | ||
223 | np_set_best_match(path_select_list, mount_list, exact_match); | ||
224 | } | ||
217 | 225 | ||
218 | /* Error if no match found for specified paths */ | 226 | /* Error if no match found for specified paths */ |
219 | temp_list = path_select_list; | 227 | temp_list = path_select_list; |
220 | 228 | ||
221 | while (temp_list) { | 229 | while (path_select_list) { |
222 | if (! temp_list->best_match) { | 230 | if (! path_select_list->best_match && ignore_missing == true) { |
223 | die (STATE_CRITICAL, _("DISK %s: %s not found\n"), _("CRITICAL"), temp_list->name); | 231 | /* If the first element will be deleted, the temp_list must be updated with the new start address as well */ |
232 | if (path_select_list == temp_list) { | ||
233 | temp_list = path_select_list->name_next; | ||
234 | } | ||
235 | /* Add path argument to list of ignored paths to inform about missing paths being ignored and not alerted */ | ||
236 | xasprintf (&ignored, "%s %s;", ignored, path_select_list->name); | ||
237 | /* Delete the path from the list so that it is not stat-checked later in the code. */ | ||
238 | path_select_list = np_del_parameter(path_select_list, path_select_list->name_prev); | ||
239 | } else if (! path_select_list->best_match) { | ||
240 | /* Without --ignore-missing option, exit with Critical state. */ | ||
241 | die (STATE_CRITICAL, _("DISK %s: %s not found\n"), _("CRITICAL"), path_select_list->name); | ||
242 | } else { | ||
243 | /* Continue jumping through the list */ | ||
244 | path_select_list = path_select_list->name_next; | ||
224 | } | 245 | } |
246 | } | ||
247 | |||
248 | path_select_list = temp_list; | ||
225 | 249 | ||
226 | temp_list = temp_list->name_next; | 250 | if (! path_select_list && ignore_missing == true) { |
251 | result = STATE_OK; | ||
252 | if (verbose >= 2) { | ||
253 | printf ("None of the provided paths were found\n"); | ||
254 | } | ||
227 | } | 255 | } |
228 | 256 | ||
229 | /* Process for every path in list */ | 257 | /* Process for every path in list */ |
@@ -242,6 +270,10 @@ main (int argc, char **argv) | |||
242 | 270 | ||
243 | me = path->best_match; | 271 | me = path->best_match; |
244 | 272 | ||
273 | if (!me) { | ||
274 | continue; | ||
275 | } | ||
276 | |||
245 | #ifdef __CYGWIN__ | 277 | #ifdef __CYGWIN__ |
246 | if (strncmp(path->name, "/cygdrive/", 10) != 0 || strlen(path->name) > 11) | 278 | if (strncmp(path->name, "/cygdrive/", 10) != 0 || strlen(path->name) > 11) |
247 | continue; | 279 | continue; |
@@ -260,8 +292,12 @@ main (int argc, char **argv) | |||
260 | if (path->group == NULL) { | 292 | if (path->group == NULL) { |
261 | /* Skip remote filesystems if we're not interested in them */ | 293 | /* Skip remote filesystems if we're not interested in them */ |
262 | if (me->me_remote && show_local_fs) { | 294 | if (me->me_remote && show_local_fs) { |
263 | if (stat_remote_fs) | 295 | if (stat_remote_fs) { |
264 | stat_path(path); | 296 | if (!stat_path(path) && ignore_missing == true) { |
297 | result = STATE_OK; | ||
298 | xasprintf (&ignored, "%s %s;", ignored, path->name); | ||
299 | } | ||
300 | } | ||
265 | continue; | 301 | continue; |
266 | /* Skip pseudo fs's if we haven't asked for all fs's */ | 302 | /* Skip pseudo fs's if we haven't asked for all fs's */ |
267 | } else if (me->me_dummy && !show_all_fs) { | 303 | } else if (me->me_dummy && !show_all_fs) { |
@@ -280,7 +316,13 @@ main (int argc, char **argv) | |||
280 | } | 316 | } |
281 | } | 317 | } |
282 | 318 | ||
283 | stat_path(path); | 319 | if (!stat_path(path)) { |
320 | if (ignore_missing == true) { | ||
321 | result = STATE_OK; | ||
322 | xasprintf (&ignored, "%s %s;", ignored, path->name); | ||
323 | } | ||
324 | continue; | ||
325 | } | ||
284 | get_fs_usage (me->me_mountdir, me->me_devname, &fsp); | 326 | get_fs_usage (me->me_mountdir, me->me_devname, &fsp); |
285 | 327 | ||
286 | if (fsp.fsu_blocks && strcmp ("none", me->me_mountdir)) { | 328 | if (fsp.fsu_blocks && strcmp ("none", me->me_mountdir)) { |
@@ -411,8 +453,12 @@ main (int argc, char **argv) | |||
411 | if (verbose >= 2) | 453 | if (verbose >= 2) |
412 | xasprintf (&output, "%s%s", output, details); | 454 | xasprintf (&output, "%s%s", output, details); |
413 | 455 | ||
456 | if (strcmp(output, "") == 0 && ! erronly) { | ||
457 | preamble = ""; | ||
458 | xasprintf (&output, " - No disks were found for provided parameters;"); | ||
459 | } | ||
414 | 460 | ||
415 | printf ("DISK %s%s%s|%s\n", state_text (result), (erronly && result==STATE_OK) ? "" : preamble, output, perf); | 461 | printf ("DISK %s%s%s%s%s|%s\n", state_text (result), ((erronly && result==STATE_OK)) ? "" : preamble, output, (strcmp(ignored, "") == 0) ? "" : ignored_preamble, ignored, perf); |
416 | return result; | 462 | return result; |
417 | } | 463 | } |
418 | 464 | ||
@@ -481,6 +527,7 @@ process_arguments (int argc, char **argv) | |||
481 | {"ignore-ereg-partition", required_argument, 0, 'i'}, | 527 | {"ignore-ereg-partition", required_argument, 0, 'i'}, |
482 | {"ignore-eregi-path", required_argument, 0, 'I'}, | 528 | {"ignore-eregi-path", required_argument, 0, 'I'}, |
483 | {"ignore-eregi-partition", required_argument, 0, 'I'}, | 529 | {"ignore-eregi-partition", required_argument, 0, 'I'}, |
530 | {"ignore-missing", no_argument, 0, IGNORE_MISSING}, | ||
484 | {"local", no_argument, 0, 'l'}, | 531 | {"local", no_argument, 0, 'l'}, |
485 | {"stat-remote-fs", no_argument, 0, 'L'}, | 532 | {"stat-remote-fs", no_argument, 0, 'L'}, |
486 | {"iperfdata", no_argument, 0, 'P'}, | 533 | {"iperfdata", no_argument, 0, 'P'}, |
@@ -540,7 +587,7 @@ process_arguments (int argc, char **argv) | |||
540 | 587 | ||
541 | /* Awful mistake where the range values do not make sense. Normally, | 588 | /* Awful mistake where the range values do not make sense. Normally, |
542 | you alert if the value is within the range, but since we are using | 589 | you alert if the value is within the range, but since we are using |
543 | freespace, we have to alert if outside the range. Thus we artifically | 590 | freespace, we have to alert if outside the range. Thus we artificially |
544 | force @ at the beginning of the range, so that it is backwards compatible | 591 | force @ at the beginning of the range, so that it is backwards compatible |
545 | */ | 592 | */ |
546 | case 'c': /* critical threshold */ | 593 | case 'c': /* critical threshold */ |
@@ -632,12 +679,19 @@ process_arguments (int argc, char **argv) | |||
632 | /* add parameter if not found. overwrite thresholds if path has already been added */ | 679 | /* add parameter if not found. overwrite thresholds if path has already been added */ |
633 | if (! (se = np_find_parameter(path_select_list, optarg))) { | 680 | if (! (se = np_find_parameter(path_select_list, optarg))) { |
634 | se = np_add_parameter(&path_select_list, optarg); | 681 | se = np_add_parameter(&path_select_list, optarg); |
682 | |||
683 | if (stat(optarg, &stat_buf[0]) && ignore_missing == true) { | ||
684 | path_ignored = true; | ||
685 | break; | ||
686 | } | ||
635 | } | 687 | } |
636 | se->group = group; | 688 | se->group = group; |
637 | set_all_thresholds(se); | 689 | set_all_thresholds(se); |
638 | 690 | ||
639 | /* With autofs, it is required to stat() the path before re-populating the mount_list */ | 691 | /* With autofs, it is required to stat() the path before re-populating the mount_list */ |
640 | stat_path(se); | 692 | if (!stat_path(se)) { |
693 | break; | ||
694 | } | ||
641 | /* NB: We can't free the old mount_list "just like that": both list pointers and struct | 695 | /* NB: We can't free the old mount_list "just like that": both list pointers and struct |
642 | * pointers are copied around. One of the reason it wasn't done yet is that other parts | 696 | * pointers are copied around. One of the reason it wasn't done yet is that other parts |
643 | * of check_disk need the same kind of cleanup so it'd better be done as a whole */ | 697 | * of check_disk need the same kind of cleanup so it'd better be done as a whole */ |
@@ -718,6 +772,9 @@ process_arguments (int argc, char **argv) | |||
718 | cflags = default_cflags; | 772 | cflags = default_cflags; |
719 | break; | 773 | break; |
720 | 774 | ||
775 | case IGNORE_MISSING: | ||
776 | ignore_missing = true; | ||
777 | break; | ||
721 | case 'A': | 778 | case 'A': |
722 | optarg = strdup(".*"); | 779 | optarg = strdup(".*"); |
723 | // Intentional fallthrough | 780 | // Intentional fallthrough |
@@ -753,7 +810,11 @@ process_arguments (int argc, char **argv) | |||
753 | } | 810 | } |
754 | } | 811 | } |
755 | 812 | ||
756 | if (!fnd) | 813 | if (!fnd && ignore_missing == true) { |
814 | path_ignored = true; | ||
815 | /* path_selected = TRUE;*/ | ||
816 | break; | ||
817 | } else if (!fnd) | ||
757 | die (STATE_UNKNOWN, "DISK %s: %s - %s\n",_("UNKNOWN"), | 818 | die (STATE_UNKNOWN, "DISK %s: %s - %s\n",_("UNKNOWN"), |
758 | _("Regular expression did not match any path or disk"), optarg); | 819 | _("Regular expression did not match any path or disk"), optarg); |
759 | 820 | ||
@@ -923,6 +984,9 @@ print_help (void) | |||
923 | printf (" %s\n", _("Regular expression to ignore selected path/partition (case insensitive) (may be repeated)")); | 984 | printf (" %s\n", _("Regular expression to ignore selected path/partition (case insensitive) (may be repeated)")); |
924 | printf (" %s\n", "-i, --ignore-ereg-path=PATH, --ignore-ereg-partition=PARTITION"); | 985 | printf (" %s\n", "-i, --ignore-ereg-path=PATH, --ignore-ereg-partition=PARTITION"); |
925 | printf (" %s\n", _("Regular expression to ignore selected path or partition (may be repeated)")); | 986 | printf (" %s\n", _("Regular expression to ignore selected path or partition (may be repeated)")); |
987 | printf (" %s\n", "--ignore-missing"); | ||
988 | printf (" %s\n", _("Return OK if no filesystem matches, filesystem does not exist or is inaccessible.")); | ||
989 | printf (" %s\n", _("(Provide this option before -p / -r / --ereg-path if used)")); | ||
926 | printf (UT_PLUG_TIMEOUT, DEFAULT_SOCKET_TIMEOUT); | 990 | printf (UT_PLUG_TIMEOUT, DEFAULT_SOCKET_TIMEOUT); |
927 | printf (" %s\n", "-u, --units=STRING"); | 991 | printf (" %s\n", "-u, --units=STRING"); |
928 | printf (" %s\n", _("Choose bytes, kB, MB, GB, TB (default: MB)")); | 992 | printf (" %s\n", _("Choose bytes, kB, MB, GB, TB (default: MB)")); |
@@ -956,7 +1020,7 @@ print_usage (void) | |||
956 | printf ("[-t timeout] [-u unit] [-v] [-X type] [-N type]\n"); | 1020 | printf ("[-t timeout] [-u unit] [-v] [-X type] [-N type]\n"); |
957 | } | 1021 | } |
958 | 1022 | ||
959 | void | 1023 | bool |
960 | stat_path (struct parameter_list *p) | 1024 | stat_path (struct parameter_list *p) |
961 | { | 1025 | { |
962 | /* Stat entry to check that dir exists and is accessible */ | 1026 | /* Stat entry to check that dir exists and is accessible */ |
@@ -965,9 +1029,14 @@ stat_path (struct parameter_list *p) | |||
965 | if (stat (p->name, &stat_buf[0])) { | 1029 | if (stat (p->name, &stat_buf[0])) { |
966 | if (verbose >= 3) | 1030 | if (verbose >= 3) |
967 | printf("stat failed on %s\n", p->name); | 1031 | printf("stat failed on %s\n", p->name); |
968 | printf("DISK %s - ", _("CRITICAL")); | 1032 | if (ignore_missing == true) { |
969 | die (STATE_CRITICAL, _("%s %s: %s\n"), p->name, _("is not accessible"), strerror(errno)); | 1033 | return false; |
1034 | } else { | ||
1035 | printf("DISK %s - ", _("CRITICAL")); | ||
1036 | die (STATE_CRITICAL, _("%s %s: %s\n"), p->name, _("is not accessible"), strerror(errno)); | ||
1037 | } | ||
970 | } | 1038 | } |
1039 | return true; | ||
971 | } | 1040 | } |
972 | 1041 | ||
973 | 1042 | ||
@@ -987,7 +1056,8 @@ get_stats (struct parameter_list *p, struct fs_usage *fsp) { | |||
987 | continue; | 1056 | continue; |
988 | #endif | 1057 | #endif |
989 | if (p_list->group && ! (strcmp(p_list->group, p->group))) { | 1058 | if (p_list->group && ! (strcmp(p_list->group, p->group))) { |
990 | stat_path(p_list); | 1059 | if (! stat_path(p_list)) |
1060 | continue; | ||
991 | get_fs_usage (p_list->best_match->me_mountdir, p_list->best_match->me_devname, &tmpfsp); | 1061 | get_fs_usage (p_list->best_match->me_mountdir, p_list->best_match->me_devname, &tmpfsp); |
992 | get_path_stats(p_list, &tmpfsp); | 1062 | get_path_stats(p_list, &tmpfsp); |
993 | if (verbose >= 3) | 1063 | if (verbose >= 3) |
@@ -1045,7 +1115,7 @@ get_path_stats (struct parameter_list *p, struct fs_usage *fsp) { | |||
1045 | p->available_to_root = fsp->fsu_bfree; | 1115 | p->available_to_root = fsp->fsu_bfree; |
1046 | p->used = fsp->fsu_blocks - fsp->fsu_bfree; | 1116 | p->used = fsp->fsu_blocks - fsp->fsu_bfree; |
1047 | if (freespace_ignore_reserved) { | 1117 | if (freespace_ignore_reserved) { |
1048 | /* option activated : we substract the root-reserved space from the total */ | 1118 | /* option activated : we subtract the root-reserved space from the total */ |
1049 | p->total = fsp->fsu_blocks - p->available_to_root + p->available; | 1119 | p->total = fsp->fsu_blocks - p->available_to_root + p->available; |
1050 | } else { | 1120 | } else { |
1051 | /* default behaviour : take all the blocks into account */ | 1121 | /* default behaviour : take all the blocks into account */ |
@@ -1060,7 +1130,7 @@ get_path_stats (struct parameter_list *p, struct fs_usage *fsp) { | |||
1060 | p->inodes_free_to_root = fsp->fsu_ffree; /* Free file nodes for root. */ | 1130 | p->inodes_free_to_root = fsp->fsu_ffree; /* Free file nodes for root. */ |
1061 | p->inodes_used = fsp->fsu_files - fsp->fsu_ffree; | 1131 | p->inodes_used = fsp->fsu_files - fsp->fsu_ffree; |
1062 | if (freespace_ignore_reserved) { | 1132 | if (freespace_ignore_reserved) { |
1063 | /* option activated : we substract the root-reserved inodes from the total */ | 1133 | /* option activated : we subtract the root-reserved inodes from the total */ |
1064 | /* not all OS report fsp->fsu_favail, only the ones with statvfs syscall */ | 1134 | /* not all OS report fsp->fsu_favail, only the ones with statvfs syscall */ |
1065 | /* for others, fsp->fsu_ffree == fsp->fsu_favail */ | 1135 | /* for others, fsp->fsu_ffree == fsp->fsu_favail */ |
1066 | p->inodes_total = fsp->fsu_files - p->inodes_free_to_root + p->inodes_free; | 1136 | p->inodes_total = fsp->fsu_files - p->inodes_free_to_root + p->inodes_free; |
diff --git a/plugins/check_dns.c b/plugins/check_dns.c index 9de6caf5..7ffce98b 100644 --- a/plugins/check_dns.c +++ b/plugins/check_dns.c | |||
@@ -75,7 +75,7 @@ main (int argc, char **argv) | |||
75 | { | 75 | { |
76 | char *command_line = NULL; | 76 | char *command_line = NULL; |
77 | char input_buffer[MAX_INPUT_BUFFER]; | 77 | char input_buffer[MAX_INPUT_BUFFER]; |
78 | char *address = NULL; /* comma seperated str with addrs/ptrs (sorted) */ | 78 | char *address = NULL; /* comma separated str with addrs/ptrs (sorted) */ |
79 | char **addresses = NULL; | 79 | char **addresses = NULL; |
80 | int n_addresses = 0; | 80 | int n_addresses = 0; |
81 | char *msg = NULL; | 81 | char *msg = NULL; |
diff --git a/plugins/check_fping.c b/plugins/check_fping.c index db433162..6f5656ef 100644 --- a/plugins/check_fping.c +++ b/plugins/check_fping.c | |||
@@ -73,7 +73,7 @@ int wrta_p = FALSE; | |||
73 | int | 73 | int |
74 | main (int argc, char **argv) | 74 | main (int argc, char **argv) |
75 | { | 75 | { |
76 | /* normaly should be int result = STATE_UNKNOWN; */ | 76 | /* normally should be int result = STATE_UNKNOWN; */ |
77 | 77 | ||
78 | int status = STATE_UNKNOWN; | 78 | int status = STATE_UNKNOWN; |
79 | int result = 0; | 79 | int result = 0; |
diff --git a/plugins/check_http.c b/plugins/check_http.c index 8dda046f..8c03bc8b 100644 --- a/plugins/check_http.c +++ b/plugins/check_http.c | |||
@@ -198,7 +198,7 @@ test_file (char *path) | |||
198 | 198 | ||
199 | /* | 199 | /* |
200 | * process command-line arguments | 200 | * process command-line arguments |
201 | * returns true on succes, false otherwise | 201 | * returns true on success, false otherwise |
202 | */ | 202 | */ |
203 | bool process_arguments (int argc, char **argv) | 203 | bool process_arguments (int argc, char **argv) |
204 | { | 204 | { |
@@ -1885,7 +1885,7 @@ print_usage (void) | |||
1885 | printf (" %s -H <vhost> | -I <IP-address> [-u <uri>] [-p <port>]\n",progname); | 1885 | printf (" %s -H <vhost> | -I <IP-address> [-u <uri>] [-p <port>]\n",progname); |
1886 | printf (" [-J <client certificate file>] [-K <private key>]\n"); | 1886 | printf (" [-J <client certificate file>] [-K <private key>]\n"); |
1887 | printf (" [-w <warn time>] [-c <critical time>] [-t <timeout>] [-L] [-E] [-a auth]\n"); | 1887 | printf (" [-w <warn time>] [-c <critical time>] [-t <timeout>] [-L] [-E] [-a auth]\n"); |
1888 | printf (" [-b proxy_auth] [-f <ok|warning|critcal|follow|sticky|stickyport>]\n"); | 1888 | printf (" [-b proxy_auth] [-f <ok|warning|critical|follow|sticky|stickyport>]\n"); |
1889 | printf (" [-e <expect>] [-d string] [-s string] [-l] [-r <regex> | -R <case-insensitive regex>]\n"); | 1889 | printf (" [-e <expect>] [-d string] [-s string] [-l] [-r <regex> | -R <case-insensitive regex>]\n"); |
1890 | printf (" [-P string] [-m <min_pg_size>:<max_pg_size>] [-4|-6] [-N] [-M <age>]\n"); | 1890 | printf (" [-P string] [-m <min_pg_size>:<max_pg_size>] [-4|-6] [-N] [-M <age>]\n"); |
1891 | printf (" [-A string] [-k string] [-S <version>] [--sni]\n"); | 1891 | printf (" [-A string] [-k string] [-S <version>] [--sni]\n"); |
diff --git a/plugins/check_ldap.c b/plugins/check_ldap.c index 845a4f52..a1bfe1be 100644 --- a/plugins/check_ldap.c +++ b/plugins/check_ldap.c | |||
@@ -222,7 +222,7 @@ main (int argc, char *argv[]) | |||
222 | /* reset the alarm handler */ | 222 | /* reset the alarm handler */ |
223 | alarm (0); | 223 | alarm (0); |
224 | 224 | ||
225 | /* calcutate the elapsed time and compare to thresholds */ | 225 | /* calculate the elapsed time and compare to thresholds */ |
226 | 226 | ||
227 | microsec = deltime (tv); | 227 | microsec = deltime (tv); |
228 | elapsed_time = (double)microsec / 1.0e6; | 228 | elapsed_time = (double)microsec / 1.0e6; |
diff --git a/plugins/check_load.c b/plugins/check_load.c index 00f7c877..313df8ad 100644 --- a/plugins/check_load.c +++ b/plugins/check_load.c | |||
@@ -107,7 +107,7 @@ main (int argc, char **argv) | |||
107 | int i; | 107 | int i; |
108 | long numcpus; | 108 | long numcpus; |
109 | 109 | ||
110 | double la[3] = { 0.0, 0.0, 0.0 }; /* NetBSD complains about unitialized arrays */ | 110 | double la[3] = { 0.0, 0.0, 0.0 }; /* NetBSD complains about uninitialized arrays */ |
111 | #ifndef HAVE_GETLOADAVG | 111 | #ifndef HAVE_GETLOADAVG |
112 | char input_buffer[MAX_INPUT_BUFFER]; | 112 | char input_buffer[MAX_INPUT_BUFFER]; |
113 | # ifdef HAVE_PROC_LOADAVG | 113 | # ifdef HAVE_PROC_LOADAVG |
diff --git a/plugins/check_ntp.c b/plugins/check_ntp.c index 8b776ba1..36146505 100644 --- a/plugins/check_ntp.c +++ b/plugins/check_ntp.c | |||
@@ -10,7 +10,7 @@ | |||
10 | * | 10 | * |
11 | * This file contains the check_ntp plugin | 11 | * This file contains the check_ntp plugin |
12 | * | 12 | * |
13 | * This plugin to check ntp servers independant of any commandline | 13 | * This plugin to check ntp servers independent of any commandline |
14 | * programs or external libraries. | 14 | * programs or external libraries. |
15 | * | 15 | * |
16 | * | 16 | * |
@@ -79,7 +79,7 @@ typedef struct { | |||
79 | /* this structure holds data about results from querying offset from a peer */ | 79 | /* this structure holds data about results from querying offset from a peer */ |
80 | typedef struct { | 80 | typedef struct { |
81 | time_t waiting; /* ts set when we started waiting for a response */ | 81 | time_t waiting; /* ts set when we started waiting for a response */ |
82 | int num_responses; /* number of successfully recieved responses */ | 82 | int num_responses; /* number of successfully received responses */ |
83 | uint8_t stratum; /* copied verbatim from the ntp_message */ | 83 | uint8_t stratum; /* copied verbatim from the ntp_message */ |
84 | double rtdelay; /* converted from the ntp_message */ | 84 | double rtdelay; /* converted from the ntp_message */ |
85 | double rtdisp; /* converted from the ntp_message */ | 85 | double rtdisp; /* converted from the ntp_message */ |
@@ -100,7 +100,7 @@ typedef struct { | |||
100 | /* NB: not necessarily NULL terminated! */ | 100 | /* NB: not necessarily NULL terminated! */ |
101 | } ntp_control_message; | 101 | } ntp_control_message; |
102 | 102 | ||
103 | /* this is an association/status-word pair found in control packet reponses */ | 103 | /* this is an association/status-word pair found in control packet responses */ |
104 | typedef struct { | 104 | typedef struct { |
105 | uint16_t assoc; | 105 | uint16_t assoc; |
106 | uint16_t status; | 106 | uint16_t status; |
@@ -575,7 +575,7 @@ double jitter_request(int *status){ | |||
575 | } | 575 | } |
576 | } | 576 | } |
577 | } | 577 | } |
578 | if(verbose) printf("%d candiate peers available\n", num_candidates); | 578 | if(verbose) printf("%d candidate peers available\n", num_candidates); |
579 | if(verbose && syncsource_found) printf("synchronization source found\n"); | 579 | if(verbose && syncsource_found) printf("synchronization source found\n"); |
580 | if(! syncsource_found){ | 580 | if(! syncsource_found){ |
581 | *status = STATE_UNKNOWN; | 581 | *status = STATE_UNKNOWN; |
@@ -597,7 +597,7 @@ double jitter_request(int *status){ | |||
597 | /* By spec, putting the variable name "jitter" in the request | 597 | /* By spec, putting the variable name "jitter" in the request |
598 | * should cause the server to provide _only_ the jitter value. | 598 | * should cause the server to provide _only_ the jitter value. |
599 | * thus reducing net traffic, guaranteeing us only a single | 599 | * thus reducing net traffic, guaranteeing us only a single |
600 | * datagram in reply, and making intepretation much simpler | 600 | * datagram in reply, and making interpretation much simpler |
601 | */ | 601 | */ |
602 | /* Older servers doesn't know what jitter is, so if we get an | 602 | /* Older servers doesn't know what jitter is, so if we get an |
603 | * error on the first pass we redo it with "dispersion" */ | 603 | * error on the first pass we redo it with "dispersion" */ |
diff --git a/plugins/check_ntp_peer.c b/plugins/check_ntp_peer.c index 6842842f..eafafdc0 100644 --- a/plugins/check_ntp_peer.c +++ b/plugins/check_ntp_peer.c | |||
@@ -86,7 +86,7 @@ typedef struct { | |||
86 | /* NB: not necessarily NULL terminated! */ | 86 | /* NB: not necessarily NULL terminated! */ |
87 | } ntp_control_message; | 87 | } ntp_control_message; |
88 | 88 | ||
89 | /* this is an association/status-word pair found in control packet reponses */ | 89 | /* this is an association/status-word pair found in control packet responses */ |
90 | typedef struct { | 90 | typedef struct { |
91 | uint16_t assoc; | 91 | uint16_t assoc; |
92 | uint16_t status; | 92 | uint16_t status; |
@@ -189,7 +189,7 @@ setup_control_request(ntp_control_message *p, uint8_t opcode, uint16_t seq){ | |||
189 | } | 189 | } |
190 | 190 | ||
191 | /* This function does all the actual work; roughly here's what it does | 191 | /* This function does all the actual work; roughly here's what it does |
192 | * beside setting the offest, jitter and stratum passed as argument: | 192 | * beside setting the offset, jitter and stratum passed as argument: |
193 | * - offset can be negative, so if it cannot get the offset, offset_result | 193 | * - offset can be negative, so if it cannot get the offset, offset_result |
194 | * is set to UNKNOWN, otherwise OK. | 194 | * is set to UNKNOWN, otherwise OK. |
195 | * - jitter and stratum are set to -1 if they cannot be retrieved so any | 195 | * - jitter and stratum are set to -1 if they cannot be retrieved so any |
@@ -306,7 +306,7 @@ int ntp_request(const char *host, double *offset, int *offset_result, double *ji | |||
306 | /* Putting the wanted variable names in the request | 306 | /* Putting the wanted variable names in the request |
307 | * cause the server to provide _only_ the requested values. | 307 | * cause the server to provide _only_ the requested values. |
308 | * thus reducing net traffic, guaranteeing us only a single | 308 | * thus reducing net traffic, guaranteeing us only a single |
309 | * datagram in reply, and making intepretation much simpler | 309 | * datagram in reply, and making interpretation much simpler |
310 | */ | 310 | */ |
311 | /* Older servers doesn't know what jitter is, so if we get an | 311 | /* Older servers doesn't know what jitter is, so if we get an |
312 | * error on the first pass we redo it with "dispersion" */ | 312 | * error on the first pass we redo it with "dispersion" */ |
@@ -585,7 +585,7 @@ int main(int argc, char *argv[]){ | |||
585 | /* set socket timeout */ | 585 | /* set socket timeout */ |
586 | alarm (socket_timeout); | 586 | alarm (socket_timeout); |
587 | 587 | ||
588 | /* This returns either OK or WARNING (See comment preceeding ntp_request) */ | 588 | /* This returns either OK or WARNING (See comment proceeding ntp_request) */ |
589 | result = ntp_request(server_address, &offset, &offset_result, &jitter, &stratum, &num_truechimers); | 589 | result = ntp_request(server_address, &offset, &offset_result, &jitter, &stratum, &num_truechimers); |
590 | 590 | ||
591 | if(offset_result == STATE_UNKNOWN) { | 591 | if(offset_result == STATE_UNKNOWN) { |
diff --git a/plugins/check_ntp_time.c b/plugins/check_ntp_time.c index 391b2df2..46cc604f 100644 --- a/plugins/check_ntp_time.c +++ b/plugins/check_ntp_time.c | |||
@@ -81,7 +81,7 @@ typedef struct { | |||
81 | /* this structure holds data about results from querying offset from a peer */ | 81 | /* this structure holds data about results from querying offset from a peer */ |
82 | typedef struct { | 82 | typedef struct { |
83 | time_t waiting; /* ts set when we started waiting for a response */ | 83 | time_t waiting; /* ts set when we started waiting for a response */ |
84 | int num_responses; /* number of successfully recieved responses */ | 84 | int num_responses; /* number of successfully received responses */ |
85 | uint8_t stratum; /* copied verbatim from the ntp_message */ | 85 | uint8_t stratum; /* copied verbatim from the ntp_message */ |
86 | double rtdelay; /* converted from the ntp_message */ | 86 | double rtdelay; /* converted from the ntp_message */ |
87 | double rtdisp; /* converted from the ntp_message */ | 87 | double rtdisp; /* converted from the ntp_message */ |
diff --git a/plugins/check_nwstat.c b/plugins/check_nwstat.c index e7e8de05..3c9d23e2 100644 --- a/plugins/check_nwstat.c +++ b/plugins/check_nwstat.c | |||
@@ -1668,7 +1668,7 @@ void print_help(void) | |||
1668 | 1668 | ||
1669 | printf ("\n"); | 1669 | printf ("\n"); |
1670 | printf ("%s\n", _("Notes:")); | 1670 | printf ("%s\n", _("Notes:")); |
1671 | printf (" %s\n", _("- This plugin requres that the MRTGEXT.NLM file from James Drews' MRTG")); | 1671 | printf (" %s\n", _("- This plugin requires that the MRTGEXT.NLM file from James Drews' MRTG")); |
1672 | printf (" %s\n", _(" extension for NetWare be loaded on the Novell servers you wish to check.")); | 1672 | printf (" %s\n", _(" extension for NetWare be loaded on the Novell servers you wish to check.")); |
1673 | printf (" %s\n", _(" (available from http://www.engr.wisc.edu/~drews/mrtg/)")); | 1673 | printf (" %s\n", _(" (available from http://www.engr.wisc.edu/~drews/mrtg/)")); |
1674 | printf (" %s\n", _("- Values for critical thresholds should be lower than warning thresholds")); | 1674 | printf (" %s\n", _("- Values for critical thresholds should be lower than warning thresholds")); |
diff --git a/plugins/check_pgsql.c b/plugins/check_pgsql.c index c26cd439..94a03b21 100644 --- a/plugins/check_pgsql.c +++ b/plugins/check_pgsql.c | |||
@@ -93,7 +93,7 @@ int verbose = 0; | |||
93 | 93 | ||
94 | /****************************************************************************** | 94 | /****************************************************************************** |
95 | 95 | ||
96 | The (psuedo?)literate programming XML is contained within \@\@\- <XML> \-\@\@ | 96 | The (pseudo?)literate programming XML is contained within \@\@\- <XML> \-\@\@ |
97 | tags in the comments. With in the tags, the XML is assembled sequentially. | 97 | tags in the comments. With in the tags, the XML is assembled sequentially. |
98 | You can define entities in tags. You also have all the #defines available as | 98 | You can define entities in tags. You also have all the #defines available as |
99 | entities. | 99 | entities. |
diff --git a/plugins/check_procs.c b/plugins/check_procs.c index a025ee89..c17c6996 100644 --- a/plugins/check_procs.c +++ b/plugins/check_procs.c | |||
@@ -70,6 +70,7 @@ int options = 0; /* bitmask of filter criteria to test against */ | |||
70 | #define PCPU 256 | 70 | #define PCPU 256 |
71 | #define ELAPSED 512 | 71 | #define ELAPSED 512 |
72 | #define EREG_ARGS 1024 | 72 | #define EREG_ARGS 1024 |
73 | #define EXCLUDE_PROGS 2048 | ||
73 | 74 | ||
74 | #define KTHREAD_PARENT "kthreadd" /* the parent process of kernel threads: | 75 | #define KTHREAD_PARENT "kthreadd" /* the parent process of kernel threads: |
75 | ppid of procs are compared to pid of this proc*/ | 76 | ppid of procs are compared to pid of this proc*/ |
@@ -93,6 +94,9 @@ int rss; | |||
93 | float pcpu; | 94 | float pcpu; |
94 | char *statopts; | 95 | char *statopts; |
95 | char *prog; | 96 | char *prog; |
97 | char *exclude_progs; | ||
98 | char **exclude_progs_arr = NULL; | ||
99 | char exclude_progs_counter = 0; | ||
96 | char *args; | 100 | char *args; |
97 | char *input_filename = NULL; | 101 | char *input_filename = NULL; |
98 | regex_t re_args; | 102 | regex_t re_args; |
@@ -250,7 +254,26 @@ main (int argc, char **argv) | |||
250 | continue; | 254 | continue; |
251 | } | 255 | } |
252 | 256 | ||
253 | /* filter kernel threads (childs of KTHREAD_PARENT)*/ | 257 | /* Ignore excluded processes by name */ |
258 | if(options & EXCLUDE_PROGS) { | ||
259 | int found = 0; | ||
260 | int i = 0; | ||
261 | |||
262 | for(i=0; i < (exclude_progs_counter); i++) { | ||
263 | if(!strcmp(procprog, exclude_progs_arr[i])) { | ||
264 | found = 1; | ||
265 | } | ||
266 | } | ||
267 | if(found == 0) { | ||
268 | resultsum |= EXCLUDE_PROGS; | ||
269 | } else | ||
270 | { | ||
271 | if(verbose >= 3) | ||
272 | printf("excluding - by ignorelist\n"); | ||
273 | } | ||
274 | } | ||
275 | |||
276 | /* filter kernel threads (children of KTHREAD_PARENT)*/ | ||
254 | /* TODO adapt for other OSes than GNU/Linux | 277 | /* TODO adapt for other OSes than GNU/Linux |
255 | sorry for not doing that, but I've no other OSes to test :-( */ | 278 | sorry for not doing that, but I've no other OSes to test :-( */ |
256 | if (kthread_filter == 1) { | 279 | if (kthread_filter == 1) { |
@@ -409,6 +432,7 @@ process_arguments (int argc, char **argv) | |||
409 | {"input-file", required_argument, 0, CHAR_MAX+2}, | 432 | {"input-file", required_argument, 0, CHAR_MAX+2}, |
410 | {"no-kthreads", required_argument, 0, 'k'}, | 433 | {"no-kthreads", required_argument, 0, 'k'}, |
411 | {"traditional-filter", no_argument, 0, 'T'}, | 434 | {"traditional-filter", no_argument, 0, 'T'}, |
435 | {"exclude-process", required_argument, 0, 'X'}, | ||
412 | {0, 0, 0, 0} | 436 | {0, 0, 0, 0} |
413 | }; | 437 | }; |
414 | 438 | ||
@@ -417,7 +441,7 @@ process_arguments (int argc, char **argv) | |||
417 | strcpy (argv[c], "-t"); | 441 | strcpy (argv[c], "-t"); |
418 | 442 | ||
419 | while (1) { | 443 | while (1) { |
420 | c = getopt_long (argc, argv, "Vvhkt:c:w:p:s:u:C:a:z:r:m:P:T", | 444 | c = getopt_long (argc, argv, "Vvhkt:c:w:p:s:u:C:a:z:r:m:P:T:X:", |
421 | longopts, &option); | 445 | longopts, &option); |
422 | 446 | ||
423 | if (c == -1 || c == EOF) | 447 | if (c == -1 || c == EOF) |
@@ -490,6 +514,23 @@ process_arguments (int argc, char **argv) | |||
490 | prog); | 514 | prog); |
491 | options |= PROG; | 515 | options |= PROG; |
492 | break; | 516 | break; |
517 | case 'X': | ||
518 | if(exclude_progs) | ||
519 | break; | ||
520 | else | ||
521 | exclude_progs = optarg; | ||
522 | xasprintf (&fmt, _("%s%sexclude progs '%s'"), (fmt ? fmt : ""), (options ? ", " : ""), | ||
523 | exclude_progs); | ||
524 | char *p = strtok(exclude_progs, ","); | ||
525 | |||
526 | while(p){ | ||
527 | exclude_progs_arr = realloc(exclude_progs_arr, sizeof(char*) * ++exclude_progs_counter); | ||
528 | exclude_progs_arr[exclude_progs_counter-1] = p; | ||
529 | p = strtok(NULL, ","); | ||
530 | } | ||
531 | |||
532 | options |= EXCLUDE_PROGS; | ||
533 | break; | ||
493 | case 'a': /* args (full path name with args) */ | 534 | case 'a': /* args (full path name with args) */ |
494 | /* TODO: allow this to be passed in with --metric */ | 535 | /* TODO: allow this to be passed in with --metric */ |
495 | if (args) | 536 | if (args) |
@@ -745,6 +786,8 @@ print_help (void) | |||
745 | printf (" %s\n", _("Only scan for processes with args that contain the regex STRING.")); | 786 | printf (" %s\n", _("Only scan for processes with args that contain the regex STRING.")); |
746 | printf (" %s\n", "-C, --command=COMMAND"); | 787 | printf (" %s\n", "-C, --command=COMMAND"); |
747 | printf (" %s\n", _("Only scan for exact matches of COMMAND (without path).")); | 788 | printf (" %s\n", _("Only scan for exact matches of COMMAND (without path).")); |
789 | printf (" %s\n", "-X, --exclude-process"); | ||
790 | printf (" %s\n", _("Exclude processes which match this comma separated list")); | ||
748 | printf (" %s\n", "-k, --no-kthreads"); | 791 | printf (" %s\n", "-k, --no-kthreads"); |
749 | printf (" %s\n", _("Only scan for non kernel threads (works on Linux only).")); | 792 | printf (" %s\n", _("Only scan for non kernel threads (works on Linux only).")); |
750 | 793 | ||
@@ -786,5 +829,5 @@ print_usage (void) | |||
786 | printf ("%s\n", _("Usage:")); | 829 | printf ("%s\n", _("Usage:")); |
787 | printf ("%s -w <range> -c <range> [-m metric] [-s state] [-p ppid]\n", progname); | 830 | printf ("%s -w <range> -c <range> [-m metric] [-s state] [-p ppid]\n", progname); |
788 | printf (" [-u user] [-r rss] [-z vsz] [-P %%cpu] [-a argument-array]\n"); | 831 | printf (" [-u user] [-r rss] [-z vsz] [-P %%cpu] [-a argument-array]\n"); |
789 | printf (" [-C command] [-k] [-t timeout] [-v]\n"); | 832 | printf (" [-C command] [-X process_to_exclude] [-k] [-t timeout] [-v]\n"); |
790 | } | 833 | } |
diff --git a/plugins/check_radius.c b/plugins/check_radius.c index be1001b4..984aa37e 100644 --- a/plugins/check_radius.c +++ b/plugins/check_radius.c | |||
@@ -97,7 +97,7 @@ int verbose = FALSE; | |||
97 | 97 | ||
98 | /****************************************************************************** | 98 | /****************************************************************************** |
99 | 99 | ||
100 | The (psuedo?)literate programming XML is contained within \@\@\- <XML> \-\@\@ | 100 | The (pseudo?)literate programming XML is contained within \@\@\- <XML> \-\@\@ |
101 | tags in the comments. With in the tags, the XML is assembled sequentially. | 101 | tags in the comments. With in the tags, the XML is assembled sequentially. |
102 | You can define entities in tags. You also have all the #defines available as | 102 | You can define entities in tags. You also have all the #defines available as |
103 | entities. | 103 | entities. |
@@ -155,7 +155,11 @@ main (int argc, char **argv) | |||
155 | { | 155 | { |
156 | struct sockaddr_storage ss; | 156 | struct sockaddr_storage ss; |
157 | char name[HOST_NAME_MAX]; | 157 | char name[HOST_NAME_MAX]; |
158 | #ifdef RC_BUFFER_LEN | ||
159 | char msg[RC_BUFFER_LEN]; | ||
160 | #else | ||
158 | char msg[BUFFER_LEN]; | 161 | char msg[BUFFER_LEN]; |
162 | #endif | ||
159 | SEND_DATA data; | 163 | SEND_DATA data; |
160 | int result = STATE_UNKNOWN; | 164 | int result = STATE_UNKNOWN; |
161 | uint32_t client_id, service; | 165 | uint32_t client_id, service; |
diff --git a/plugins/check_real.c b/plugins/check_real.c index 0f1a1ba7..fbdb70f3 100644 --- a/plugins/check_real.c +++ b/plugins/check_real.c | |||
@@ -178,7 +178,7 @@ main (int argc, char **argv) | |||
178 | 178 | ||
179 | /* watch for the REAL connection string */ | 179 | /* watch for the REAL connection string */ |
180 | result = recv (sd, buffer, MAX_INPUT_BUFFER - 1, 0); | 180 | result = recv (sd, buffer, MAX_INPUT_BUFFER - 1, 0); |
181 | buffer[result] = '\0'; /* null terminate recieved buffer */ | 181 | buffer[result] = '\0'; /* null terminate received buffer */ |
182 | 182 | ||
183 | /* return a CRITICAL status if we couldn't read any data */ | 183 | /* return a CRITICAL status if we couldn't read any data */ |
184 | if (result == -1) { | 184 | if (result == -1) { |
@@ -436,7 +436,7 @@ print_help (void) | |||
436 | 436 | ||
437 | printf ("\n"); | 437 | printf ("\n"); |
438 | printf ("%s\n", _("This plugin will attempt to open an RTSP connection with the host.")); | 438 | printf ("%s\n", _("This plugin will attempt to open an RTSP connection with the host.")); |
439 | printf ("%s\n", _("Successul connects return STATE_OK, refusals and timeouts return")); | 439 | printf ("%s\n", _("Successful connects return STATE_OK, refusals and timeouts return")); |
440 | printf ("%s\n", _("STATE_CRITICAL, other errors return STATE_UNKNOWN. Successful connects,")); | 440 | printf ("%s\n", _("STATE_CRITICAL, other errors return STATE_UNKNOWN. Successful connects,")); |
441 | printf ("%s\n", _("but incorrect response messages from the host result in STATE_WARNING return")); | 441 | printf ("%s\n", _("but incorrect response messages from the host result in STATE_WARNING return")); |
442 | printf ("%s\n", _("values.")); | 442 | printf ("%s\n", _("values.")); |
diff --git a/plugins/check_smtp.c b/plugins/check_smtp.c index c1e92dff..eaa7eeba 100644 --- a/plugins/check_smtp.c +++ b/plugins/check_smtp.c | |||
@@ -844,7 +844,7 @@ print_help (void) | |||
844 | printf (UT_VERBOSE); | 844 | printf (UT_VERBOSE); |
845 | 845 | ||
846 | printf("\n"); | 846 | printf("\n"); |
847 | printf ("%s\n", _("Successul connects return STATE_OK, refusals and timeouts return")); | 847 | printf ("%s\n", _("Successful connects return STATE_OK, refusals and timeouts return")); |
848 | printf ("%s\n", _("STATE_CRITICAL, other errors return STATE_UNKNOWN. Successful")); | 848 | printf ("%s\n", _("STATE_CRITICAL, other errors return STATE_UNKNOWN. Successful")); |
849 | printf ("%s\n", _("connects, but incorrect response messages from the host result in")); | 849 | printf ("%s\n", _("connects, but incorrect response messages from the host result in")); |
850 | printf ("%s\n", _("STATE_WARNING return values.")); | 850 | printf ("%s\n", _("STATE_WARNING return values.")); |
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c index d3968a27..c425df3c 100644 --- a/plugins/check_snmp.c +++ b/plugins/check_snmp.c | |||
@@ -46,6 +46,7 @@ const char *email = "devel@monitoring-plugins.org"; | |||
46 | #define DEFAULT_PRIV_PROTOCOL "DES" | 46 | #define DEFAULT_PRIV_PROTOCOL "DES" |
47 | #define DEFAULT_DELIMITER "=" | 47 | #define DEFAULT_DELIMITER "=" |
48 | #define DEFAULT_OUTPUT_DELIMITER " " | 48 | #define DEFAULT_OUTPUT_DELIMITER " " |
49 | #define DEFAULT_BUFFER_SIZE 100 | ||
49 | 50 | ||
50 | #define mark(a) ((a)!=0?"*":"") | 51 | #define mark(a) ((a)!=0?"*":"") |
51 | 52 | ||
@@ -157,6 +158,7 @@ int perf_labels = 1; | |||
157 | char* ip_version = ""; | 158 | char* ip_version = ""; |
158 | double multiplier = 1.0; | 159 | double multiplier = 1.0; |
159 | char *fmtstr = ""; | 160 | char *fmtstr = ""; |
161 | char buffer[DEFAULT_BUFFER_SIZE]; | ||
160 | 162 | ||
161 | static char *fix_snmp_range(char *th) | 163 | static char *fix_snmp_range(char *th) |
162 | { | 164 | { |
@@ -1169,15 +1171,15 @@ multiply (char *str) | |||
1169 | double val; | 1171 | double val; |
1170 | char *conv = "%f"; | 1172 | char *conv = "%f"; |
1171 | 1173 | ||
1174 | if(multiplier == 1) | ||
1175 | return(str); | ||
1176 | |||
1172 | if(verbose>2) | 1177 | if(verbose>2) |
1173 | printf(" multiply input: %s\n", str); | 1178 | printf(" multiply input: %s\n", str); |
1174 | 1179 | ||
1175 | val = strtod (str, &endptr); | 1180 | val = strtod (str, &endptr); |
1176 | if ((val == 0.0) && (endptr == str)) { | 1181 | if ((val == 0.0) && (endptr == str)) { |
1177 | if(multiplier != 1) { | 1182 | die(STATE_UNKNOWN, _("multiplier set (%.1f), but input is not a number: %s"), multiplier, str); |
1178 | die(STATE_UNKNOWN, _("multiplier set (%.1f), but input is not a number: %s"), multiplier, str); | ||
1179 | } | ||
1180 | return str; | ||
1181 | } | 1183 | } |
1182 | 1184 | ||
1183 | if(verbose>2) | 1185 | if(verbose>2) |
@@ -1187,15 +1189,15 @@ multiply (char *str) | |||
1187 | conv = fmtstr; | 1189 | conv = fmtstr; |
1188 | } | 1190 | } |
1189 | if (val == (int)val) { | 1191 | if (val == (int)val) { |
1190 | sprintf(str, "%.0f", val); | 1192 | snprintf(buffer, DEFAULT_BUFFER_SIZE, "%.0f", val); |
1191 | } else { | 1193 | } else { |
1192 | if(verbose>2) | 1194 | if(verbose>2) |
1193 | printf(" multiply using format: %s\n", conv); | 1195 | printf(" multiply using format: %s\n", conv); |
1194 | sprintf(str, conv, val); | 1196 | snprintf(buffer, DEFAULT_BUFFER_SIZE, conv, val); |
1195 | } | 1197 | } |
1196 | if(verbose>2) | 1198 | if(verbose>2) |
1197 | printf(" multiply result: %s\n", str); | 1199 | printf(" multiply result: %s\n", buffer); |
1198 | return str; | 1200 | return buffer; |
1199 | } | 1201 | } |
1200 | 1202 | ||
1201 | 1203 | ||
@@ -1272,7 +1274,7 @@ print_help (void) | |||
1272 | printf (" %s\n", "--rate-multiplier"); | 1274 | printf (" %s\n", "--rate-multiplier"); |
1273 | printf (" %s\n", _("Converts rate per second. For example, set to 60 to convert to per minute")); | 1275 | printf (" %s\n", _("Converts rate per second. For example, set to 60 to convert to per minute")); |
1274 | printf (" %s\n", "--offset=OFFSET"); | 1276 | printf (" %s\n", "--offset=OFFSET"); |
1275 | printf (" %s\n", _("Add/substract the specified OFFSET to numeric sensor data")); | 1277 | printf (" %s\n", _("Add/subtract the specified OFFSET to numeric sensor data")); |
1276 | 1278 | ||
1277 | /* Tests Against Strings */ | 1279 | /* Tests Against Strings */ |
1278 | printf (" %s\n", "-s, --string=STRING"); | 1280 | printf (" %s\n", "-s, --string=STRING"); |
diff --git a/plugins/check_swap.c b/plugins/check_swap.c index a607da1e..05f19ad4 100644 --- a/plugins/check_swap.c +++ b/plugins/check_swap.c | |||
@@ -34,9 +34,6 @@ const char *email = "devel@monitoring-plugins.org"; | |||
34 | #include "common.h" | 34 | #include "common.h" |
35 | #include "popen.h" | 35 | #include "popen.h" |
36 | #include "utils.h" | 36 | #include "utils.h" |
37 | #include <string.h> | ||
38 | #include <math.h> | ||
39 | #include <libintl.h> | ||
40 | 37 | ||
41 | #ifdef HAVE_DECL_SWAPCTL | 38 | #ifdef HAVE_DECL_SWAPCTL |
42 | # ifdef HAVE_SYS_PARAM_H | 39 | # ifdef HAVE_SYS_PARAM_H |
@@ -555,7 +552,7 @@ validate_arguments (void) | |||
555 | } | 552 | } |
556 | else if ((warn.is_percentage == crit.is_percentage) && (warn.value < crit.value)) { | 553 | else if ((warn.is_percentage == crit.is_percentage) && (warn.value < crit.value)) { |
557 | /* This is NOT triggered if warn and crit are different units, e.g warn is percentage | 554 | /* This is NOT triggered if warn and crit are different units, e.g warn is percentage |
558 | * and crit is absolut. We cannot determine the condition at this point since we | 555 | * and crit is absolute. We cannot determine the condition at this point since we |
559 | * dont know the value of total swap yet | 556 | * dont know the value of total swap yet |
560 | */ | 557 | */ |
561 | usage4(_("Warning should be more than critical")); | 558 | usage4(_("Warning should be more than critical")); |
diff --git a/plugins/check_tcp.c b/plugins/check_tcp.c index 1365b9cb..1d307cf3 100644 --- a/plugins/check_tcp.c +++ b/plugins/check_tcp.c | |||
@@ -128,7 +128,7 @@ main (int argc, char **argv) | |||
128 | SERVICE[i] = toupper(SERVICE[i]); | 128 | SERVICE[i] = toupper(SERVICE[i]); |
129 | } | 129 | } |
130 | 130 | ||
131 | /* set up a resonable buffer at first (will be realloc()'ed if | 131 | /* set up a reasonable buffer at first (will be realloc()'ed if |
132 | * user specifies other options) */ | 132 | * user specifies other options) */ |
133 | server_expect = calloc(sizeof(char *), 2); | 133 | server_expect = calloc(sizeof(char *), 2); |
134 | 134 | ||
diff --git a/plugins/check_ups.c b/plugins/check_ups.c index 0de37a20..12bce217 100644 --- a/plugins/check_ups.c +++ b/plugins/check_ups.c | |||
@@ -507,7 +507,7 @@ process_arguments (int argc, char **argv) | |||
507 | usage2 (_("Invalid hostname/address"), optarg); | 507 | usage2 (_("Invalid hostname/address"), optarg); |
508 | } | 508 | } |
509 | break; | 509 | break; |
510 | case 'T': /* FIXME: to be improved (ie "-T C" for Celsius or "-T F" for Farenheit) */ | 510 | case 'T': /* FIXME: to be improved (ie "-T C" for Celsius or "-T F" for Fahrenheit) */ |
511 | temp_output_c = 1; | 511 | temp_output_c = 1; |
512 | break; | 512 | break; |
513 | case 'u': /* ups name */ | 513 | case 'u': /* ups name */ |
diff --git a/plugins/picohttpparser/picohttpparser.c b/plugins/picohttpparser/picohttpparser.c index d9680b79..d0bfac62 100644 --- a/plugins/picohttpparser/picohttpparser.c +++ b/plugins/picohttpparser/picohttpparser.c | |||
@@ -400,7 +400,7 @@ int phr_parse_request(const char *buf_start, size_t len, const char **method, si | |||
400 | *num_headers = 0; | 400 | *num_headers = 0; |
401 | 401 | ||
402 | /* if last_len != 0, check if the request is complete (a fast countermeasure | 402 | /* if last_len != 0, check if the request is complete (a fast countermeasure |
403 | againt slowloris */ | 403 | against slowloris */ |
404 | if (last_len != 0 && is_complete(buf, buf_end, last_len, &r) == NULL) { | 404 | if (last_len != 0 && is_complete(buf, buf_end, last_len, &r) == NULL) { |
405 | return r; | 405 | return r; |
406 | } | 406 | } |
@@ -435,7 +435,7 @@ static const char *parse_response(const char *buf, const char *buf_end, int *maj | |||
435 | } | 435 | } |
436 | PARSE_INT_3(status); | 436 | PARSE_INT_3(status); |
437 | 437 | ||
438 | /* get message includig preceding space */ | 438 | /* get message including preceding space */ |
439 | if ((buf = get_token_to_eol(buf, buf_end, msg, msg_len, ret)) == NULL) { | 439 | if ((buf = get_token_to_eol(buf, buf_end, msg, msg_len, ret)) == NULL) { |
440 | return NULL; | 440 | return NULL; |
441 | } | 441 | } |
diff --git a/plugins/popen.c b/plugins/popen.c index 9eb49b62..723817d5 100644 --- a/plugins/popen.c +++ b/plugins/popen.c | |||
@@ -14,7 +14,7 @@ | |||
14 | * FILE * spopen(const char *); | 14 | * FILE * spopen(const char *); |
15 | * int spclose(FILE *); | 15 | * int spclose(FILE *); |
16 | * | 16 | * |
17 | * Code taken with liitle modification from "Advanced Programming for the Unix | 17 | * Code taken with little modification from "Advanced Programming for the Unix |
18 | * Environment" by W. Richard Stevens | 18 | * Environment" by W. Richard Stevens |
19 | * | 19 | * |
20 | * This is considered safe in that no shell is spawned, and the environment | 20 | * This is considered safe in that no shell is spawned, and the environment |
diff --git a/plugins/runcmd.c b/plugins/runcmd.c index a7155d27..1bd2ca1f 100644 --- a/plugins/runcmd.c +++ b/plugins/runcmd.c | |||
@@ -203,7 +203,7 @@ np_runcmd_open(const char *cmdstring, int *pfd, int *pfderr) | |||
203 | } | 203 | } |
204 | 204 | ||
205 | /* parent picks up execution here */ | 205 | /* parent picks up execution here */ |
206 | /* close childs descriptors in our address space */ | 206 | /* close children descriptors in our address space */ |
207 | close(pfd[1]); | 207 | close(pfd[1]); |
208 | close(pfderr[1]); | 208 | close(pfderr[1]); |
209 | 209 | ||
diff --git a/plugins/t/check_by_ssh.t b/plugins/t/check_by_ssh.t index 1d2939e9..b6479f1f 100644 --- a/plugins/t/check_by_ssh.t +++ b/plugins/t/check_by_ssh.t | |||
@@ -19,19 +19,19 @@ plan skip_all => "SSH_HOST and SSH_IDENTITY must be defined" unless ($ssh_servic | |||
19 | plan tests => 42; | 19 | plan tests => 42; |
20 | 20 | ||
21 | # Some random check strings/response | 21 | # Some random check strings/response |
22 | my @responce = ('OK: Everything is fine', | 22 | my @response = ('OK: Everything is fine', |
23 | 'WARNING: Hey, pick me, pick me', | 23 | 'WARNING: Hey, pick me, pick me', |
24 | 'CRITICAL: Shit happens', | 24 | 'CRITICAL: Shit happens', |
25 | 'UNKNOWN: What can I do for ya', | 25 | 'UNKNOWN: What can I do for ya', |
26 | 'WOOPS: What did I smoke', | 26 | 'WOOPS: What did I smoke', |
27 | ); | 27 | ); |
28 | my @responce_re; | 28 | my @response_re; |
29 | my @check; | 29 | my @check; |
30 | for (@responce) { | 30 | for (@response) { |
31 | push(@check, "echo $_"); | 31 | push(@check, "echo $_"); |
32 | my $re_str = $_; | 32 | my $re_str = $_; |
33 | $re_str =~ s{(.)} { "\Q$1" }ge; | 33 | $re_str =~ s{(.)} { "\Q$1" }ge; |
34 | push(@responce_re, $re_str); | 34 | push(@response_re, $re_str); |
35 | } | 35 | } |
36 | 36 | ||
37 | my $result; | 37 | my $result; |
@@ -47,7 +47,7 @@ for (my $i=0; $i<4; $i++) { | |||
47 | "./check_by_ssh -i $ssh_key -H $ssh_service -C '$check[$i]; exit $i'" | 47 | "./check_by_ssh -i $ssh_key -H $ssh_service -C '$check[$i]; exit $i'" |
48 | ); | 48 | ); |
49 | cmp_ok($result->return_code, '==', $i, "Exit with return code $i"); | 49 | cmp_ok($result->return_code, '==', $i, "Exit with return code $i"); |
50 | is($result->output, $responce[$i], "Status text is correct for check $i"); | 50 | is($result->output, $response[$i], "Status text is correct for check $i"); |
51 | } | 51 | } |
52 | 52 | ||
53 | $result = NPTest->testCmd( | 53 | $result = NPTest->testCmd( |
@@ -84,7 +84,7 @@ $result = NPTest->testCmd( | |||
84 | "./check_by_ssh -i $ssh_key -H $ssh_service -C '$check[4]; exit 8'" | 84 | "./check_by_ssh -i $ssh_key -H $ssh_service -C '$check[4]; exit 8'" |
85 | ); | 85 | ); |
86 | cmp_ok($result->return_code, '==', 8, "Exit with return code 8 (out of bounds)"); | 86 | cmp_ok($result->return_code, '==', 8, "Exit with return code 8 (out of bounds)"); |
87 | is($result->output, $responce[4], "Return proper status text even with unknown status codes"); | 87 | is($result->output, $response[4], "Return proper status text even with unknown status codes"); |
88 | 88 | ||
89 | $result = NPTest->testCmd( | 89 | $result = NPTest->testCmd( |
90 | "./check_by_ssh -i $ssh_key -H $ssh_service -F $ssh_conf -C 'exit 0'" | 90 | "./check_by_ssh -i $ssh_key -H $ssh_service -F $ssh_conf -C 'exit 0'" |
@@ -108,7 +108,7 @@ my %linemap = ( | |||
108 | foreach my $line (0, 2, 4, 6) { | 108 | foreach my $line (0, 2, 4, 6) { |
109 | my $code = $linemap{$line}; | 109 | my $code = $linemap{$line}; |
110 | my $statline = $line+1; | 110 | my $statline = $line+1; |
111 | is($lines[$line], "$responce[$code]", "multiple checks status text is correct for line $line"); | 111 | is($lines[$line], "$response[$code]", "multiple checks status text is correct for line $line"); |
112 | is($lines[$statline], "STATUS CODE: $code", "multiple check status code is correct for line $line"); | 112 | is($lines[$statline], "STATUS CODE: $code", "multiple check status code is correct for line $line"); |
113 | } | 113 | } |
114 | 114 | ||
@@ -124,7 +124,7 @@ close(PASV) or die("Unable to close '/tmp/check_by_ssh.$$': $!"); | |||
124 | cmp_ok(scalar(@pasv), '==', 1, 'One passive result for one check performed'); | 124 | cmp_ok(scalar(@pasv), '==', 1, 'One passive result for one check performed'); |
125 | for (0) { | 125 | for (0) { |
126 | if ($pasv[$_]) { | 126 | if ($pasv[$_]) { |
127 | like($pasv[$_], '/^\[\d+\] PROCESS_SERVICE_CHECK_RESULT;flint;serv;2;' . $responce_re[2] . '$/', 'proper result for passive check'); | 127 | like($pasv[$_], '/^\[\d+\] PROCESS_SERVICE_CHECK_RESULT;flint;serv;2;' . $response_re[2] . '$/', 'proper result for passive check'); |
128 | } else { | 128 | } else { |
129 | fail('proper result for passive check'); | 129 | fail('proper result for passive check'); |
130 | } | 130 | } |
@@ -144,7 +144,7 @@ for (0, 1, 2, 3, 4) { | |||
144 | if ($pasv[$_]) { | 144 | if ($pasv[$_]) { |
145 | my $ret = $_; | 145 | my $ret = $_; |
146 | $ret = 9 if ($_ == 4); | 146 | $ret = 9 if ($_ == 4); |
147 | like($pasv[$_], '/^\[\d+\] PROCESS_SERVICE_CHECK_RESULT;flint;c' . $_ . ';' . $ret . ';' . $responce_re[$_] . '$/', "proper result for passive check $_"); | 147 | like($pasv[$_], '/^\[\d+\] PROCESS_SERVICE_CHECK_RESULT;flint;c' . $_ . ';' . $ret . ';' . $response_re[$_] . '$/', "proper result for passive check $_"); |
148 | } else { | 148 | } else { |
149 | fail("proper result for passive check $_"); | 149 | fail("proper result for passive check $_"); |
150 | } | 150 | } |
diff --git a/plugins/t/check_disk.t b/plugins/t/check_disk.t index ec527e7f..ca035ce7 100644 --- a/plugins/t/check_disk.t +++ b/plugins/t/check_disk.t | |||
@@ -23,7 +23,7 @@ my $mountpoint2_valid = getTestParameter( "NP_MOUNTPOINT2_VALID", "Path to anoth | |||
23 | if ($mountpoint_valid eq "" or $mountpoint2_valid eq "") { | 23 | if ($mountpoint_valid eq "" or $mountpoint2_valid eq "") { |
24 | plan skip_all => "Need 2 mountpoints to test"; | 24 | plan skip_all => "Need 2 mountpoints to test"; |
25 | } else { | 25 | } else { |
26 | plan tests => 78; | 26 | plan tests => 88; |
27 | } | 27 | } |
28 | 28 | ||
29 | $result = NPTest->testCmd( | 29 | $result = NPTest->testCmd( |
@@ -326,19 +326,19 @@ cmp_ok( $result->return_code, '==', 0, "grouping: exit ok if the sum of free meg | |||
326 | $result = NPTest->testCmd( "./check_disk -w ". ($free_mb_on_all - 1) ." -c ". ($free_mb_on_all - 1) ." -p $mountpoint_valid -g group -p $mountpoint2_valid" ); | 326 | $result = NPTest->testCmd( "./check_disk -w ". ($free_mb_on_all - 1) ." -c ". ($free_mb_on_all - 1) ." -p $mountpoint_valid -g group -p $mountpoint2_valid" ); |
327 | cmp_ok( $result->return_code, '==', 3, "Invalid options: -p must come after groupname"); | 327 | cmp_ok( $result->return_code, '==', 3, "Invalid options: -p must come after groupname"); |
328 | 328 | ||
329 | # regex: exit unknown if given regex is not compileable | 329 | # regex: exit unknown if given regex is not compilable |
330 | $result = NPTest->testCmd( "./check_disk -w 1 -c 1 -r '('" ); | 330 | $result = NPTest->testCmd( "./check_disk -w 1 -c 1 -r '('" ); |
331 | cmp_ok( $result->return_code, '==', 3, "Exit UNKNOWN if regex is not compileable"); | 331 | cmp_ok( $result->return_code, '==', 3, "Exit UNKNOWN if regex is not compilable"); |
332 | 332 | ||
333 | # ignore: exit unknown, if all pathes are deselected using -i | 333 | # ignore: exit unknown, if all paths are deselected using -i |
334 | $result = NPTest->testCmd( "./check_disk -w 0% -c 0% -p $mountpoint_valid -p $mountpoint2_valid -i '$mountpoint_valid' -i '$mountpoint2_valid'" ); | 334 | $result = NPTest->testCmd( "./check_disk -w 0% -c 0% -p $mountpoint_valid -p $mountpoint2_valid -i '$mountpoint_valid' -i '$mountpoint2_valid'" ); |
335 | cmp_ok( $result->return_code, '==', 3, "ignore-ereg: Unknown if all fs are ignored (case sensitive)"); | 335 | cmp_ok( $result->return_code, '==', 3, "ignore-ereg: Unknown if all fs are ignored (case sensitive)"); |
336 | 336 | ||
337 | # ignore: exit unknown, if all pathes are deselected using -I | 337 | # ignore: exit unknown, if all paths are deselected using -I |
338 | $result = NPTest->testCmd( "./check_disk -w 0% -c 0% -p $mountpoint_valid -p $mountpoint2_valid -I '".uc($mountpoint_valid)."' -I '".uc($mountpoint2_valid)."'" ); | 338 | $result = NPTest->testCmd( "./check_disk -w 0% -c 0% -p $mountpoint_valid -p $mountpoint2_valid -I '".uc($mountpoint_valid)."' -I '".uc($mountpoint2_valid)."'" ); |
339 | cmp_ok( $result->return_code, '==', 3, "ignore-ereg: Unknown if all fs are ignored (case insensitive)"); | 339 | cmp_ok( $result->return_code, '==', 3, "ignore-ereg: Unknown if all fs are ignored (case insensitive)"); |
340 | 340 | ||
341 | # ignore: exit unknown, if all pathes are deselected using -i | 341 | # ignore: exit unknown, if all paths are deselected using -i |
342 | $result = NPTest->testCmd( "./check_disk -w 0% -c 0% -p $mountpoint_valid -p $mountpoint2_valid -i '.*'" ); | 342 | $result = NPTest->testCmd( "./check_disk -w 0% -c 0% -p $mountpoint_valid -p $mountpoint2_valid -i '.*'" ); |
343 | cmp_ok( $result->return_code, '==', 3, "ignore-ereg: Unknown if all fs are ignored using -i '.*'"); | 343 | cmp_ok( $result->return_code, '==', 3, "ignore-ereg: Unknown if all fs are ignored using -i '.*'"); |
344 | 344 | ||
@@ -347,7 +347,32 @@ $result = NPTest->testCmd( "./check_disk -w 0% -c 0% -p $mountpoint_valid -p $mo | |||
347 | like( $result->output, qr/$mountpoint_valid/, "output data does have $mountpoint_valid in it"); | 347 | like( $result->output, qr/$mountpoint_valid/, "output data does have $mountpoint_valid in it"); |
348 | unlike( $result->output, qr/$mountpoint2_valid/, "output data does not have $mountpoint2_valid in it"); | 348 | unlike( $result->output, qr/$mountpoint2_valid/, "output data does not have $mountpoint2_valid in it"); |
349 | 349 | ||
350 | # ignore: test if all pathes are listed when ignore regex doesn't match | 350 | # ignore: test if all paths are listed when ignore regex doesn't match |
351 | $result = NPTest->testCmd( "./check_disk -w 0% -c 0% -p $mountpoint_valid -p $mountpoint2_valid -i '^barbazJodsf\$'"); | 351 | $result = NPTest->testCmd( "./check_disk -w 0% -c 0% -p $mountpoint_valid -p $mountpoint2_valid -i '^barbazJodsf\$'"); |
352 | like( $result->output, qr/$mountpoint_valid/, "ignore: output data does have $mountpoint_valid when regex doesn't match"); | 352 | like( $result->output, qr/$mountpoint_valid/, "ignore: output data does have $mountpoint_valid when regex doesn't match"); |
353 | like( $result->output, qr/$mountpoint2_valid/,"ignore: output data does have $mountpoint2_valid when regex doesn't match"); | 353 | like( $result->output, qr/$mountpoint2_valid/,"ignore: output data does have $mountpoint2_valid when regex doesn't match"); |
354 | |||
355 | # ignore-missing: exit okay, when fs is not accessible | ||
356 | $result = NPTest->testCmd( "./check_disk --ignore-missing -w 0% -c 0% -p /bob"); | ||
357 | cmp_ok( $result->return_code, '==', 0, "ignore-missing: return okay for not existing filesystem /bob"); | ||
358 | like( $result->output, '/^DISK OK - No disks were found for provided parameters; - ignored paths: /bob;.*$/', 'Output OK'); | ||
359 | |||
360 | # ignore-missing: exit okay, when regex does not match | ||
361 | $result = NPTest->testCmd( "./check_disk --ignore-missing -w 0% -c 0% -r /bob"); | ||
362 | cmp_ok( $result->return_code, '==', 0, "ignore-missing: return okay for regular expression not matching"); | ||
363 | like( $result->output, '/^DISK OK - No disks were found for provided parameters;.*$/', 'Output OK'); | ||
364 | |||
365 | # ignore-missing: exit okay, when fs with exact match (-E) is not found | ||
366 | $result = NPTest->testCmd( "./check_disk --ignore-missing -w 0% -c 0% -E -p /etc"); | ||
367 | cmp_ok( $result->return_code, '==', 0, "ignore-missing: return okay when exact match does not find fs"); | ||
368 | like( $result->output, '/^DISK OK - No disks were found for provided parameters; - ignored paths: /etc;.*$/', 'Output OK'); | ||
369 | |||
370 | # ignore-missing: exit okay, when checking one existing fs and one non-existing fs (regex) | ||
371 | $result = NPTest->testCmd( "./check_disk --ignore-missing -w 0% -c 0% -r '/bob' -r '^/\$'"); | ||
372 | cmp_ok( $result->return_code, '==', 0, "ignore-missing: return okay for regular expression not matching"); | ||
373 | like( $result->output, '/^DISK OK - free space: \/ .*$/', 'Output OK'); | ||
374 | |||
375 | # ignore-missing: exit okay, when checking one existing fs and one non-existing fs (path) | ||
376 | $result = NPTest->testCmd( "./check_disk --ignore-missing -w 0% -c 0% -p '/bob' -p '/'"); | ||
377 | cmp_ok( $result->return_code, '==', 0, "ignore-missing: return okay for regular expression not matching"); | ||
378 | like( $result->output, '/^DISK OK - free space: / .*; - ignored paths: /bob;.*$/', 'Output OK'); \ No newline at end of file | ||
diff --git a/plugins/t/check_http.t b/plugins/t/check_http.t index 1ca52f61..1f2fbdfd 100644 --- a/plugins/t/check_http.t +++ b/plugins/t/check_http.t | |||
@@ -178,13 +178,13 @@ SKIP: { | |||
178 | 178 | ||
179 | $res = NPTest->testCmd( "./$plugin -I $host_tcp_proxy -p $port_tcp_proxy -u http://$host_tcp_http -e 200,301,302"); | 179 | $res = NPTest->testCmd( "./$plugin -I $host_tcp_proxy -p $port_tcp_proxy -u http://$host_tcp_http -e 200,301,302"); |
180 | is( $res->return_code, 0, "Proxy HTTP works"); | 180 | is( $res->return_code, 0, "Proxy HTTP works"); |
181 | like($res->output, qr/OK: Status line output matched/, "Proxy HTTP Output is sufficent"); | 181 | like($res->output, qr/OK: Status line output matched/, "Proxy HTTP Output is sufficient"); |
182 | 182 | ||
183 | $res = NPTest->testCmd( "./$plugin -I $host_tcp_proxy -p $port_tcp_proxy -H $host_tls_http -S -j CONNECT"); | 183 | $res = NPTest->testCmd( "./$plugin -I $host_tcp_proxy -p $port_tcp_proxy -H $host_tls_http -S -j CONNECT"); |
184 | is( $res->return_code, 0, "Proxy HTTP CONNECT works"); | 184 | is( $res->return_code, 0, "Proxy HTTP CONNECT works"); |
185 | like($res->output, qr/HTTP OK:/, "Proxy HTTP CONNECT output sufficent"); | 185 | like($res->output, qr/HTTP OK:/, "Proxy HTTP CONNECT output sufficient"); |
186 | 186 | ||
187 | $res = NPTest->testCmd( "./$plugin -I $host_tcp_proxy -p $port_tcp_proxy -H $host_tls_http -S -j CONNECT:HEAD"); | 187 | $res = NPTest->testCmd( "./$plugin -I $host_tcp_proxy -p $port_tcp_proxy -H $host_tls_http -S -j CONNECT:HEAD"); |
188 | is( $res->return_code, 0, "Proxy HTTP CONNECT works with override method"); | 188 | is( $res->return_code, 0, "Proxy HTTP CONNECT works with override method"); |
189 | like($res->output, qr/HTTP OK:/, "Proxy HTTP CONNECT output sufficent"); | 189 | like($res->output, qr/HTTP OK:/, "Proxy HTTP CONNECT output sufficient"); |
190 | } | 190 | } |
diff --git a/plugins/t/check_mysql.t b/plugins/t/check_mysql.t index e426bf59..baf3acc6 100644 --- a/plugins/t/check_mysql.t +++ b/plugins/t/check_mysql.t | |||
@@ -5,7 +5,7 @@ | |||
5 | # | 5 | # |
6 | # | 6 | # |
7 | # These are the database permissions required for this test: | 7 | # These are the database permissions required for this test: |
8 | # GRANT SELECT ON $db.* TO $user@$host INDENTIFIED BY '$password'; | 8 | # GRANT SELECT ON $db.* TO $user@$host IDENTIFIED BY '$password'; |
9 | # GRANT SUPER, REPLICATION CLIENT ON *.* TO $user@$host; | 9 | # GRANT SUPER, REPLICATION CLIENT ON *.* TO $user@$host; |
10 | # Check with: | 10 | # Check with: |
11 | # mysql -u$user -p$password -h$host $db | 11 | # mysql -u$user -p$password -h$host $db |
@@ -23,9 +23,9 @@ plan tests => 15; | |||
23 | my $bad_login_output = '/Access denied for user /'; | 23 | my $bad_login_output = '/Access denied for user /'; |
24 | my $mysqlserver = getTestParameter("NP_MYSQL_SERVER", "A MySQL Server hostname or IP with no slaves setup"); | 24 | my $mysqlserver = getTestParameter("NP_MYSQL_SERVER", "A MySQL Server hostname or IP with no slaves setup"); |
25 | my $mysqlsocket = getTestParameter("NP_MYSQL_SOCKET", "Full path to a MySQL Server socket with no slaves setup"); | 25 | my $mysqlsocket = getTestParameter("NP_MYSQL_SOCKET", "Full path to a MySQL Server socket with no slaves setup"); |
26 | my $mysql_login_details = getTestParameter("NP_MYSQL_LOGIN_DETAILS", "Command line parameters to specify login access (requires REPLICATION CLIENT privleges)", "-u test -ptest"); | 26 | my $mysql_login_details = getTestParameter("NP_MYSQL_LOGIN_DETAILS", "Command line parameters to specify login access (requires REPLICATION CLIENT privileges)", "-u test -ptest"); |
27 | my $with_slave = getTestParameter("NP_MYSQL_WITH_SLAVE", "MySQL server with slaves setup"); | 27 | my $with_slave = getTestParameter("NP_MYSQL_WITH_SLAVE", "MySQL server with slaves setup"); |
28 | my $with_slave_login = getTestParameter("NP_MYSQL_WITH_SLAVE_LOGIN", "Login details for server with slave (requires REPLICATION CLIENT privleges)", $mysql_login_details || "-u test -ptest"); | 28 | my $with_slave_login = getTestParameter("NP_MYSQL_WITH_SLAVE_LOGIN", "Login details for server with slave (requires REPLICATION CLIENT privileges)", $mysql_login_details || "-u test -ptest"); |
29 | 29 | ||
30 | my $result; | 30 | my $result; |
31 | 31 | ||
diff --git a/plugins/t/check_mysql_query.t b/plugins/t/check_mysql_query.t index 96899ac6..c30245b2 100644 --- a/plugins/t/check_mysql_query.t +++ b/plugins/t/check_mysql_query.t | |||
@@ -31,7 +31,7 @@ $result = NPTest->testCmd("./check_mysql_query -q 'SELECT 1+1' -H $mysqlserver $ | |||
31 | cmp_ok( $result->return_code, '==', 0, "Can run query"); | 31 | cmp_ok( $result->return_code, '==', 0, "Can run query"); |
32 | 32 | ||
33 | $result = NPTest->testCmd("./check_mysql_query -H $mysqlserver $mysql_login_details"); | 33 | $result = NPTest->testCmd("./check_mysql_query -H $mysqlserver $mysql_login_details"); |
34 | cmp_ok( $result->return_code, '==', 3, "Missing query parmeter"); | 34 | cmp_ok( $result->return_code, '==', 3, "Missing query parameter"); |
35 | like( $result->output, "/Must specify a SQL query to run/", "Missing query error message"); | 35 | like( $result->output, "/Must specify a SQL query to run/", "Missing query error message"); |
36 | 36 | ||
37 | $result = NPTest->testCmd("./check_mysql_query -q 'SELECT 1+1' -H $mysqlserver -u dummy -d mysql"); | 37 | $result = NPTest->testCmd("./check_mysql_query -q 'SELECT 1+1' -H $mysqlserver -u dummy -d mysql"); |
diff --git a/plugins/t/check_nagios.t b/plugins/t/check_nagios.t index 81fc24d8..f38f5e9c 100644 --- a/plugins/t/check_nagios.t +++ b/plugins/t/check_nagios.t | |||
@@ -36,7 +36,7 @@ cmp_ok( $result->return_code, '==', 1, "Log over 5 minutes old" ); | |||
36 | like ( $result->output, $warningOutput, "Output for warning correct" ); | 36 | like ( $result->output, $warningOutput, "Output for warning correct" ); |
37 | 37 | ||
38 | my $now = time; | 38 | my $now = time; |
39 | # This substitution is dependant on the testcase | 39 | # This substitution is dependent on the testcase |
40 | system( "perl -pe 's/1133537544/$now/' $nagios1 > $nagios1.tmp" ) == 0 or die "Problem with munging $nagios1"; | 40 | system( "perl -pe 's/1133537544/$now/' $nagios1 > $nagios1.tmp" ) == 0 or die "Problem with munging $nagios1"; |
41 | 41 | ||
42 | $result = NPTest->testCmd( | 42 | $result = NPTest->testCmd( |
diff --git a/plugins/t/negate.t b/plugins/t/negate.t index d96a109b..5ec1c843 100644 --- a/plugins/t/negate.t +++ b/plugins/t/negate.t | |||
@@ -84,7 +84,7 @@ foreach my $current_state (keys(%state)) { | |||
84 | foreach my $new_state (keys(%state)) { | 84 | foreach my $new_state (keys(%state)) { |
85 | $res = NPTest->testCmd( "./negate -s --$current_state=$new_state ./check_dummy ".$state{$current_state}." 'Fake $new_state'" ); | 85 | $res = NPTest->testCmd( "./negate -s --$current_state=$new_state ./check_dummy ".$state{$current_state}." 'Fake $new_state'" ); |
86 | is( $res->return_code, $state{$new_state}, "Got fake $new_state (with substitute)" ); | 86 | is( $res->return_code, $state{$new_state}, "Got fake $new_state (with substitute)" ); |
87 | is( $res->output, uc($new_state).": Fake $new_state", "Substitued fake $new_state output"); | 87 | is( $res->output, uc($new_state).": Fake $new_state", "Substituted fake $new_state output"); |
88 | } | 88 | } |
89 | } | 89 | } |
90 | 90 | ||
diff --git a/plugins/tests/check_procs.t b/plugins/tests/check_procs.t index 3af218f5..b3a0a301 100755 --- a/plugins/tests/check_procs.t +++ b/plugins/tests/check_procs.t | |||
@@ -8,7 +8,7 @@ use Test::More; | |||
8 | use NPTest; | 8 | use NPTest; |
9 | 9 | ||
10 | if (-x "./check_procs") { | 10 | if (-x "./check_procs") { |
11 | plan tests => 52; | 11 | plan tests => 54; |
12 | } else { | 12 | } else { |
13 | plan skip_all => "No check_procs compiled"; | 13 | plan skip_all => "No check_procs compiled"; |
14 | } | 14 | } |
@@ -34,9 +34,13 @@ is( $result->return_code, 0, "Checking no threshold breeched" ); | |||
34 | is( $result->output, "PROCS OK: 95 processes | procs=95;100;200;0;", "Output correct" ); | 34 | is( $result->output, "PROCS OK: 95 processes | procs=95;100;200;0;", "Output correct" ); |
35 | 35 | ||
36 | $result = NPTest->testCmd( "$command -C launchd -c 5" ); | 36 | $result = NPTest->testCmd( "$command -C launchd -c 5" ); |
37 | is( $result->return_code, 2, "Checking processes filtered by command name" ); | 37 | is( $result->return_code, 2, "Checking processes matched by command name" ); |
38 | is( $result->output, "PROCS CRITICAL: 6 processes with command name 'launchd' | procs=6;;5;0;", "Output correct" ); | 38 | is( $result->output, "PROCS CRITICAL: 6 processes with command name 'launchd' | procs=6;;5;0;", "Output correct" ); |
39 | 39 | ||
40 | $result = NPTest->testCmd( "$command -X bash -c 5" ); | ||
41 | is( $result->return_code, 2, "Checking processes excluded by command name" ); | ||
42 | is( $result->output, "PROCS CRITICAL: 95 processes with exclude progs 'bash' | procs=95;;5;0;", "Output correct" ); | ||
43 | |||
40 | SKIP: { | 44 | SKIP: { |
41 | skip 'user with uid 501 required', 4 unless getpwuid(501); | 45 | skip 'user with uid 501 required', 4 unless getpwuid(501); |
42 | 46 | ||
diff --git a/plugins/tests/check_snmp.t b/plugins/tests/check_snmp.t index bc03ec60..bfe42e16 100755 --- a/plugins/tests/check_snmp.t +++ b/plugins/tests/check_snmp.t | |||
@@ -53,7 +53,7 @@ if ($pid) { | |||
53 | #print "child\n"; | 53 | #print "child\n"; |
54 | 54 | ||
55 | print "Please contact SNMP at: $port_snmp\n"; | 55 | print "Please contact SNMP at: $port_snmp\n"; |
56 | close(STDERR); # Coment out to debug snmpd problems (most errors sent there are OK) | 56 | close(STDERR); # Comment out to debug snmpd problems (most errors sent there are OK) |
57 | exec("snmpd -c tests/conf/snmpd.conf -C -f -r udp:$port_snmp"); | 57 | exec("snmpd -c tests/conf/snmpd.conf -C -f -r udp:$port_snmp"); |
58 | } | 58 | } |
59 | 59 | ||
@@ -227,7 +227,7 @@ is($res->output, 'SNMP OK - "555\"I said\"" | ', "Check string with a double quo | |||
227 | 227 | ||
228 | $res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.15 -r 'CUSTOM CHECK OK'" ); | 228 | $res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.15 -r 'CUSTOM CHECK OK'" ); |
229 | is($res->return_code, 0, "String check should check whole string, not a parsed number" ); | 229 | is($res->return_code, 0, "String check should check whole string, not a parsed number" ); |
230 | is($res->output, 'SNMP OK - "CUSTOM CHECK OK: foo is 12345" | ', "String check witn numbers returns whole string"); | 230 | is($res->output, 'SNMP OK - "CUSTOM CHECK OK: foo is 12345" | ', "String check with numbers returns whole string"); |
231 | 231 | ||
232 | $res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.16 -w -2: -c -3:" ); | 232 | $res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.16 -w -2: -c -3:" ); |
233 | is($res->return_code, 0, "Negative integer check OK" ); | 233 | is($res->return_code, 0, "Negative integer check OK" ); |
diff --git a/plugins/utils.h b/plugins/utils.h index 5b54da3c..c76b3216 100644 --- a/plugins/utils.h +++ b/plugins/utils.h | |||
@@ -7,7 +7,7 @@ | |||
7 | /* The purpose of this package is to provide safer alternatives to C | 7 | /* The purpose of this package is to provide safer alternatives to C |
8 | functions that might otherwise be vulnerable to hacking. This | 8 | functions that might otherwise be vulnerable to hacking. This |
9 | currently includes a standard suite of validation routines to be sure | 9 | currently includes a standard suite of validation routines to be sure |
10 | that an string argument acually converts to its intended type and a | 10 | that an string argument actually converts to its intended type and a |
11 | suite of string handling routine that do their own memory management | 11 | suite of string handling routine that do their own memory management |
12 | in order to resist overflow attacks. In addition, a few functions are | 12 | in order to resist overflow attacks. In addition, a few functions are |
13 | provided to standardize version and error reporting across the entire | 13 | provided to standardize version and error reporting across the entire |
@@ -936,12 +936,12 @@ msgstr "" | |||
936 | #: plugins/check_fping.c:422 | 936 | #: plugins/check_fping.c:422 |
937 | #, c-format | 937 | #, c-format |
938 | msgid "%s: Only one threshold may be packet loss (%s)\n" | 938 | msgid "%s: Only one threshold may be packet loss (%s)\n" |
939 | msgstr "%s: Nur ein Wert darf für paket loss angegeben werden (%s)\n" | 939 | msgstr "%s: Nur ein Wert darf für packet loss angegeben werden (%s)\n" |
940 | 940 | ||
941 | #: plugins/check_fping.c:426 | 941 | #: plugins/check_fping.c:426 |
942 | #, c-format | 942 | #, c-format |
943 | msgid "%s: Only one threshold must be packet loss (%s)\n" | 943 | msgid "%s: Only one threshold must be packet loss (%s)\n" |
944 | msgstr "%s: Nur ein Wert darf für paket loss angegeben werden (%s)\n" | 944 | msgstr "%s: Nur ein Wert darf für packet loss angegeben werden (%s)\n" |
945 | 945 | ||
946 | #: plugins/check_fping.c:458 | 946 | #: plugins/check_fping.c:458 |
947 | msgid "" | 947 | msgid "" |
@@ -3315,7 +3315,7 @@ msgid "Include server version string in results" | |||
3315 | msgstr "" | 3315 | msgstr "" |
3316 | 3316 | ||
3317 | #: plugins/check_nwstat.c:1671 | 3317 | #: plugins/check_nwstat.c:1671 |
3318 | msgid "- This plugin requres that the MRTGEXT.NLM file from James Drews' MRTG" | 3318 | msgid "- This plugin requires that the MRTGEXT.NLM file from James Drews' MRTG" |
3319 | msgstr "" | 3319 | msgstr "" |
3320 | 3320 | ||
3321 | #: plugins/check_nwstat.c:1672 | 3321 | #: plugins/check_nwstat.c:1672 |
@@ -4299,7 +4299,7 @@ msgid "This plugin will attempt to open an RTSP connection with the host." | |||
4299 | msgstr "Dieses plugin testet Gameserververbindungen zum angegebenen Host." | 4299 | msgstr "Dieses plugin testet Gameserververbindungen zum angegebenen Host." |
4300 | 4300 | ||
4301 | #: plugins/check_real.c:438 plugins/check_smtp.c:830 | 4301 | #: plugins/check_real.c:438 plugins/check_smtp.c:830 |
4302 | msgid "Successul connects return STATE_OK, refusals and timeouts return" | 4302 | msgid "Successful connects return STATE_OK, refusals and timeouts return" |
4303 | msgstr "" | 4303 | msgstr "" |
4304 | 4304 | ||
4305 | #: plugins/check_real.c:439 | 4305 | #: plugins/check_real.c:439 |
@@ -4721,7 +4721,7 @@ msgid "" | |||
4721 | msgstr "" | 4721 | msgstr "" |
4722 | 4722 | ||
4723 | #: plugins/check_snmp.c:1143 | 4723 | #: plugins/check_snmp.c:1143 |
4724 | msgid "Add/substract the specified OFFSET to numeric sensor data" | 4724 | msgid "Add/subtract the specified OFFSET to numeric sensor data" |
4725 | msgstr "" | 4725 | msgstr "" |
4726 | 4726 | ||
4727 | #: plugins/check_snmp.c:1147 | 4727 | #: plugins/check_snmp.c:1147 |
@@ -4943,7 +4943,7 @@ msgid "" | |||
4943 | msgstr "" | 4943 | msgstr "" |
4944 | 4944 | ||
4945 | #: plugins/check_swap.c:541 | 4945 | #: plugins/check_swap.c:541 |
4946 | msgid "Exit with CRITCAL status if less than PERCENT of swap space is free" | 4946 | msgid "Exit with CRITICAL status if less than PERCENT of swap space is free" |
4947 | msgstr "" | 4947 | msgstr "" |
4948 | 4948 | ||
4949 | #: plugins/check_swap.c:543 | 4949 | #: plugins/check_swap.c:543 |
@@ -6372,7 +6372,7 @@ msgstr "" | |||
6372 | #~ " Exit with CRITICAL status if less than INTEGER --units of disk are " | 6372 | #~ " Exit with CRITICAL status if less than INTEGER --units of disk are " |
6373 | #~ "free\n" | 6373 | #~ "free\n" |
6374 | #~ " -c, --critical=PERCENT%%\n" | 6374 | #~ " -c, --critical=PERCENT%%\n" |
6375 | #~ " Exit with CRITCAL status if less than PERCENT of disk space is free\n" | 6375 | #~ " Exit with CRITICAL status if less than PERCENT of disk space is free\n" |
6376 | #~ " -C, --clear\n" | 6376 | #~ " -C, --clear\n" |
6377 | #~ " Clear thresholds\n" | 6377 | #~ " Clear thresholds\n" |
6378 | #~ msgstr "" | 6378 | #~ msgstr "" |
@@ -3372,7 +3372,7 @@ msgid "Include server version string in results" | |||
3372 | msgstr "" | 3372 | msgstr "" |
3373 | 3373 | ||
3374 | #: plugins/check_nwstat.c:1671 | 3374 | #: plugins/check_nwstat.c:1671 |
3375 | msgid "- This plugin requres that the MRTGEXT.NLM file from James Drews' MRTG" | 3375 | msgid "- This plugin requires that the MRTGEXT.NLM file from James Drews' MRTG" |
3376 | msgstr "" | 3376 | msgstr "" |
3377 | 3377 | ||
3378 | #: plugins/check_nwstat.c:1672 | 3378 | #: plugins/check_nwstat.c:1672 |
@@ -4372,7 +4372,7 @@ msgid "This plugin will attempt to open an RTSP connection with the host." | |||
4372 | msgstr "Ce plugin va essayer d'ouvrir un connexion RTSP avec l'hôte." | 4372 | msgstr "Ce plugin va essayer d'ouvrir un connexion RTSP avec l'hôte." |
4373 | 4373 | ||
4374 | #: plugins/check_real.c:438 plugins/check_smtp.c:830 | 4374 | #: plugins/check_real.c:438 plugins/check_smtp.c:830 |
4375 | msgid "Successul connects return STATE_OK, refusals and timeouts return" | 4375 | msgid "Successful connects return STATE_OK, refusals and timeouts return" |
4376 | msgstr "" | 4376 | msgstr "" |
4377 | 4377 | ||
4378 | #: plugins/check_real.c:439 | 4378 | #: plugins/check_real.c:439 |
@@ -4784,7 +4784,7 @@ msgid "" | |||
4784 | msgstr "" | 4784 | msgstr "" |
4785 | 4785 | ||
4786 | #: plugins/check_snmp.c:1143 | 4786 | #: plugins/check_snmp.c:1143 |
4787 | msgid "Add/substract the specified OFFSET to numeric sensor data" | 4787 | msgid "Add/subtract the specified OFFSET to numeric sensor data" |
4788 | msgstr "" | 4788 | msgstr "" |
4789 | 4789 | ||
4790 | #: plugins/check_snmp.c:1147 | 4790 | #: plugins/check_snmp.c:1147 |
@@ -5021,7 +5021,7 @@ msgstr "" | |||
5021 | "sont libres" | 5021 | "sont libres" |
5022 | 5022 | ||
5023 | #: plugins/check_swap.c:541 | 5023 | #: plugins/check_swap.c:541 |
5024 | msgid "Exit with CRITCAL status if less than PERCENT of swap space is free" | 5024 | msgid "Exit with CRITICAL status if less than PERCENT of swap space is free" |
5025 | msgstr "" | 5025 | msgstr "" |
5026 | "Sortir avec un résultat CRITIQUE si moins de X pour cent de mémoire " | 5026 | "Sortir avec un résultat CRITIQUE si moins de X pour cent de mémoire " |
5027 | "virtuelle est libre" | 5027 | "virtuelle est libre" |
diff --git a/po/monitoring-plugins.pot b/po/monitoring-plugins.pot index 5bc23637..1535db80 100644 --- a/po/monitoring-plugins.pot +++ b/po/monitoring-plugins.pot | |||
@@ -3225,7 +3225,7 @@ msgid "Include server version string in results" | |||
3225 | msgstr "" | 3225 | msgstr "" |
3226 | 3226 | ||
3227 | #: plugins/check_nwstat.c:1671 | 3227 | #: plugins/check_nwstat.c:1671 |
3228 | msgid "- This plugin requres that the MRTGEXT.NLM file from James Drews' MRTG" | 3228 | msgid "- This plugin requires that the MRTGEXT.NLM file from James Drews' MRTG" |
3229 | msgstr "" | 3229 | msgstr "" |
3230 | 3230 | ||
3231 | #: plugins/check_nwstat.c:1672 | 3231 | #: plugins/check_nwstat.c:1672 |
@@ -4193,7 +4193,7 @@ msgid "This plugin will attempt to open an RTSP connection with the host." | |||
4193 | msgstr "" | 4193 | msgstr "" |
4194 | 4194 | ||
4195 | #: plugins/check_real.c:438 plugins/check_smtp.c:830 | 4195 | #: plugins/check_real.c:438 plugins/check_smtp.c:830 |
4196 | msgid "Successul connects return STATE_OK, refusals and timeouts return" | 4196 | msgid "Successful connects return STATE_OK, refusals and timeouts return" |
4197 | msgstr "" | 4197 | msgstr "" |
4198 | 4198 | ||
4199 | #: plugins/check_real.c:439 | 4199 | #: plugins/check_real.c:439 |
@@ -4597,7 +4597,7 @@ msgid "" | |||
4597 | msgstr "" | 4597 | msgstr "" |
4598 | 4598 | ||
4599 | #: plugins/check_snmp.c:1143 | 4599 | #: plugins/check_snmp.c:1143 |
4600 | msgid "Add/substract the specified OFFSET to numeric sensor data" | 4600 | msgid "Add/subtract the specified OFFSET to numeric sensor data" |
4601 | msgstr "" | 4601 | msgstr "" |
4602 | 4602 | ||
4603 | #: plugins/check_snmp.c:1147 | 4603 | #: plugins/check_snmp.c:1147 |
@@ -4817,7 +4817,7 @@ msgid "" | |||
4817 | msgstr "" | 4817 | msgstr "" |
4818 | 4818 | ||
4819 | #: plugins/check_swap.c:541 | 4819 | #: plugins/check_swap.c:541 |
4820 | msgid "Exit with CRITCAL status if less than PERCENT of swap space is free" | 4820 | msgid "Exit with CRITICAL status if less than PERCENT of swap space is free" |
4821 | msgstr "" | 4821 | msgstr "" |
4822 | 4822 | ||
4823 | #: plugins/check_swap.c:543 | 4823 | #: plugins/check_swap.c:543 |
@@ -291,7 +291,7 @@ always returns 0. | |||
291 | .Xc | 291 | .Xc |
292 | .El | 292 | .El |
293 | .Pp | 293 | .Pp |
294 | For maximum compatability your test program should return a particular | 294 | For maximum compatibility your test program should return a particular |
295 | exit code. This is calculated by | 295 | exit code. This is calculated by |
296 | .Fn exit_status | 296 | .Fn exit_status |
297 | so it is sufficient to always return from | 297 | so it is sufficient to always return from |
@@ -309,7 +309,7 @@ directory in the source distribution contains numerous tests of | |||
309 | functionality, written using | 309 | functionality, written using |
310 | .Nm . | 310 | .Nm . |
311 | Examine them for examples of how to construct test suites. | 311 | Examine them for examples of how to construct test suites. |
312 | .Sh COMPATABILITY | 312 | .Sh COMPATIBILITY |
313 | .Nm | 313 | .Nm |
314 | strives to be compatible with the Perl Test::More and Test::Harness | 314 | strives to be compatible with the Perl Test::More and Test::Harness |
315 | modules. The test suite verifies that | 315 | modules. The test suite verifies that |
@@ -25,7 +25,7 @@ | |||
25 | */ | 25 | */ |
26 | 26 | ||
27 | /* '## __VA_ARGS__' is a gcc'ism. C99 doesn't allow the token pasting | 27 | /* '## __VA_ARGS__' is a gcc'ism. C99 doesn't allow the token pasting |
28 | and requires the caller to add the final comma if they've ommitted | 28 | and requires the caller to add the final comma if they've omitted |
29 | the optional arguments */ | 29 | the optional arguments */ |
30 | #ifdef __GNUC__ | 30 | #ifdef __GNUC__ |
31 | # define ok(e, test, ...) ((e) ? \ | 31 | # define ok(e, test, ...) ((e) ? \ |
diff --git a/tools/build_perl_modules b/tools/build_perl_modules index 5a57a471..b8cd34c3 100755 --- a/tools/build_perl_modules +++ b/tools/build_perl_modules | |||
@@ -140,7 +140,7 @@ my $libs = "$destdir/$prefix/lib:$destdir/$prefix/lib/$Config{archname}"; | |||
140 | 140 | ||
141 | my $topdir = cwd(); | 141 | my $topdir = cwd(); |
142 | 142 | ||
143 | # set an initial value if there isnt one already | 143 | # set an initial value if there isn't one already |
144 | # Need to use PERL5LIB to ensure we get pre-installed mods from earlier | 144 | # Need to use PERL5LIB to ensure we get pre-installed mods from earlier |
145 | # tags in the install_order file | 145 | # tags in the install_order file |
146 | $ENV{PERL5LIB} ||= q{}; | 146 | $ENV{PERL5LIB} ||= q{}; |
@@ -149,8 +149,8 @@ $ENV{PERL5LIB} ||= q{}; | |||
149 | $ENV{PERL_AUTOINSTALL} = "--skipdeps"; | 149 | $ENV{PERL_AUTOINSTALL} = "--skipdeps"; |
150 | 150 | ||
151 | # keep a record of how many times a module build is done. This is so they may | 151 | # keep a record of how many times a module build is done. This is so they may |
152 | # be built a second time to include optional prereq's that couldnt | 152 | # be built a second time to include optional prereq's that couldn't |
153 | # previously be built due to circular dependancies | 153 | # previously be built due to circular dependencies |
154 | my %built_modules; | 154 | my %built_modules; |
155 | foreach my $tarball (@tarballs) { | 155 | foreach my $tarball (@tarballs) { |
156 | ( my $dir = $tarball ) =~ s/\.(?:tgz|tar.gz)$//; | 156 | ( my $dir = $tarball ) =~ s/\.(?:tgz|tar.gz)$//; |
diff --git a/tools/p1.pl b/tools/p1.pl index 2788dbff..9cbe6dc0 100644 --- a/tools/p1.pl +++ b/tools/p1.pl | |||
@@ -2,7 +2,7 @@ | |||
2 | # | 2 | # |
3 | # Hacked version of the sample code from the perlembedded doco. | 3 | # Hacked version of the sample code from the perlembedded doco. |
4 | # | 4 | # |
5 | # Only major changes are to separate the compiling and cacheing from | 5 | # Only major changes are to separate the compiling and caching from |
6 | # the execution so that the cache can be kept in "non-volatile" parent | 6 | # the execution so that the cache can be kept in "non-volatile" parent |
7 | # process while the execution is done from "volatile" child processes | 7 | # process while the execution is done from "volatile" child processes |
8 | # and that STDOUT is redirected to a file by means of a tied filehandle | 8 | # and that STDOUT is redirected to a file by means of a tied filehandle |
diff --git a/tools/tinderbox_build b/tools/tinderbox_build index 48836b1e..1a41f577 100755 --- a/tools/tinderbox_build +++ b/tools/tinderbox_build | |||
@@ -138,7 +138,7 @@ sub BuildIt { | |||
138 | # interprets that as the end of the mail, and truncates the log before | 138 | # interprets that as the end of the mail, and truncates the log before |
139 | # it gets to Tinderbox. (terry weismann, chris yeh) | 139 | # it gets to Tinderbox. (terry weismann, chris yeh) |
140 | # | 140 | # |
141 | # This was replaced by a perl 'port' of the above, writen by | 141 | # This was replaced by a perl 'port' of the above, written by |
142 | # preed@netscape.com; good things: no need for system() call, and now it's | 142 | # preed@netscape.com; good things: no need for system() call, and now it's |
143 | # all in perl, so we don't have to do OS checking like before. | 143 | # all in perl, so we don't have to do OS checking like before. |
144 | 144 | ||