From flo at bier.homeip.net Wed Sep 5 13:30:32 2007 From: flo at bier.homeip.net (Florian Gleixner) Date: Wed, 05 Sep 2007 13:30:32 +0200 Subject: [Nagiosplug-devel] Patch for check_oracle on Solaris and/or Oracle 8.X Message-ID: <46DE9358.4090908@bier.homeip.net> Hi There are 2 bugs in check oracle: on Solaris the /usr/bin/awk behaves different than on Linux. But Solaris has /usr/xpg4/bin/awk and nawk that behaves like the Linux one. The second bug: Unfortunately the syntax of joins did change: Oracle 8.X only knows the (+) operator while with Oracle 9 the "LEFT OUTER JOIN" Syntax was established. As far as i can see the outer join operator is still supported in Oracle 10g. Below a patch that should fix these issues. Florian Gleixner --- check_oracle 2007-09-05 13:17:01.000000000 +0200 +++ check_oracle.orig 2007-07-27 11:53:42.000000000 +0200 @@ -12,10 +12,6 @@ . $PROGPATH/utils.sh -if [ `uname -s` = "SunOS" ] ; then - PATH=/usr/xpg4/bin:$PATH - export PATH -fi print_usage() { echo "Usage:" @@ -253,10 +249,11 @@ select NVL(b.free,0.0),a.total,100 - trunc(NVL(b.free,0.0)/a.total * 1000) / 10 prc from ( select tablespace_name,sum(bytes)/1024/1024 total -from dba_data_files group by tablespace_name) A, +from dba_data_files group by tablespace_name) A +LEFT OUTER JOIN ( select tablespace_name,sum(bytes)/1024/1024 free from dba_free_space group by tablespace_name) B -WHERE a.tablespace_name=b.tablespace_name(+) AND a.tablespace_name='${5}'; +ON a.tablespace_name=b.tablespace_name WHERE a.tablespace_name='${5}'; EOF` if [ -n "`echo $result | grep ORA-`" ] ; then From noreply at sourceforge.net Wed Sep 5 23:21:24 2007 From: noreply at sourceforge.net (SourceForge.net) Date: Wed, 05 Sep 2007 14:21:24 -0700 Subject: [Nagiosplug-devel] [ nagiosplug-Bugs-1789000 ] Minor VPATH prob in plugins-root MF Message-ID: Bugs item #1789000, was opened at 2007-09-05 17:21 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=397597&aid=1789000&group_id=29880 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Compilation Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Tom Payerle (payerle) Assigned to: Nobody/Anonymous (nobody) Summary: Minor VPATH prob in plugins-root MF Initial Comment: When compiling in a subdirectory, e.g. i386_rel30 of main plugins root directory, get the following error after running ../configure make [ eliding much successful compilations ... ] Making all in plugins-root make[2]: Entering directory `[...]/Nagios/src/plugins/nagios-plugins-1.4.9/i386_rel30/plugins-root' make[2]: *** No rule to make target `check_dhcp.c', needed by `check_dhcp.o'. Stop. The problem appears to be in Makefile in plugins-root, changing it to include $(srcdir) in VPATH, e.g. 133c133 < VPATH = $(top_srcdir) $(top_srcdir)/lib $(top_srcdir)/plugins $(top_srcdir)/plugins/t --- > VPATH = $(top_srcdir) $(top_srcdir)/lib $(top_srcdir)/plugins $(top_srcdir)/plugins/t $(srcdir) seems to fix the problem ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=397597&aid=1789000&group_id=29880 From bohara at gmail.com Thu Sep 6 11:02:12 2007 From: bohara at gmail.com (Ben O'Hara) Date: Thu, 6 Sep 2007 10:02:12 +0100 Subject: [Nagiosplug-devel] Perfdata for check_mysql Message-ID: <2b36e660709060202l7d75c0dh3e0fe8d6ed40dbc9@mail.gmail.com> Attached is a patch against the latest 1.4.9 release of the plugins for check_mysql to add performance data. Took it from this old entry and fixed to work with latest release... https://sourceforge.net/tracker/?func=detail&atid=397599&aid=1150826&group_id=29880 Seems to do the job, ive not given it any thorough testing but seems to work....any chance of getting this merged into CVS/SVN as im sure people are after this data and save repatching after upgrades ;-) Cheers Ben -- "A Scientist will earn a living by taking a really difficult problem and spends many years solving it, an engineer earns a living by finding really difficult problems and side stepping them" -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: check_mysql.diff Type: application/octet-stream Size: 3149 bytes Desc: not available URL: From bohara at gmail.com Thu Sep 6 12:43:21 2007 From: bohara at gmail.com (Ben O'Hara) Date: Thu, 6 Sep 2007 11:43:21 +0100 Subject: [Nagiosplug-devel] 1.4.9 and Invalid hostname/address Message-ID: <2b36e660709060343w43448d78ra0a526143f7ff1de@mail.gmail.com> Hi All, Just compiled up 1.4.9 on Solaris 7 and seeing some strange problems with plugins failing with the error "Invalid hostname/address" bash-3.1# ./check_mysql -H ariadne check_mysql: Invalid hostname/address - ariadne Usage:check_mysql [-d database] [-H host] [-P port] [-u user] [-p password] [-S] bash-3.1# ping ariadne ariadne is alive These checks work fine under FreeBSD but not on Solaris 7, any ideas? The hostname is resolvable and even trying with IP results in the same error. Cheers Ben -- "A Scientist will earn a living by taking a really difficult problem and spends many years solving it, an engineer earns a living by finding really difficult problems and side stepping them" -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: check_mysql.diff Type: application/octet-stream Size: 3149 bytes Desc: not available URL: From nagios at cohen123.com Thu Sep 6 18:48:05 2007 From: nagios at cohen123.com (Tal Cohen) Date: Thu, 6 Sep 2007 12:48:05 -0400 Subject: [Nagiosplug-devel] EPN Newbie question Message-ID: <006101c7f0a5$b2885e20$5a01a8c0@D3233XB1> Hi Folks, I am new to developing Perl based plugins with Nagios EPN, so please be gentle - and let me know if this is the right list to send these types of questions to (I tried posting this to nagios-devel at lists.sourceforge.net but I think it is the wrong list). I am trying to do something that I thought would be simple but is starting to drive me crazy. I want to create a plug-in that will retain data in memory across multiple executions. As an initial test, I created a counter plug-in: use lib "/usr/local/nagios/libexec"; use utils qw(%ERRORS); use strict; use vars qw($counter); $counter++; print "The counter is ".$counter; exit $ERRORS{'OK'}; So far, so good. When I test this in mini_epn, it works as expected incrementing each time I invoke it. However, when I add this as a check into the Nagios configuration file and launch Nagios, the value does not increment across multiple executions. What am I missing? Thanks, Tal -------------- next part -------------- An HTML attachment was scrubbed... URL: From gbwalzer at gmail.com Wed Sep 12 00:48:29 2007 From: gbwalzer at gmail.com (Gustave Walzer) Date: Tue, 11 Sep 2007 18:48:29 -0400 Subject: [Nagiosplug-devel] Introduction Message-ID: Hi I am a college student who is taking a Unix scripting class. I am interested in this project and wish to help. I don't have much experience with perl but am willing to learn. Gus From ae at op5.se Wed Sep 12 01:09:12 2007 From: ae at op5.se (Andreas Ericsson) Date: Wed, 12 Sep 2007 01:09:12 +0200 Subject: [Nagiosplug-devel] Introduction In-Reply-To: References: Message-ID: <46E72018.5020009@op5.se> Gustave Walzer wrote: > Hi I am a college student who is taking a Unix scripting class. I am > interested in this project and wish to help. I don't have much > experience with perl but am willing to learn. > Sure shoot. Just hack away ;-) There's a bugtracker on this project's sourceforge page. I have absolutely no idea if there are any bugs for any of the perl-scripts of the plugins package at the present time, but if there are, it's a good place to start. I'm afraid most of the plugins are written in C though. Another useful task you can put yourself to is to make sure all the perl-based plugins at nagiosexchange.com works with the embedded perl interpreter introduced in Nagios 2. It's an ungrateful task though, as you'll have to track down individual developers and submit your patches to them, or perhaps just send all the modified scripts back to nagiosexchange as a gzipped tarball in the form of a new contribution (holston-perl-plugs or some such). -- Andreas Ericsson andreas.ericsson at op5.se OP5 AB www.op5.se Tel: +46 8-230225 Fax: +46 8-230231 From ton.voon at altinity.com Thu Sep 13 13:50:08 2007 From: ton.voon at altinity.com (Ton Voon) Date: Thu, 13 Sep 2007 12:50:08 +0100 Subject: [Nagiosplug-devel] Nagios::Plugin perl module integrated into SVN Message-ID: <4ABE8CAF-6D2F-416A-AABA-75D99469945C@altinity.com> Hi! I've finally got round to integrating Nagios::Plugin into the core code. Bit of info here: http://nagiosplugins.org/index.php? option=com_openwiki&Itemid=41&id=compilation_of_nagios_plugins It is currently optional, though I would expect to make it default to install in future (though you will still be able to disable). Any feedback? I think a release is probably in order soon, because Holger and Thomas have fixed quite a few problems. Ton http://www.altinity.com T: +44 (0)870 787 9243 F: +44 (0)845 280 1725 Skype: tonvoon From alex at zengers.de Thu Sep 13 19:52:16 2007 From: alex at zengers.de (Alex) Date: Thu, 13 Sep 2007 19:52:16 +0200 Subject: [Nagiosplug-devel] proxy_auth patch for check_http Message-ID: <20070913175216.GE30381@zengers.de> Hello, i've written a little patch (see attacted), which adds proxy_auth support for the check_http command. The patch is basicly copied from the http_auth code, just changed variable names and the header which is sent. greetz alex -- We're sysadmins. To us, data is a protocol-overhead. -------------- next part -------------- --- check_http.c 2006-10-03 04:04:10.000000000 +0200 +++ check_http_v2.c 2007-09-05 21:38:02.000000000 +0200 @@ -1,210 +1,102 @@ -/**************************************************************************** - * - * Program: HTTP plugin for Nagios - * License: GPL - * - * License Information: - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: check_http.c,v 1.23 2003/02/18 21:56:24 tonvoon Exp $ - * - *****************************************************************************/ +/****************************************************************************** +* +* Nagios check_http plugin +* +* License: GPL +* Copyright (c) 1999-2006 nagios-plugins team +* +* Last Modified: $Date: 2007/03/06 22:45:57 $ +* +* Description: +* +* This file contains the check_http plugin +* +* This plugin tests the HTTP service on the specified host. It can test +* normal (http) and secure (https) servers, follow redirects, search for +* strings and regular expressions, check connection times, and report on +* certificate expiration times. +* +* +* License Information: +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + $Id: check_http.c,v 1.101 2007/03/06 22:45:57 tonvoon Exp $ + +******************************************************************************/ +/* splint -I. -I../../plugins -I../../lib/ -I/usr/kerberos/include/ ../../plugins/check_http.c */ const char *progname = "check_http"; -#define REVISION "$Revision: 1.23 $" -#define COPYRIGHT "1999-2001" -#define AUTHORS "Ethan Galstad/Karl DeBisschop" -#define EMAIL "kdebisschop at users.sourceforge.net" - -#include "config.h" -#include "common.h" -#include "netutils.h" -#include "utils.h" - -#define SUMMARY "\ -This plugin tests the HTTP service on the specified host. It can test\n\ -normal (http) and secure (https) servers, follow redirects, search for\n\ -strings and regular expressions, check connection times, and report on\n\ -certificate expiration times.\n" - -#define OPTIONS "\ -(-H | -I ) [-u ] [-p ]\n\ - [-w ] [-c ] [-t ] [-L]\n\ - [-a auth] [-f ] [-e ]\n\ - [-s string] [-l] [-r | -R ]\n\ - [-P string]" - -#define LONGOPTIONS "\ - -H, --hostname=ADDRESS\n\ - Host name argument for servers using host headers (virtual host)\n\ - -I, --IP-address=ADDRESS\n\ - IP address or name (use numeric address if possible to bypass DNS lookup).\n\ - -e, --expect=STRING\n\ - String to expect in first (status) line of server response (default: %s)\n\ - If specified skips all other status line logic (ex: 3xx, 4xx, 5xx processing)\n\ - -s, --string=STRING\n\ - String to expect in the content\n\ - -u, --url=PATH\n\ - URL to GET or POST (default: /)\n\ - -p, --port=INTEGER\n\ - Port number (default: %d)\n\ - -P, --post=STRING\n\ - URL encoded http POST data\n\ - -w, --warning=INTEGER\n\ - Response time to result in warning status (seconds)\n\ - -c, --critical=INTEGER\n\ - Response time to result in critical status (seconds)\n\ - -t, --timeout=INTEGER\n\ - Seconds before connection times out (default: %d)\n\ - -a, --authorization=AUTH_PAIR\n\ - Username:password on sites with basic authentication\n\ - -L, --link=URL\n\ - Wrap output in HTML link (obsoleted by urlize)\n\ - -f, --onredirect=\n\ - How to handle redirected pages\n%s%s\ - -v, --verbose\n\ - Show details for command-line debugging (do not use with nagios server)\n\ - -h, --help\n\ - Print detailed help screen\n\ - -V, --version\n\ - Print version information\n" +const char *revision = "$Revision: 1.102 $"; +const char *copyright = "1999-2006"; +const char *email = "nagiosplug-devel at lists.sourceforge.net"; + +#include "../plugins/common.h" +#include "../plugins/netutils.h" +#include "../plugins/utils.h" -#ifdef HAVE_SSL -#define SSLOPTIONS "\ - -S, --ssl\n\ - Connect via SSL\n\ - -C, --certificate=INTEGER\n\ - Minimum number of days a certificate has to be valid.\n\ - (when this option is used the url is not checked.)\n" -#else -#define SSLOPTIONS "" -#endif - -#ifdef HAVE_REGEX_H -#define REGOPTIONS "\ - -l, --linespan\n\ - Allow regex to span newlines (must precede -r or -R)\n\ - -r, --regex, --ereg=STRING\n\ - Search page for regex STRING\n\ - -R, --eregi=STRING\n\ - Search page for case-insensitive regex STRING\n" -#else -#define REGOPTIONS "" -#endif - -#define DESCRIPTION "\ -This plugin will attempt to open an HTTP connection with the host. Successul\n\ -connects return STATE_OK, refusals and timeouts return STATE_CRITICAL, other\n\ -errors return STATE_UNKNOWN. Successful connects, but incorrect reponse\n\ -messages from the host result in STATE_WARNING return values. If you are\n\ -checking a virtual server that uses \"host headers\" you must supply the FQDN\n\ -\(fully qualified domain name) as the [host_name] argument.\n" - -#define SSLDESCRIPTION "\ -This plugin can also check whether an SSL enabled web server is able to\n\ -serve content (optionally within a specified time) or whether the X509 \n\ -certificate is still valid for the specified number of days.\n\n\ -CHECK CONTENT: check_http -w 5 -c 10 --ssl www.verisign.com\n\n\ -When the 'www.verisign.com' server returns its content within 5 seconds, a\n\ -STATE_OK will be returned. When the server returns its content but exceeds\n\ -the 5-second threshold, a STATE_WARNING will be returned. When an error occurs,\n\ -a STATE_CRITICAL will be returned.\n\n\ -CHECK CERTIFICATE: check_http www.verisign.com -C 14\n\n\ -When the certificate of 'www.verisign.com' is valid for more than 14 days, a\n\ -STATE_OK is returned. When the certificate is still valid, but for less than\n\ -14 days, a STATE_WARNING is returned. A STATE_CRITICAL will be returned when\n\ -the certificate is expired.\n" - -#ifdef HAVE_SSL_H -#include -#include -#include -#include -#include -#include -#include -#endif +#define INPUT_DELIMITER ";" -#ifdef HAVE_OPENSSL_SSL_H -#include -#include -#include -#include -#include -#include -#include -#endif +#define HTTP_EXPECT "HTTP/1." +enum { + MAX_IPV4_HOSTLENGTH = 255, + HTTP_PORT = 80, + HTTPS_PORT = 443 +}; #ifdef HAVE_SSL int check_cert = FALSE; int days_till_exp; -char *randbuff = ""; -SSL_CTX *ctx; -SSL *ssl; +char *randbuff; X509 *server_cert; -int connect_SSL (void); -int check_certificate (X509 **); -#endif +# define my_recv(buf, len) ((use_ssl) ? np_net_ssl_read(buf, len) : read(sd, buf, len)) +# define my_send(buf, len) ((use_ssl) ? np_net_ssl_write(buf, len) : send(sd, buf, len, 0)) +#else /* ifndef HAVE_SSL */ +# define my_recv(buf, len) read(sd, buf, len) +# define my_send(buf, len) send(sd, buf, len, 0) +#endif /* HAVE_SSL */ +int no_body = FALSE; +int maximum_age = -1; -#ifdef HAVE_REGEX_H enum { - REGS = 2, - MAX_RE_SIZE = 256 + REGS = 2, + MAX_RE_SIZE = 256 }; -#include +#include "regex.h" regex_t preg; regmatch_t pmatch[REGS]; char regexp[MAX_RE_SIZE]; char errbuf[MAX_INPUT_BUFFER]; int cflags = REG_NOSUB | REG_EXTENDED | REG_NEWLINE; int errcode; -#endif +int invert_regex = 0; struct timeval tv; -#define server_type_check(server_type) \ -(strcmp (server_type, "https") ? FALSE : TRUE) - -#define server_port_check(use_ssl) (use_ssl ? HTTPS_PORT : HTTP_PORT) - -#define HDR_LOCATION "%*[Ll]%*[Oo]%*[Cc]%*[Aa]%*[Tt]%*[Ii]%*[Oo]%*[Nn]: " -#define URI_HTTP "%[HTPShtps]://" -#define URI_HOST "%[a-zA-Z0-9.-]" -#define URI_PORT ":%[0-9]" -#define URI_PATH "%[/a-zA-Z0-9._-=@,]" - -enum { - MAX_IPV4_HOSTLENGTH = 64, - HTTP_PORT = 80, - HTTPS_PORT = 443 -}; - -#define HTTP_EXPECT "HTTP/1." #define HTTP_URL "/" #define CRLF "\r\n" -char timestamp[17] = ""; int specify_port = FALSE; int server_port = HTTP_PORT; char server_port_text[6] = ""; char server_type[6] = "http"; -char *server_address = ""; -char *host_name = ""; -char *server_url = HTTP_URL; -int server_url_length = 1; +char *server_address; +char *host_name; +char *server_url; +char *user_agent; +int server_url_length; int server_expect_yn = 0; char server_expect[MAX_INPUT_BUFFER] = HTTP_EXPECT; char string_expect[MAX_INPUT_BUFFER] = ""; @@ -213,848 +105,1266 @@ double critical_time = 0; int check_critical_time = FALSE; char user_auth[MAX_INPUT_BUFFER] = ""; +// proxy_auth +char proxy_auth[MAX_INPUT_BUFFER] = ""; int display_html = FALSE; +char **http_opt_headers; +int http_opt_headers_count = 0; int onredirect = STATE_OK; int use_ssl = FALSE; int verbose = FALSE; int sd; -char *http_method = "GET"; -char *http_post_data = ""; +int min_page_len = 0; +int max_page_len = 0; +int redir_depth = 0; +int max_depth = 15; +char *http_method; +char *http_post_data; +char *http_content_type; char buffer[MAX_INPUT_BUFFER]; -void print_usage (void); -void print_help (void); int process_arguments (int, char **); -static char *base64 (char *bin, int len); +static char *base64 (const char *bin, size_t len); int check_http (void); -int my_recv (void); -int my_close (void); +void redir (char *pos, char *status_line); +int server_type_check(const char *type); +int server_port_check(int ssl_flag); +char *perfd_time (double microsec); +char *perfd_size (int page_len); +void print_help (void); +void print_usage (void); int main (int argc, char **argv) { - int result = STATE_UNKNOWN; - - if (process_arguments (argc, argv) == ERROR) - usage ("check_http: could not parse arguments\n"); + int result = STATE_UNKNOWN; - if (strstr (timestamp, ":")) { - if (strstr (server_url, "?")) - asprintf (&server_url, "%s&%s", server_url, timestamp); - else - asprintf (&server_url, "%s?%s", server_url, timestamp); - } - - if (display_html == TRUE) - printf ("", - host_name, server_port, server_url); - - /* initialize alarm signal handling, set socket timeout, start timer */ - (void) signal (SIGALRM, socket_timeout_alarm_handler); - (void) alarm (socket_timeout); - gettimeofday (&tv, NULL); + /* Set default URL. Must be malloced for subsequent realloc if --onredirect=follow */ + server_url = strdup(HTTP_URL); + server_url_length = strlen(server_url); + asprintf (&user_agent, "User-Agent: check_http/%s (nagios-plugins %s)", + clean_revstring (revision), VERSION); + + if (process_arguments (argc, argv) == ERROR) + usage4 (_("Could not parse arguments")); + + if (display_html == TRUE) + printf ("", + use_ssl ? "https" : "http", host_name, + server_port, server_url); + + /* initialize alarm signal handling, set socket timeout, start timer */ + (void) signal (SIGALRM, socket_timeout_alarm_handler); + (void) alarm (socket_timeout); + gettimeofday (&tv, NULL); -#ifdef HAVE_SSL - if (use_ssl && check_cert == TRUE) { - if (connect_SSL () != OK) - terminate (STATE_CRITICAL, - "HTTP CRITICAL - Could not make SSL connection\n"); - if ((server_cert = SSL_get_peer_certificate (ssl)) != NULL) { - result = check_certificate (&server_cert); - X509_free (server_cert); - } - else { - printf ("ERROR: Cannot retrieve server certificate.\n"); - result = STATE_CRITICAL; - } - SSL_shutdown (ssl); - SSL_free (ssl); - SSL_CTX_free (ctx); - close (sd); - } - else { - result = check_http (); - } -#else - result = check_http (); -#endif - return result; + result = check_http (); + return result; } - + /* process command-line arguments */ int process_arguments (int argc, char **argv) { - int c = 1; - -#ifdef HAVE_GETOPT_H - int option_index = 0; - static struct option long_options[] = { - STD_LONG_OPTS, - {"file",required_argument,0,'F'}, - {"link", no_argument, 0, 'L'}, - {"nohtml", no_argument, 0, 'n'}, - {"ssl", no_argument, 0, 'S'}, - {"verbose", no_argument, 0, 'v'}, - {"post", required_argument, 0, 'P'}, - {"IP-address", required_argument, 0, 'I'}, - {"string", required_argument, 0, 's'}, - {"regex", required_argument, 0, 'r'}, - {"ereg", required_argument, 0, 'r'}, - {"eregi", required_argument, 0, 'R'}, - {"linespan", no_argument, 0, 'l'}, - {"onredirect", required_argument, 0, 'f'}, - {"certificate", required_argument, 0, 'C'}, - {0, 0, 0, 0} - }; -#endif - - if (argc < 2) - return ERROR; + int c = 1; - for (c = 1; c < argc; c++) { - if (strcmp ("-to", argv[c]) == 0) - strcpy (argv[c], "-t"); - if (strcmp ("-hn", argv[c]) == 0) - strcpy (argv[c], "-H"); - if (strcmp ("-wt", argv[c]) == 0) - strcpy (argv[c], "-w"); - if (strcmp ("-ct", argv[c]) == 0) - strcpy (argv[c], "-c"); - if (strcmp ("-nohtml", argv[c]) == 0) - strcpy (argv[c], "-n"); - } - -#define OPTCHARS "Vvht:c:w:H:P:I:a:e:p:s:R:r:u:f:C:nlLS" - - while (1) { -#ifdef HAVE_GETOPT_H - c = getopt_long (argc, argv, OPTCHARS, long_options, &option_index); -#else - c = getopt (argc, argv, OPTCHARS); + enum { + INVERT_REGEX = CHAR_MAX + 1 + }; + + int option = 0; + static struct option longopts[] = { + STD_LONG_OPTS, + {"link", no_argument, 0, 'L'}, + {"nohtml", no_argument, 0, 'n'}, + {"ssl", no_argument, 0, 'S'}, + {"post", required_argument, 0, 'P'}, + {"IP-address", required_argument, 0, 'I'}, + {"url", required_argument, 0, 'u'}, + {"port", required_argument, 0, 'p'}, + {"authorization", required_argument, 0, 'a'}, + {"proxy-authorization", required_argument, 0, 'y'}, + {"string", required_argument, 0, 's'}, + {"expect", required_argument, 0, 'e'}, + {"regex", required_argument, 0, 'r'}, + {"ereg", required_argument, 0, 'r'}, + {"eregi", required_argument, 0, 'R'}, + {"linespan", no_argument, 0, 'l'}, + {"onredirect", required_argument, 0, 'f'}, + {"certificate", required_argument, 0, 'C'}, + {"useragent", required_argument, 0, 'A'}, + {"header", required_argument, 0, 'k'}, + {"no-body", no_argument, 0, 'N'}, + {"max-age", required_argument, 0, 'M'}, + {"content-type", required_argument, 0, 'T'}, + {"pagesize", required_argument, 0, 'm'}, + {"invert-regex", no_argument, NULL, INVERT_REGEX}, + {"use-ipv4", no_argument, 0, '4'}, + {"use-ipv6", no_argument, 0, '6'}, + {0, 0, 0, 0} + }; + + if (argc < 2) + return ERROR; + + for (c = 1; c < argc; c++) { + if (strcmp ("-to", argv[c]) == 0) + strcpy (argv[c], "-t"); + if (strcmp ("-hn", argv[c]) == 0) + strcpy (argv[c], "-H"); + if (strcmp ("-wt", argv[c]) == 0) + strcpy (argv[c], "-w"); + if (strcmp ("-ct", argv[c]) == 0) + strcpy (argv[c], "-c"); + if (strcmp ("-nohtml", argv[c]) == 0) + strcpy (argv[c], "-n"); + } + + while (1) { + c = getopt_long (argc, argv, "Vvh46t:c:w:A:k:H:P:T:I:a:y:e:p:s:R:r:u:f:C:nlLSm:M:N", longopts, &option); + if (c == -1 || c == EOF) + break; + + switch (c) { + case '?': /* usage */ + usage5 (); + break; + case 'h': /* help */ + print_help (); + exit (STATE_OK); + break; + case 'V': /* version */ + print_revision (progname, revision); + exit (STATE_OK); + break; + case 't': /* timeout period */ + if (!is_intnonneg (optarg)) + usage2 (_("Timeout interval must be a positive integer"), optarg); + else + socket_timeout = atoi (optarg); + break; + case 'c': /* critical time threshold */ + if (!is_nonnegative (optarg)) + usage2 (_("Critical threshold must be integer"), optarg); + else { + critical_time = strtod (optarg, NULL); + check_critical_time = TRUE; + } + break; + case 'w': /* warning time threshold */ + if (!is_nonnegative (optarg)) + usage2 (_("Warning threshold must be integer"), optarg); + else { + warning_time = strtod (optarg, NULL); + check_warning_time = TRUE; + } + break; + case 'A': /* User Agent String */ + asprintf (&user_agent, "User-Agent: %s", optarg); + break; + case 'k': /* Additional headers */ + if (http_opt_headers_count == 0) + http_opt_headers = malloc (sizeof (char *) * (++http_opt_headers_count)); + else + http_opt_headers = realloc (http_opt_headers, sizeof (char *) * (++http_opt_headers_count)); + http_opt_headers[http_opt_headers_count - 1] = optarg; + /* asprintf (&http_opt_headers, "%s", optarg); */ + break; + case 'L': /* show html link */ + display_html = TRUE; + break; + case 'n': /* do not show html link */ + display_html = FALSE; + break; + case 'C': /* Check SSL cert validity */ +#ifdef HAVE_SSL + if (!is_intnonneg (optarg)) + usage2 (_("Invalid certificate expiration period"), optarg); + else { + days_till_exp = atoi (optarg); + check_cert = TRUE; + } + /* Fall through to -S option */ #endif - if (c == -1 || c == EOF) - break; - - switch (c) { - case '?': /* usage */ - usage2 ("unknown argument", optarg); - break; - case 'h': /* help */ - print_help (); - exit (STATE_OK); - break; - case 'V': /* version */ - print_revision (progname, REVISION); - exit (STATE_OK); - break; - case 't': /* timeout period */ - if (!is_intnonneg (optarg)) - usage2 ("timeout interval must be a non-negative integer", optarg); - socket_timeout = atoi (optarg); - break; - case 'c': /* critical time threshold */ - if (!is_intnonneg (optarg)) - usage2 ("invalid critical threshold", optarg); - critical_time = strtod (optarg, NULL); - check_critical_time = TRUE; - break; - case 'w': /* warning time threshold */ - if (!is_intnonneg (optarg)) - usage2 ("invalid warning threshold", optarg); - warning_time = strtod (optarg, NULL); - check_warning_time = TRUE; - break; - case 'L': /* show html link */ - display_html = TRUE; - break; - case 'n': /* do not show html link */ - display_html = FALSE; - break; - case 'S': /* use SSL */ + case 'S': /* use SSL */ #ifndef HAVE_SSL - usage ("check_http: invalid option - SSL is not available\n"); -#endif - use_ssl = TRUE; - if (specify_port == FALSE) - server_port = HTTPS_PORT; - break; - case 'C': /* Check SSL cert validity */ -#ifdef HAVE_SSL - if (!is_intnonneg (optarg)) - usage2 ("invalid certificate expiration period", optarg); - days_till_exp = atoi (optarg); - check_cert = TRUE; -#else - usage ("check_http: invalid option - SSL is not available\n"); + usage4 (_("Invalid option - SSL is not available")); #endif - break; - case 'f': /* onredirect */ - if (!strcmp (optarg, "follow")) - onredirect = STATE_DEPENDENT; - if (!strcmp (optarg, "unknown")) - onredirect = STATE_UNKNOWN; - if (!strcmp (optarg, "ok")) - onredirect = STATE_OK; - if (!strcmp (optarg, "warning")) - onredirect = STATE_WARNING; - if (!strcmp (optarg, "critical")) - onredirect = STATE_CRITICAL; - if (verbose) - printf("option f:%d \n", onredirect); - break; - /* Note: H, I, and u must be malloc'd or will fail on redirects */ - case 'H': /* Host Name (virtual host) */ - asprintf (&host_name, "%s", optarg); - break; - case 'I': /* Server IP-address */ - asprintf (&server_address, "%s", optarg); - break; - case 'u': /* Host or server */ - asprintf (&server_url, "%s", optarg); - server_url_length = strlen (server_url); - break; - case 'p': /* Host or server */ - if (!is_intnonneg (optarg)) - usage2 ("invalid port number", optarg); - server_port = atoi (optarg); - specify_port = TRUE; - break; - case 'a': /* authorization info */ - strncpy (user_auth, optarg, MAX_INPUT_BUFFER - 1); - user_auth[MAX_INPUT_BUFFER - 1] = 0; - break; - case 'P': /* HTTP POST data in URL encoded format */ - asprintf (&http_method, "%s", "POST"); - asprintf (&http_post_data, "%s", optarg); - break; - case 's': /* string or substring */ - strncpy (string_expect, optarg, MAX_INPUT_BUFFER - 1); - string_expect[MAX_INPUT_BUFFER - 1] = 0; - break; - case 'e': /* string or substring */ - strncpy (server_expect, optarg, MAX_INPUT_BUFFER - 1); - server_expect[MAX_INPUT_BUFFER - 1] = 0; - server_expect_yn = 1; - break; -#ifndef HAVE_REGEX_H - case 'l': /* linespan */ - case 'r': /* linespan */ - case 'R': /* linespan */ - usage ("check_http: call for regex which was not a compiled option\n"); - break; + use_ssl = TRUE; + if (specify_port == FALSE) + server_port = HTTPS_PORT; + break; + case 'f': /* onredirect */ + if (!strcmp (optarg, "follow")) + onredirect = STATE_DEPENDENT; + if (!strcmp (optarg, "unknown")) + onredirect = STATE_UNKNOWN; + if (!strcmp (optarg, "ok")) + onredirect = STATE_OK; + if (!strcmp (optarg, "warning")) + onredirect = STATE_WARNING; + if (!strcmp (optarg, "critical")) + onredirect = STATE_CRITICAL; + if (verbose) + printf(_("option f:%d \n"), onredirect); + break; + /* Note: H, I, and u must be malloc'd or will fail on redirects */ + case 'H': /* Host Name (virtual host) */ + host_name = strdup (optarg); + if (strstr (optarg, ":")) + sscanf (optarg, "%*[^:]:%d", &server_port); + break; + case 'I': /* Server IP-address */ + server_address = strdup (optarg); + break; + case 'u': /* URL path */ + server_url = strdup (optarg); + server_url_length = strlen (server_url); + break; + case 'p': /* Server port */ + if (!is_intnonneg (optarg)) + usage2 (_("Invalid port number"), optarg); + else { + server_port = atoi (optarg); + specify_port = TRUE; + } + break; + case 'a': /* authorization info */ + strncpy (user_auth, optarg, MAX_INPUT_BUFFER - 1); + user_auth[MAX_INPUT_BUFFER - 1] = 0; + break; + case 'y': /* proxy-authorization info */ + strncpy (proxy_auth, optarg, MAX_INPUT_BUFFER -1); + proxy_auth[MAX_INPUT_BUFFER -1] = 0; + break; + case 'P': /* HTTP POST data in URL encoded format */ + if (http_method || http_post_data) break; + http_method = strdup("POST"); + http_post_data = strdup (optarg); + break; + case 's': /* string or substring */ + strncpy (string_expect, optarg, MAX_INPUT_BUFFER - 1); + string_expect[MAX_INPUT_BUFFER - 1] = 0; + break; + case 'e': /* string or substring */ + strncpy (server_expect, optarg, MAX_INPUT_BUFFER - 1); + server_expect[MAX_INPUT_BUFFER - 1] = 0; + server_expect_yn = 1; + break; + case 'T': /* Content-type */ + asprintf (&http_content_type, "%s", optarg); + break; + case 'l': /* linespan */ + cflags &= ~REG_NEWLINE; + break; + case 'R': /* regex */ + cflags |= REG_ICASE; + case 'r': /* regex */ + strncpy (regexp, optarg, MAX_RE_SIZE - 1); + regexp[MAX_RE_SIZE - 1] = 0; + errcode = regcomp (&preg, regexp, cflags); + if (errcode != 0) { + (void) regerror (errcode, &preg, errbuf, MAX_INPUT_BUFFER); + printf (_("Could Not Compile Regular Expression: %s"), errbuf); + return ERROR; + } + break; + case INVERT_REGEX: + invert_regex = 1; + break; + case '4': + address_family = AF_INET; + break; + case '6': +#ifdef USE_IPV6 + address_family = AF_INET6; #else - case 'l': /* linespan */ - cflags &= ~REG_NEWLINE; - break; - case 'R': /* regex */ - cflags |= REG_ICASE; - case 'r': /* regex */ - strncpy (regexp, optarg, MAX_RE_SIZE - 1); - regexp[MAX_RE_SIZE - 1] = 0; - errcode = regcomp (&preg, regexp, cflags); - if (errcode != 0) { - (void) regerror (errcode, &preg, errbuf, MAX_INPUT_BUFFER); - printf ("Could Not Compile Regular Expression: %s", errbuf); - return ERROR; - } - break; + usage4 (_("IPv6 support not available")); #endif - case 'v': /* verbose */ - verbose = TRUE; - break; - } - } - - c = optind; - - if (strcmp (server_address, "") == 0 && c < argc) - asprintf (&server_address, "%s", argv[c++]); - - if (strcmp (host_name, "") == 0 && c < argc) - asprintf (&host_name, "%s", argv[c++]); - - if (strcmp (server_address ,"") == 0) { - if (strcmp (host_name, "") == 0) - usage ("check_http: you must specify a server address or host name\n"); - else - asprintf (&server_address, "%s", host_name); - } + break; + case 'v': /* verbose */ + verbose = TRUE; + break; + case 'm': /* min_page_length */ + { + char *tmp; + if (strchr(optarg, ':') != (char *)NULL) { + /* range, so get two values, min:max */ + tmp = strtok(optarg, ":"); + if (tmp == NULL) { + printf("Bad format: try \"-m min:max\"\n"); + exit (STATE_WARNING); + } else + min_page_len = atoi(tmp); + + tmp = strtok(NULL, ":"); + if (tmp == NULL) { + printf("Bad format: try \"-m min:max\"\n"); + exit (STATE_WARNING); + } else + max_page_len = atoi(tmp); + } else + min_page_len = atoi (optarg); + break; + } + case 'N': /* no-body */ + no_body = TRUE; + break; + case 'M': /* max-age */ + { + int L = strlen(optarg); + if (L && optarg[L-1] == 'm') + maximum_age = atoi (optarg) * 60; + else if (L && optarg[L-1] == 'h') + maximum_age = atoi (optarg) * 60 * 60; + else if (L && optarg[L-1] == 'd') + maximum_age = atoi (optarg) * 60 * 60 * 24; + else if (L && (optarg[L-1] == 's' || + isdigit (optarg[L-1]))) + maximum_age = atoi (optarg); + else { + fprintf (stderr, "unparsable max-age: %s\n", optarg); + exit (STATE_WARNING); + } + } + break; + } + } + + c = optind; + + if (server_address == NULL && c < argc) + server_address = strdup (argv[c++]); + + if (host_name == NULL && c < argc) + host_name = strdup (argv[c++]); + + if (server_address == NULL) { + if (host_name == NULL) + usage4 (_("You must specify a server address or host name")); + else + server_address = strdup (host_name); + } - return TRUE; + if (check_critical_time && critical_time>(double)socket_timeout) + socket_timeout = (int)critical_time + 1; + + if (http_method == NULL) + http_method = strdup ("GET"); + + return TRUE; } - + /* written by lauri alanko */ static char * -base64 (char *bin, int len) +base64 (const char *bin, size_t len) { - char *buf = (char *) malloc ((len + 2) / 3 * 4 + 1); - int i = 0, j = 0; + char *buf = (char *) malloc ((len + 2) / 3 * 4 + 1); + size_t i = 0, j = 0; - char BASE64_END = '='; - char base64_table[64] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + char BASE64_END = '='; + char base64_table[64]; + strncpy (base64_table, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", 64); + + while (j < len - 2) { + buf[i++] = base64_table[bin[j] >> 2]; + buf[i++] = base64_table[((bin[j] & 3) << 4) | (bin[j + 1] >> 4)]; + buf[i++] = base64_table[((bin[j + 1] & 15) << 2) | (bin[j + 2] >> 6)]; + buf[i++] = base64_table[bin[j + 2] & 63]; + j += 3; + } + + switch (len - j) { + case 1: + buf[i++] = base64_table[bin[j] >> 2]; + buf[i++] = base64_table[(bin[j] & 3) << 4]; + buf[i++] = BASE64_END; + buf[i++] = BASE64_END; + break; + case 2: + buf[i++] = base64_table[bin[j] >> 2]; + buf[i++] = base64_table[((bin[j] & 3) << 4) | (bin[j + 1] >> 4)]; + buf[i++] = base64_table[(bin[j + 1] & 15) << 2]; + buf[i++] = BASE64_END; + break; + case 0: + break; + } - while (j < len - 2) { - buf[i++] = base64_table[bin[j] >> 2]; - buf[i++] = base64_table[((bin[j] & 3) << 4) | (bin[j + 1] >> 4)]; - buf[i++] = base64_table[((bin[j + 1] & 15) << 2) | (bin[j + 2] >> 6)]; - buf[i++] = base64_table[bin[j + 2] & 63]; - j += 3; - } - - switch (len - j) { - case 1: - buf[i++] = base64_table[bin[j] >> 2]; - buf[i++] = base64_table[(bin[j] & 3) << 4]; - buf[i++] = BASE64_END; - buf[i++] = BASE64_END; - break; - case 2: - buf[i++] = base64_table[bin[j] >> 2]; - buf[i++] = base64_table[((bin[j] & 3) << 4) | (bin[j + 1] >> 4)]; - buf[i++] = base64_table[(bin[j + 1] & 15) << 2]; - buf[i++] = BASE64_END; - break; - case 0: - break; - } - - buf[i] = '\0'; - return buf; + buf[i] = '\0'; + return buf; } - -int -check_http (void) + +/* Returns 1 if we're done processing the document body; 0 to keep going */ +static int +document_headers_done (char *full_page) { - char *msg = NULL; - char *status_line = ""; - char *header = NULL; - char *page = ""; - char *auth = NULL; - int i = 0; - size_t pagesize = 0; - char *full_page = ""; - char *buf = NULL; - char *pos = ""; - char *x = NULL; - char *orig_url = NULL; - double elapsed_time; -#ifdef HAVE_SSL - int sslerr; -#endif + const char *body; - /* try to connect to the host at the given port number */ -#ifdef HAVE_SSL - if (use_ssl == TRUE) { + for (body = full_page; *body; body++) { + if (!strncmp (body, "\n\n", 2) || !strncmp (body, "\n\r\n", 3)) + break; + } - if (connect_SSL () != OK) { - terminate (STATE_CRITICAL, "Unable to open TCP socket"); - } - - if ((server_cert = SSL_get_peer_certificate (ssl)) != NULL) { - X509_free (server_cert); - } - else { - printf ("ERROR: Cannot retrieve server certificate.\n"); - return STATE_CRITICAL; - } + if (!*body) + return 0; /* haven't read end of headers yet */ - } - else { -#endif - if (my_tcp_connect (server_address, server_port, &sd) != STATE_OK) - terminate (STATE_CRITICAL, "Unable to open TCP socket"); -#ifdef HAVE_SSL - } -#endif + full_page[body - full_page] = 0; + return 1; +} + +static time_t +parse_time_string (const char *string) +{ + struct tm tm; + time_t t; + memset (&tm, 0, sizeof(tm)); + + /* Like this: Tue, 25 Dec 2001 02:59:03 GMT */ + + if (isupper (string[0]) && /* Tue */ + islower (string[1]) && + islower (string[2]) && + ',' == string[3] && + ' ' == string[4] && + (isdigit(string[5]) || string[5] == ' ') && /* 25 */ + isdigit (string[6]) && + ' ' == string[7] && + isupper (string[8]) && /* Dec */ + islower (string[9]) && + islower (string[10]) && + ' ' == string[11] && + isdigit (string[12]) && /* 2001 */ + isdigit (string[13]) && + isdigit (string[14]) && + isdigit (string[15]) && + ' ' == string[16] && + isdigit (string[17]) && /* 02: */ + isdigit (string[18]) && + ':' == string[19] && + isdigit (string[20]) && /* 59: */ + isdigit (string[21]) && + ':' == string[22] && + isdigit (string[23]) && /* 03 */ + isdigit (string[24]) && + ' ' == string[25] && + 'G' == string[26] && /* GMT */ + 'M' == string[27] && /* GMT */ + 'T' == string[28]) { + + tm.tm_sec = 10 * (string[23]-'0') + (string[24]-'0'); + tm.tm_min = 10 * (string[20]-'0') + (string[21]-'0'); + tm.tm_hour = 10 * (string[17]-'0') + (string[18]-'0'); + tm.tm_mday = 10 * (string[5] == ' ' ? 0 : string[5]-'0') + (string[6]-'0'); + tm.tm_mon = (!strncmp (string+8, "Jan", 3) ? 0 : + !strncmp (string+8, "Feb", 3) ? 1 : + !strncmp (string+8, "Mar", 3) ? 2 : + !strncmp (string+8, "Apr", 3) ? 3 : + !strncmp (string+8, "May", 3) ? 4 : + !strncmp (string+8, "Jun", 3) ? 5 : + !strncmp (string+8, "Jul", 3) ? 6 : + !strncmp (string+8, "Aug", 3) ? 7 : + !strncmp (string+8, "Sep", 3) ? 8 : + !strncmp (string+8, "Oct", 3) ? 9 : + !strncmp (string+8, "Nov", 3) ? 10 : + !strncmp (string+8, "Dec", 3) ? 11 : + -1); + tm.tm_year = ((1000 * (string[12]-'0') + + 100 * (string[13]-'0') + + 10 * (string[14]-'0') + + (string[15]-'0')) + - 1900); + + tm.tm_isdst = 0; /* GMT is never in DST, right? */ + + if (tm.tm_mon < 0 || tm.tm_mday < 1 || tm.tm_mday > 31) + return 0; + + /* + This is actually wrong: we need to subtract the local timezone + offset from GMT from this value. But, that's ok in this usage, + because we only comparing these two GMT dates against each other, + so it doesn't matter what time zone we parse them in. + */ + + t = mktime (&tm); + if (t == (time_t) -1) t = 0; + + if (verbose) { + const char *s = string; + while (*s && *s != '\r' && *s != '\n') + fputc (*s++, stdout); + printf (" ==> %lu\n", (unsigned long) t); + } + + return t; + + } else { + return 0; + } +} - asprintf (&buf, "%s %s HTTP/1.0\r\n", http_method, server_url); - /* optionally send the host header info (not clear if it's usable) */ - if (strcmp (host_name, "")) - asprintf (&buf, "%sHost: %s\r\n", buf, host_name); - - /* send user agent */ - asprintf (&buf, "%sUser-Agent: check_http/%s (nagios-plugins %s)\r\n", - buf, clean_revstring (REVISION), PACKAGE_VERSION); - - /* optionally send the authentication info */ - if (strcmp (user_auth, "")) { - auth = base64 (user_auth, strlen (user_auth)); - asprintf (&buf, "%sProxy-Authorization: Basic %s\r\n", buf, auth); - } - - /* either send http POST data */ - if (strlen (http_post_data)) { - asprintf (&buf, "%sContent-Type: application/x-www-form-urlencoded\r\n", buf); - asprintf (&buf, "%sContent-Length: %i\r\n\r\n", buf, strlen (http_post_data)); - asprintf (&buf, "%s%s%s", buf, http_post_data, CRLF); - } - else { - /* or just a newline so the server knows we're done with the request */ - asprintf (&buf, "%s%s", buf, CRLF); - } +static void +check_document_dates (const char *headers) +{ + const char *s; + char *server_date = 0; + char *document_date = 0; + + s = headers; + while (*s) { + const char *field = s; + const char *value = 0; + + /* Find the end of the header field */ + while (*s && !isspace(*s) && *s != ':') + s++; + + /* Remember the header value, if any. */ + if (*s == ':') + value = ++s; + + /* Skip to the end of the header, including continuation lines. */ + while (*s && !(*s == '\n' && (s[1] != ' ' && s[1] != '\t'))) + s++; + s++; + + /* Process this header. */ + if (value && value > field+2) { + char *ff = (char *) malloc (value-field); + char *ss = ff; + while (field < value-1) + *ss++ = tolower(*field++); + *ss++ = 0; + + if (!strcmp (ff, "date") || !strcmp (ff, "last-modified")) { + const char *e; + while (*value && isspace (*value)) + value++; + for (e = value; *e && *e != '\r' && *e != '\n'; e++) + ; + ss = (char *) malloc (e - value + 1); + strncpy (ss, value, e - value); + ss[e - value] = 0; + if (!strcmp (ff, "date")) { + if (server_date) free (server_date); + server_date = ss; + } else { + if (document_date) free (document_date); + document_date = ss; + } + } + free (ff); + } + } + + /* Done parsing the body. Now check the dates we (hopefully) parsed. */ + if (!server_date || !*server_date) { + die (STATE_UNKNOWN, _("Server date unknown\n")); + } else if (!document_date || !*document_date) { + die (STATE_CRITICAL, _("Document modification date unknown\n")); + } else { + time_t srv_data = parse_time_string (server_date); + time_t doc_data = parse_time_string (document_date); + + if (srv_data <= 0) { + die (STATE_CRITICAL, _("CRITICAL - Server date \"%100s\" unparsable"), server_date); + } else if (doc_data <= 0) { + die (STATE_CRITICAL, _("CRITICAL - Document date \"%100s\" unparsable"), document_date); + } else if (doc_data > srv_data + 30) { + die (STATE_CRITICAL, _("CRITICAL - Document is %d seconds in the future\n"), (int)doc_data - (int)srv_data); + } else if (doc_data < srv_data - maximum_age) { + int n = (srv_data - doc_data); + if (n > (60 * 60 * 24 * 2)) + die (STATE_CRITICAL, + _("CRITICAL - Last modified %.1f days ago\n"), + ((float) n) / (60 * 60 * 24)); + else + die (STATE_CRITICAL, + _("CRITICAL - Last modified %d:%02d:%02d ago\n"), + n / (60 * 60), (n / 60) % 60, n % 60); + } + + free (server_date); + free (document_date); + } +} + +int +get_content_length (const char *headers) +{ + const char *s; + int content_length = 0; + + s = headers; + while (*s) { + const char *field = s; + const char *value = 0; + + /* Find the end of the header field */ + while (*s && !isspace(*s) && *s != ':') + s++; + + /* Remember the header value, if any. */ + if (*s == ':') + value = ++s; + + /* Skip to the end of the header, including continuation lines. */ + while (*s && !(*s == '\n' && (s[1] != ' ' && s[1] != '\t'))) + s++; + s++; + + /* Process this header. */ + if (value && value > field+2) { + char *ff = (char *) malloc (value-field); + char *ss = ff; + while (field < value-1) + *ss++ = tolower(*field++); + *ss++ = 0; + + if (!strcmp (ff, "content-length")) { + const char *e; + while (*value && isspace (*value)) + value++; + for (e = value; *e && *e != '\r' && *e != '\n'; e++) + ; + ss = (char *) malloc (e - value + 1); + strncpy (ss, value, e - value); + ss[e - value] = 0; + content_length = atoi(ss); + free (ss); + } + free (ff); + } + } + return (content_length); +} + +int +check_http (void) +{ + char *msg; + char *status_line; + char *status_code; + char *header; + char *page; + char *auth; + // proxy-auth + char *pauth; + int http_status; + int i = 0; + size_t pagesize = 0; + char *full_page; + char *buf; + char *pos; + long microsec; + double elapsed_time; + int page_len = 0; + int result = STATE_UNKNOWN; + + /* try to connect to the host at the given port number */ + if (my_tcp_connect (server_address, server_port, &sd) != STATE_OK) + die (STATE_CRITICAL, _("Unable to open TCP socket\n")); #ifdef HAVE_SSL - if (use_ssl == TRUE) { - if (SSL_write (ssl, buf, strlen (buf)) == -1) { - ERR_print_errors_fp (stderr); - return STATE_CRITICAL; - } - } - else { + if (use_ssl == TRUE) { + np_net_ssl_init(sd); + if (check_cert == TRUE) { + result = np_net_ssl_check_cert(days_till_exp); + np_net_ssl_cleanup(); + if(sd) close(sd); + return result; + } + } +#endif /* HAVE_SSL */ + + asprintf (&buf, "%s %s HTTP/1.0\r\n%s\r\n", http_method, server_url, user_agent); + + /* optionally send the host header info */ + if (host_name) + asprintf (&buf, "%sHost: %s\r\n", buf, host_name); + + /* optionally send any other header tag */ + if (http_opt_headers_count) { + for (i = 0; i < http_opt_headers_count ; i++) { + for ((pos = strtok(http_opt_headers[i], INPUT_DELIMITER)); pos; (pos = strtok(NULL, INPUT_DELIMITER))) + asprintf (&buf, "%s%s\r\n", buf, pos); + } + free(http_opt_headers); + } + + /* optionally send the authentication info */ + if (strlen(user_auth)) { + auth = base64 (user_auth, strlen (user_auth)); + asprintf (&buf, "%sAuthorization: Basic %s\r\n", buf, auth); + } + + /* optionally send the proxy-authentication info */ + if (strlen(proxy_auth)) { + pauth = base64 (proxy_auth, strlen (proxy_auth)); + asprintf (&buf, "%sProxy-Authorization: Basic %s\r\n", buf, pauth); + } + + /* either send http POST data */ + if (http_post_data) { + if (http_content_type) { + asprintf (&buf, "%sContent-Type: %s\r\n", buf, http_content_type); + } else { + asprintf (&buf, "%sContent-Type: application/x-www-form-urlencoded\r\n", buf); + } + + asprintf (&buf, "%sContent-Length: %i\r\n\r\n", buf, (int)strlen (http_post_data)); + asprintf (&buf, "%s%s%s", buf, http_post_data, CRLF); + } + else { + /* or just a newline so the server knows we're done with the request */ + asprintf (&buf, "%s%s", buf, CRLF); + } + + if (verbose) printf ("%s\n", buf); + my_send (buf, strlen (buf)); + + /* fetch the page */ + full_page = strdup(""); + while ((i = my_recv (buffer, MAX_INPUT_BUFFER-1)) > 0) { + buffer[i] = '\0'; + asprintf (&full_page, "%s%s", full_page, buffer); + pagesize += i; + + if (no_body && document_headers_done (full_page)) { + i = 0; + break; + } + } + + if (i < 0 && errno != ECONNRESET) { +#ifdef HAVE_SSL + /* + if (use_ssl) { + sslerr=SSL_get_error(ssl, i); + if ( sslerr == SSL_ERROR_SSL ) { + die (STATE_WARNING, _("Client Certificate Required\n")); + } else { + die (STATE_CRITICAL, _("Error on receive\n")); + } + } + else { + */ #endif - send (sd, buf, strlen (buf), 0); + die (STATE_CRITICAL, _("Error on receive\n")); #ifdef HAVE_SSL - } + /* XXX + } + */ #endif + } - /* fetch the page */ - while ((i = my_recv ()) > 0) { - buffer[i] = '\0'; - asprintf (&full_page, "%s%s", full_page, buffer); - pagesize += i; - } + /* return a CRITICAL status if we couldn't read any data */ + if (pagesize == (size_t) 0) + die (STATE_CRITICAL, _("No data received from host\n")); - if (i < 0) { + /* close the connection */ #ifdef HAVE_SSL - sslerr=SSL_get_error(ssl, i); - if ( sslerr == SSL_ERROR_SSL ) { - terminate (STATE_WARNING, "Client Certificate Required\n"); - } else { - terminate (STATE_CRITICAL, "Error in recv()"); - } -#else - terminate (STATE_CRITICAL, "Error in recv()"); + np_net_ssl_cleanup(); #endif - } + if(sd) close(sd); - /* return a CRITICAL status if we couldn't read any data */ - if (pagesize == (size_t) 0) - terminate (STATE_CRITICAL, "No data received %s", timestamp); - - /* close the connection */ - my_close (); - - /* reset the alarm */ - alarm (0); - - /* leave full_page untouched so we can free it later */ - page = full_page; - - if (verbose) - printf ("Page is %d characters\n", pagesize); - - /* find status line and null-terminate it */ - status_line = page; - page += (size_t) strcspn (page, "\r\n"); - pos = page; - page += (size_t) strspn (page, "\r\n"); - status_line[strcspn(status_line, "\r\n")] = 0; - strip (status_line); - if (verbose) - printf ("STATUS: %s\n", status_line); - - /* find header info and null terminate it */ - header = page; - while (strcspn (page, "\r\n") > 0) { - page += (size_t) strcspn (page, "\r\n"); - pos = page; - if ((strspn (page, "\r") == 1 && strspn (page, "\r\n") >= 2) || - (strspn (page, "\n") == 1 && strspn (page, "\r\n") >= 2)) - page += (size_t) 2; - else - page += (size_t) 1; - } - page += (size_t) strspn (page, "\r\n"); - header[pos - header] = 0; - if (verbose) - printf ("**** HEADER ****\n%s\n**** CONTENT ****\n%s\n", header, page); - - /* make sure the status line matches the response we are looking for */ - if (!strstr (status_line, server_expect)) { - if (server_port == HTTP_PORT) - asprintf (&msg, "Invalid HTTP response received from host\n"); - else - asprintf (&msg, - "Invalid HTTP response received from host on port %d\n", - server_port); - terminate (STATE_CRITICAL, msg); - } - - - /* Exit here if server_expect was set by user and not default */ - if ( server_expect_yn ) { - asprintf (&msg, "HTTP OK: Status line output matched \"%s\"\n", - server_expect); - if (verbose) - printf ("%s\n",msg); - - } - else { - - - /* check the return code */ - /* server errors result in a critical state */ - if (strstr (status_line, "500") || - strstr (status_line, "501") || - strstr (status_line, "502") || - strstr (status_line, "503")) { - terminate (STATE_CRITICAL, "HTTP CRITICAL: %s\n", status_line); - } - - /* client errors result in a warning state */ - if (strstr (status_line, "400") || - strstr (status_line, "401") || - strstr (status_line, "402") || - strstr (status_line, "403") || - strstr (status_line, "404")) { - terminate (STATE_WARNING, "HTTP WARNING: %s\n", status_line); - } - - /* check redirected page if specified */ - if (strstr (status_line, "300") || - strstr (status_line, "301") || - strstr (status_line, "302") || - strstr (status_line, "303") || - strstr (status_line, "304")) { - if (onredirect == STATE_DEPENDENT) { - - asprintf (&orig_url, "%s", server_url); - pos = header; - while (pos) { - server_address = realloc (server_address, MAX_IPV4_HOSTLENGTH); - if (server_address == NULL) - terminate (STATE_UNKNOWN, - "HTTP UNKNOWN: could not allocate server_address"); - if (strcspn (pos, "\r\n") > server_url_length) { - server_url = realloc (server_url, strcspn (pos, "\r\n")); - if (server_url == NULL) - terminate (STATE_UNKNOWN, - "HTTP UNKNOWN: could not allocate server_url"); - server_url_length = strcspn (pos, "\r\n"); - } - if (sscanf (pos, HDR_LOCATION URI_HTTP URI_HOST URI_PORT URI_PATH, server_type, server_address, server_port_text, server_url) == 4) { - asprintf (&host_name, "%s", server_address); - use_ssl = server_type_check (server_type); - server_port = atoi (server_port_text); - check_http (); - } - else if (sscanf (pos, HDR_LOCATION URI_HTTP URI_HOST URI_PATH, server_type, server_address, server_url) == 3 ) { - asprintf (&host_name, "%s", server_address); - use_ssl = server_type_check (server_type); - server_port = server_port_check (use_ssl); - check_http (); - } - else if (sscanf (pos, HDR_LOCATION URI_HTTP URI_HOST URI_PORT, server_type, server_address, server_port_text) == 3) { - asprintf (&host_name, "%s", server_address); - strcpy (server_url, "/"); - use_ssl = server_type_check (server_type); - server_port = atoi (server_port_text); - check_http (); - } - else if (sscanf (pos, HDR_LOCATION URI_HTTP URI_HOST, server_type, server_address) == 2) { - asprintf (&host_name, "%s", server_address); - strcpy (server_url, "/"); - use_ssl = server_type_check (server_type); - server_port = server_port_check (use_ssl); - check_http (); - } - else if (sscanf (pos, HDR_LOCATION URI_PATH, server_url) == 1) { - if ((server_url[0] != '/') && (x = strrchr(orig_url, '/'))) { - *x = '\0'; - asprintf (&server_url, "%s/%s", orig_url, server_url); - } - check_http (); - } - pos += (size_t) strcspn (pos, "\r\n"); - pos += (size_t) strspn (pos, "\r\n"); - } /* end while (pos) */ - printf ("HTTP UNKNOWN: Could not find redirect location - %s%s", - status_line, (display_html ? "" : "")); - exit (STATE_UNKNOWN); - } /* end if (onredirect == STATE_DEPENDENT) */ - - else if (onredirect == STATE_UNKNOWN) - printf ("HTTP UNKNOWN"); - else if (onredirect == STATE_OK) - printf ("HTTP ok"); - else if (onredirect == STATE_WARNING) - printf ("HTTP WARNING"); - else if (onredirect == STATE_CRITICAL) - printf ("HTTP CRITICAL"); - elapsed_time = delta_time (tv); - asprintf (&msg, ": %s - %7.3f second response time %s%s|time=%7.3f\n", - status_line, elapsed_time, timestamp, - (display_html ? "" : ""), elapsed_time); - terminate (onredirect, msg); - } /* end if (strstr (status_line, "30[0-4]") */ - - - } /* end else (server_expect_yn) */ - - - /* check elapsed time */ - elapsed_time = delta_time (tv); - asprintf (&msg, "HTTP problem: %s - %7.3f second response time %s%s|time=%7.3f\n", - status_line, elapsed_time, timestamp, - (display_html ? "" : ""), elapsed_time); - if (check_critical_time == TRUE && elapsed_time > critical_time) - terminate (STATE_CRITICAL, msg); - if (check_warning_time == TRUE && elapsed_time > warning_time) - terminate (STATE_WARNING, msg); - - /* Page and Header content checks go here */ - /* these checks should be last */ - - if (strlen (string_expect)) { - if (strstr (page, string_expect)) { - printf ("HTTP ok: %s - %7.3f second response time %s%s|time=%7.3f\n", - status_line, elapsed_time, - timestamp, (display_html ? "" : ""), elapsed_time); - exit (STATE_OK); - } - else { - printf ("HTTP CRITICAL: string not found%s|time=%7.3f\n", - (display_html ? "" : ""), elapsed_time); - exit (STATE_CRITICAL); - } - } -#ifdef HAVE_REGEX_H - if (strlen (regexp)) { - errcode = regexec (&preg, page, REGS, pmatch, 0); - if (errcode == 0) { - printf ("HTTP ok: %s - %7.3f second response time %s%s|time=%7.3f\n", - status_line, elapsed_time, - timestamp, (display_html ? "" : ""), elapsed_time); - exit (STATE_OK); - } - else { - if (errcode == REG_NOMATCH) { - printf ("HTTP CRITICAL: pattern not found%s|time=%7.3f\n", - (display_html ? "" : ""), elapsed_time); - exit (STATE_CRITICAL); - } - else { - regerror (errcode, &preg, errbuf, MAX_INPUT_BUFFER); - printf ("Execute Error: %s\n", errbuf); - exit (STATE_CRITICAL); - } - } - } -#endif + /* reset the alarm */ + alarm (0); - /* We only get here if all tests have been passed */ - asprintf (&msg, "HTTP ok: %s - %7.3f second response time %s%s|time=%7.3f\n", - status_line, (float)elapsed_time, - timestamp, (display_html ? "" : ""), elapsed_time); - terminate (STATE_OK, msg); - return STATE_UNKNOWN; + /* leave full_page untouched so we can free it later */ + page = full_page; + + if (verbose) + printf ("%s://%s:%d%s is %d characters\n", + use_ssl ? "https" : "http", server_address, + server_port, server_url, (int)pagesize); + + /* find status line and null-terminate it */ + status_line = page; + page += (size_t) strcspn (page, "\r\n"); + pos = page; + page += (size_t) strspn (page, "\r\n"); + status_line[strcspn(status_line, "\r\n")] = 0; + strip (status_line); + if (verbose) + printf ("STATUS: %s\n", status_line); + + /* find header info and null-terminate it */ + header = page; + while (strcspn (page, "\r\n") > 0) { + page += (size_t) strcspn (page, "\r\n"); + pos = page; + if ((strspn (page, "\r") == 1 && strspn (page, "\r\n") >= 2) || + (strspn (page, "\n") == 1 && strspn (page, "\r\n") >= 2)) + page += (size_t) 2; + else + page += (size_t) 1; + } + page += (size_t) strspn (page, "\r\n"); + header[pos - header] = 0; + if (verbose) + printf ("**** HEADER ****\n%s\n**** CONTENT ****\n%s\n", header, + (no_body ? " [[ skipped ]]" : page)); + + /* make sure the status line matches the response we are looking for */ + if (!strstr (status_line, server_expect)) { + if (server_port == HTTP_PORT) + asprintf (&msg, + _("Invalid HTTP response received from host\n")); + else + asprintf (&msg, + _("Invalid HTTP response received from host on port %d\n"), + server_port); + die (STATE_CRITICAL, "%s", msg); + } + + /* Exit here if server_expect was set by user and not default */ + if ( server_expect_yn ) { + asprintf (&msg, + _("HTTP OK: Status line output matched \"%s\"\n"), + server_expect); + if (verbose) + printf ("%s\n",msg); + } + else { + /* Status-Line = HTTP-Version SP Status-Code SP Reason-Phrase CRLF */ + /* HTTP-Version = "HTTP" "/" 1*DIGIT "." 1*DIGIT */ + /* Status-Code = 3 DIGITS */ + + status_code = strchr (status_line, ' ') + sizeof (char); + if (strspn (status_code, "1234567890") != 3) + die (STATE_CRITICAL, _("HTTP CRITICAL: Invalid Status Line (%s)\n"), status_line); + + http_status = atoi (status_code); + + /* check the return code */ + + if (http_status >= 600 || http_status < 100) + die (STATE_CRITICAL, _("HTTP CRITICAL: Invalid Status (%s)\n"), status_line); + + /* server errors result in a critical state */ + else if (http_status >= 500) + die (STATE_CRITICAL, _("HTTP CRITICAL: %s\n"), status_line); + + /* client errors result in a warning state */ + else if (http_status >= 400) + die (STATE_WARNING, _("HTTP WARNING: %s\n"), status_line); + + /* check redirected page if specified */ + else if (http_status >= 300) { + + if (onredirect == STATE_DEPENDENT) + redir (header, status_line); + else if (onredirect == STATE_UNKNOWN) + printf (_("UNKNOWN")); + else if (onredirect == STATE_OK) + printf (_("OK")); + else if (onredirect == STATE_WARNING) + printf (_("WARNING")); + else if (onredirect == STATE_CRITICAL) + printf (_("CRITICAL")); + microsec = deltime (tv); + elapsed_time = (double)microsec / 1.0e6; + die (onredirect, + _(" - %s - %.3f second response time %s|%s %s\n"), + status_line, elapsed_time, + (display_html ? "" : ""), + perfd_time (elapsed_time), perfd_size (pagesize)); + } /* end if (http_status >= 300) */ + + } /* end else (server_expect_yn) */ + + if (maximum_age >= 0) { + check_document_dates (header); + } + + /* check elapsed time */ + microsec = deltime (tv); + elapsed_time = (double)microsec / 1.0e6; + asprintf (&msg, + _("HTTP WARNING: %s - %.3f second response time %s|%s %s\n"), + status_line, elapsed_time, + (display_html ? "" : ""), + perfd_time (elapsed_time), perfd_size (pagesize)); + if (check_critical_time == TRUE && elapsed_time > critical_time) + die (STATE_CRITICAL, "%s", msg); + if (check_warning_time == TRUE && elapsed_time > warning_time) + die (STATE_WARNING, "%s", msg); + + /* Page and Header content checks go here */ + /* these checks should be last */ + + if (strlen (string_expect)) { + if (strstr (page, string_expect)) { + printf (_("HTTP OK %s - %.3f second response time %s|%s %s\n"), + status_line, elapsed_time, + (display_html ? "" : ""), + perfd_time (elapsed_time), perfd_size (pagesize)); + exit (STATE_OK); + } + else { + printf (_("CRITICAL - string not found%s|%s %s\n"), + (display_html ? "" : ""), + perfd_time (elapsed_time), perfd_size (pagesize)); + exit (STATE_CRITICAL); + } + } + + if (strlen (regexp)) { + errcode = regexec (&preg, page, REGS, pmatch, 0); + if ((errcode == 0 && invert_regex == 0) || (errcode == REG_NOMATCH && invert_regex == 1)) { + printf (_("HTTP OK %s - %.3f second response time %s|%s %s\n"), + status_line, elapsed_time, + (display_html ? "" : ""), + perfd_time (elapsed_time), perfd_size (pagesize)); + exit (STATE_OK); + } + else if ((errcode == REG_NOMATCH && invert_regex == 0) || (errcode == 0 && invert_regex == 1)) { + if (invert_regex == 0) + msg = strdup(_("pattern not found")); + else + msg = strdup(_("pattern found")); + printf (("%s - %s%s|%s %s\n"), + _("CRITICAL"), + msg, + (display_html ? "" : ""), + perfd_time (elapsed_time), perfd_size (pagesize)); + exit (STATE_CRITICAL); + } + else { + regerror (errcode, &preg, errbuf, MAX_INPUT_BUFFER); + printf (_("CRITICAL - Execute Error: %s\n"), errbuf); + exit (STATE_CRITICAL); + } + } + + /* make sure the page is of an appropriate size */ + /* page_len = get_content_length(header); */ + page_len = pagesize; + if ((max_page_len > 0) && (page_len > max_page_len)) { + printf (_("HTTP WARNING: page size %d too large%s|%s\n"), + page_len, (display_html ? "" : ""), perfd_size (page_len) ); + exit (STATE_WARNING); + } else if ((min_page_len > 0) && (page_len < min_page_len)) { + printf (_("HTTP WARNING: page size %d too small%s|%s\n"), + page_len, (display_html ? "" : ""), perfd_size (page_len) ); + exit (STATE_WARNING); + } + /* We only get here if all tests have been passed */ + asprintf (&msg, _("HTTP OK %s - %d bytes in %.3f seconds %s|%s %s\n"), + status_line, page_len, elapsed_time, + (display_html ? "" : ""), + perfd_time (elapsed_time), perfd_size (page_len)); + die (STATE_OK, "%s", msg); + return STATE_UNKNOWN; } -#ifdef HAVE_SSL -int connect_SSL (void) +/* per RFC 2396 */ +#define HDR_LOCATION "%*[Ll]%*[Oo]%*[Cc]%*[Aa]%*[Tt]%*[Ii]%*[Oo]%*[Nn]: " +#define URI_HTTP "%[HTPShtps]://" +#define URI_HOST "%[-.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]" +#define URI_PORT ":%[0123456789]" +#define URI_PATH "%[-_.!~*'();/?:@&=+$,%#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]" +#define HD1 URI_HTTP URI_HOST URI_PORT URI_PATH +#define HD2 URI_HTTP URI_HOST URI_PATH +#define HD3 URI_HTTP URI_HOST URI_PORT +#define HD4 URI_HTTP URI_HOST +#define HD5 URI_PATH + +void +redir (char *pos, char *status_line) { - SSL_METHOD *meth; + int i = 0; + char *x; + char xx[2]; + char type[6]; + char *addr; + char port[6]; + char *url; + + addr = malloc (MAX_IPV4_HOSTLENGTH + 1); + if (addr == NULL) + die (STATE_UNKNOWN, _("Could not allocate addr\n")); + + url = malloc (strcspn (pos, "\r\n")); + if (url == NULL) + die (STATE_UNKNOWN, _("Could not allocate url\n")); + + while (pos) { + sscanf (pos, "%[Ll]%*[Oo]%*[Cc]%*[Aa]%*[Tt]%*[Ii]%*[Oo]%*[Nn]:%n", xx, &i); + if (i == 0) { + pos += (size_t) strcspn (pos, "\r\n"); + pos += (size_t) strspn (pos, "\r\n"); + if (strlen(pos) == 0) + die (STATE_UNKNOWN, + _("UNKNOWN - Could not find redirect location - %s%s\n"), + status_line, (display_html ? "" : "")); + continue; + } + + pos += i; + pos += strspn (pos, " \t\r\n"); + + url = realloc (url, strcspn (pos, "\r\n")); + if (url == NULL) + die (STATE_UNKNOWN, _("could not allocate url\n")); + + /* URI_HTTP, URI_HOST, URI_PORT, URI_PATH */ + if (sscanf (pos, HD1, type, addr, port, url) == 4) { + use_ssl = server_type_check (type); + i = atoi (port); + } + + /* URI_HTTP URI_HOST URI_PATH */ + else if (sscanf (pos, HD2, type, addr, url) == 3 ) { + use_ssl = server_type_check (type); + i = server_port_check (use_ssl); + } + + /* URI_HTTP URI_HOST URI_PORT */ + else if(sscanf (pos, HD3, type, addr, port) == 3) { + strcpy (url, HTTP_URL); + use_ssl = server_type_check (type); + i = atoi (port); + } + + /* URI_HTTP URI_HOST */ + else if(sscanf (pos, HD4, type, addr) == 2) { + strcpy (url, HTTP_URL); + use_ssl = server_type_check (type); + i = server_port_check (use_ssl); + } + + /* URI_PATH */ + else if (sscanf (pos, HD5, url) == 1) { + /* relative url */ + if ((url[0] != '/')) { + if ((x = strrchr(server_url, '/'))) + *x = '\0'; + asprintf (&url, "%s/%s", server_url, url); + } + i = server_port; + strcpy (type, server_type); + strcpy (addr, host_name); + } + + else { + die (STATE_UNKNOWN, + _("UNKNOWN - Could not parse redirect location - %s%s\n"), + pos, (display_html ? "" : "")); + } + + break; + + } /* end while (pos) */ + + if (++redir_depth > max_depth) + die (STATE_WARNING, + _("WARNING - maximum redirection depth %d exceeded - %s://%s:%d%s%s\n"), + max_depth, type, addr, i, url, (display_html ? "" : "")); + + if (server_port==i && + !strcmp(server_address, addr) && + (host_name && !strcmp(host_name, addr)) && + !strcmp(server_url, url)) + die (STATE_WARNING, + _("WARNING - redirection creates an infinite loop - %s://%s:%d%s%s\n"), + type, addr, i, url, (display_html ? "" : "")); + + server_port = i; + strcpy (server_type, type); + + free (host_name); + host_name = strdup (addr); - asprintf (&randbuff, "%s", "qwertyuiopasdfghjklqwertyuiopasdfghjkl"); - RAND_seed (randbuff, strlen (randbuff)); - if (verbose) - printf("SSL seeding: %s\n", (RAND_status()==1 ? "OK" : "Failed") ); - - /* Initialize SSL context */ - SSLeay_add_ssl_algorithms (); - meth = SSLv23_client_method (); - SSL_load_error_strings (); - if ((ctx = SSL_CTX_new (meth)) == NULL) { - printf ("ERROR: Cannot create SSL context.\n"); - return STATE_CRITICAL; - } - - /* Initialize alarm signal handling */ - signal (SIGALRM, socket_timeout_alarm_handler); - - /* Set socket timeout */ - alarm (socket_timeout); - - /* Save start time */ - gettimeofday (&tv, NULL); - - /* Make TCP connection */ - if (my_tcp_connect (server_address, server_port, &sd) == STATE_OK) { - /* Do the SSL handshake */ - if ((ssl = SSL_new (ctx)) != NULL) { - SSL_set_cipher_list(ssl, "ALL"); - SSL_set_fd (ssl, sd); - if (SSL_connect (ssl) != -1) - return OK; - ERR_print_errors_fp (stderr); - } - else { - printf ("ERROR: Cannot initiate SSL handshake.\n"); - } - SSL_free (ssl); - } + free (server_address); + server_address = strdup (addr); - SSL_CTX_free (ctx); - close (sd); + free (server_url); + server_url = strdup (url); - return STATE_CRITICAL; + check_http (); } -#endif -#ifdef HAVE_SSL -int -check_certificate (X509 ** certificate) -{ - ASN1_STRING *tm; - int offset; - struct tm stamp; - int days_left; - - - /* Retrieve timestamp of certificate */ - tm = X509_get_notAfter (*certificate); - - /* Generate tm structure to process timestamp */ - if (tm->type == V_ASN1_UTCTIME) { - if (tm->length < 10) { - printf ("ERROR: Wrong time format in certificate.\n"); - return STATE_CRITICAL; - } - else { - stamp.tm_year = (tm->data[0] - '0') * 10 + (tm->data[1] - '0'); - if (stamp.tm_year < 50) - stamp.tm_year += 100; - offset = 0; - } - } - else { - if (tm->length < 12) { - printf ("ERROR: Wrong time format in certificate.\n"); - return STATE_CRITICAL; - } - else { - stamp.tm_year = - (tm->data[0] - '0') * 1000 + (tm->data[1] - '0') * 100 + - (tm->data[2] - '0') * 10 + (tm->data[3] - '0'); - stamp.tm_year -= 1900; - offset = 2; - } - } - stamp.tm_mon = - (tm->data[2 + offset] - '0') * 10 + (tm->data[3 + offset] - '0') - 1; - stamp.tm_mday = - (tm->data[4 + offset] - '0') * 10 + (tm->data[5 + offset] - '0'); - stamp.tm_hour = - (tm->data[6 + offset] - '0') * 10 + (tm->data[7 + offset] - '0'); - stamp.tm_min = - (tm->data[8 + offset] - '0') * 10 + (tm->data[9 + offset] - '0'); - stamp.tm_sec = 0; - stamp.tm_isdst = -1; - - days_left = (mktime (&stamp) - time (NULL)) / 86400; - snprintf - (timestamp, 16, "%02d/%02d/%04d %02d:%02d", - stamp.tm_mon + 1, - stamp.tm_mday, stamp.tm_year + 1900, stamp.tm_hour, stamp.tm_min); - - if (days_left > 0 && days_left <= days_till_exp) { - printf ("Certificate expires in %d day(s) (%s).\n", days_left, timestamp); - return STATE_WARNING; - } - if (days_left < 0) { - printf ("Certificate expired on %s.\n", timestamp); - return STATE_CRITICAL; - } - - if (days_left == 0) { - printf ("Certificate expires today (%s).\n", timestamp); - return STATE_WARNING; - } - printf ("Certificate will expire on %s.\n", timestamp); - return STATE_OK; +int +server_type_check (const char *type) +{ + if (strcmp (type, "https")) + return FALSE; + else + return TRUE; } -#endif - - int -my_recv (void) +server_port_check (int ssl_flag) { - int i; -#ifdef HAVE_SSL - if (use_ssl) { - i = SSL_read (ssl, buffer, MAX_INPUT_BUFFER - 1); - } - else { - i = recv (sd, buffer, MAX_INPUT_BUFFER - 1, 0); - } -#else - i = recv (sd, buffer, MAX_INPUT_BUFFER - 1, 0); -#endif - return i; + if (ssl_flag) + return HTTPS_PORT; + else + return HTTP_PORT; } - -int -my_close (void) +char *perfd_time (double elapsed_time) { -#ifdef HAVE_SSL - if (use_ssl == TRUE) { - SSL_shutdown (ssl); - SSL_free (ssl); - SSL_CTX_free (ctx); - return 0; - } - else { -#endif - return close (sd); -#ifdef HAVE_SSL - } -#endif + return fperfdata ("time", elapsed_time, "s", + check_warning_time, warning_time, + check_critical_time, critical_time, + TRUE, 0, FALSE, 0); } - + +char *perfd_size (int page_len) +{ + return perfdata ("size", page_len, "B", + (min_page_len>0?TRUE:FALSE), min_page_len, + (min_page_len>0?TRUE:FALSE), 0, + TRUE, 0, FALSE, 0); +} + void print_help (void) { - print_revision (progname, REVISION); - printf - ("Copyright (c) %s %s <%s>\n\n%s\n", - COPYRIGHT, AUTHORS, EMAIL, SUMMARY); - print_usage (); - printf ("NOTE: One or both of -H and -I must be specified\n"); - printf ("\nOptions:\n" LONGOPTIONS "\n", HTTP_EXPECT, HTTP_PORT, - DEFAULT_SOCKET_TIMEOUT, SSLOPTIONS, REGOPTIONS); + print_revision (progname, revision); + + printf ("Copyright (c) 1999 Ethan Galstad \n"); + printf (COPYRIGHT, copyright, email); + + printf ("%s\n", _("This plugin tests the HTTP service on the specified host. It can test")); + printf ("%s\n", _("normal (http) and secure (https) servers, follow redirects, search for")); + printf ("%s\n", _("strings and regular expressions, check connection times, and report on")); + printf ("%s\n", _("certificate expiration times.")); + + printf ("\n\n"); + + print_usage (); + + printf (_("NOTE: One or both of -H and -I must be specified")); + + printf ("\n"); + + printf (_(UT_HELP_VRSN)); + + printf (" %s\n", "-H, --hostname=ADDRESS"); + printf (" %s\n", _("Host name argument for servers using host headers (virtual host)")); + printf (" %s\n", _("Append a port to include it in the header (eg: example.com:5000)")); + printf (" %s\n", "-I, --IP-address=ADDRESS"); + printf (" %s\n", _("IP address or name (use numeric address if possible to bypass DNS lookup).")); + printf (" %s\n", "-p, --port=INTEGER"); + printf (" %s", _("Port number (default: ")); + printf ("%d)\n", HTTP_PORT); + + printf (_(UT_IPv46)); + #ifdef HAVE_SSL - printf (SSLDESCRIPTION); + printf (" %s\n", "-S, --ssl"); + printf (" %s\n", _("Connect via SSL. Port defaults to 443")); + printf (" %s\n", "-C, --certificate=INTEGER"); + printf (" %s\n", _("Minimum number of days a certificate has to be valid. Port defaults to 443")); + printf (" %s\n", _("(when this option is used the url is not checked.)\n")); +#endif + + printf (" %s\n", "-e, --expect=STRING"); + printf (" %s\n", _("String to expect in first (status) line of server response (default: ")); + printf ("%s)\n", HTTP_EXPECT); + printf (" %s\n", _("If specified skips all other status line logic (ex: 3xx, 4xx, 5xx processing)")); + printf (" %s\n", "-s, --string=STRING"); + printf (" %s\n", _("String to expect in the content")); + printf (" %s\n", "-u, --url=PATH"); + printf (" %s\n", _("URL to GET or POST (default: /)")); + printf (" %s\n", "-P, --post=STRING"); + printf (" %s\n", _("URL encoded http POST data")); + printf (" %s\n", "-N, --no-body"); + printf (" %s\n", _("Don't wait for document body: stop reading after headers.")); + printf (" %s\n", _("(Note that this still does an HTTP GET or POST, not a HEAD.)")); + printf (" %s\n", "-M, --max-age=SECONDS"); + printf (" %s\n", _("Warn if document is more than SECONDS old. the number can also be of")); + printf (" %s\n", _("the form \"10m\" for minutes, \"10h\" for hours, or \"10d\" for days.")); + printf (" %s\n", "-T, --content-type=STRING"); + printf (" %s\n", _("specify Content-Type header media type when POSTing\n")); + + printf (" %s\n", "-l, --linespan"); + printf (" %s\n", _("Allow regex to span newlines (must precede -r or -R)")); + printf (" %s\n", "-r, --regex, --ereg=STRING"); + printf (" %s\n", _("Search page for regex STRING")); + printf (" %s\n", "-R, --eregi=STRING"); + printf (" %s\n", _("Search page for case-insensitive regex STRING")); + printf (" %s\n", "--invert-regex"); + printf (" %s\n", _("Return CRITICAL if found, OK if not\n")); + + printf (" %s\n", "-a, --authorization=AUTH_PAIR"); + printf (" %s\n", _("Username:password on sites with basic authentication")); + printf (" %s\n", "-y, --proxy-authorization=AUTH_PAIR"); + printf (" %s\n", _("Username:password on proxys with basic authentication")); + printf (" %s\n", "-A, --useragent=STRING"); + printf (" %s\n", _("String to be sent in http header as \"User Agent\"")); + printf (" %s\n", "-k, --header=STRING"); + printf (" %s\n", _(" Any other tags to be sent in http header. Use multiple times for additional headers")); + printf (" %s\n", "-L, --link"); + printf (" %s\n", _("Wrap output in HTML link (obsoleted by urlize)")); + printf (" %s\n", "-f, --onredirect="); + printf (" %s\n", _("How to handle redirected pages")); + printf (" %s\n", "-m, --pagesize=INTEGER<:INTEGER>"); + printf (" %s\n", _("Minimum page size required (bytes) : Maximum page size required (bytes)")); + + printf (_(UT_WARN_CRIT)); + + printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT); + + printf (_(UT_VERBOSE)); + + printf (_("Notes:")); + printf (" %s\n", _("This plugin will attempt to open an HTTP connection with the host.")); + printf (" %s\n", _("Successful connects return STATE_OK, refusals and timeouts return STATE_CRITICAL")); + printf (" %s\n", _("other errors return STATE_UNKNOWN. Successful connects, but incorrect reponse")); + printf (" %s\n", _("messages from the host result in STATE_WARNING return values. If you are")); + printf (" %s\n", _("checking a virtual server that uses 'host headers' you must supply the FQDN")); + printf (" %s\n", _("(fully qualified domain name) as the [host_name] argument.")); + +#ifdef HAVE_SSL + printf (" %s\n", _("This plugin can also check whether an SSL enabled web server is able to")); + printf (" %s\n", _("serve content (optionally within a specified time) or whether the X509 ")); + printf (" %s\n", _("certificate is still valid for the specified number of days.")); + printf (_("Examples:")); + printf (" %s\n\n", "CHECK CONTENT: check_http -w 5 -c 10 --ssl -H www.verisign.com"); + printf (" %s\n", _("When the 'www.verisign.com' server returns its content within 5 seconds,")); + printf (" %s\n", _("a STATE_OK will be returned. When the server returns its content but exceeds")); + printf (" %s\n", _("the 5-second threshold, a STATE_WARNING will be returned. When an error occurs,")); + printf (" %s\n\n", _("a STATE_CRITICAL will be returned.")); + + printf (" %s\n\n", "CHECK CERTIFICATE: check_http -H www.verisign.com -C 14"); + printf (" %s\n", _("When the certificate of 'www.verisign.com' is valid for more than 14 days,")); + printf (" %s\n", _("a STATE_OK is returned. When the certificate is still valid, but for less than")); + printf (" %s\n", _("14 days, a STATE_WARNING is returned. A STATE_CRITICAL will be returned when")); + printf (" %s\n\n", _("the certificate is expired.")); #endif + + printf (_(UT_SUPPORT)); + } + void print_usage (void) { - printf ("Usage:\n" " %s %s\n" -#ifdef HAVE_GETOPT_H - " %s (-h | --help) for detailed help\n" - " %s (-V | --version) for version information\n", -#else - " %s -h for detailed help\n" - " %s -V for version information\n", -#endif - progname, OPTIONS, progname, progname); + printf (_("Usage:")); + printf (" %s -H | -I [-u ] [-p ]\n",progname); + printf (" [-w ] [-c ] [-t ] [-L]\n"); + printf (" [-a auth] [-y proxy-auth] [-f ] [-e ]\n"); + printf (" [-s string] [-l] [-r | -R ] [-P string]\n"); + printf (" [-m :] [-4|-6] [-N] [-M ] [-A string] [-k string]\n"); } From ae at op5.se Fri Sep 14 12:13:17 2007 From: ae at op5.se (Andreas Ericsson) Date: Fri, 14 Sep 2007 12:13:17 +0200 Subject: [Nagiosplug-devel] proxy_auth patch for check_http In-Reply-To: <20070913175216.GE30381@zengers.de> References: <20070913175216.GE30381@zengers.de> Message-ID: <46EA5EBD.6060401@op5.se> Alex wrote: > Hello, > > i've written a little patch (see attacted), which adds proxy_auth support for the > check_http command. The patch is basicly copied from the http_auth > code, just changed variable names and the header which is sent. > Thanks for the effort. But... The patch would have been much nicer to read without the 100+ nonsense lines that altered indentation. The top-comment was also quite ok as it was. I've been looking at it a full 5 minutes now and still haven't deciphered it fully, simply because I can't see which changes were done by you and which were done by indent, apparently running with the quite appalling --gnu option. -- Andreas Ericsson andreas.ericsson at op5.se OP5 AB www.op5.se Tel: +46 8-230225 Fax: +46 8-230231 From noreply at sourceforge.net Sat Sep 15 16:56:48 2007 From: noreply at sourceforge.net (SourceForge.net) Date: Sat, 15 Sep 2007 07:56:48 -0700 Subject: [Nagiosplug-devel] [ nagiosplug-Bugs-1218438 ] check_radius.c: In function `main': Message-ID: Bugs item #1218438, was opened at 2005-06-10 21:34 Message generated for change (Comment added) made by hweiss You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=397597&aid=1218438&group_id=29880 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Compilation Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: S?bastien Guay (sebasguay) Assigned to: M. Sean Finney (seanius) Summary: check_radius.c: In function `main': Initial Comment: When trying to compile on slackware I got the following check_radius.c: In function `main': check_radius.c:126: error: too few arguments to function `rc_avpair_add' check_radius.c:127: error: too few arguments to function `rc_avpair_add' check_radius.c:128: error: too few arguments to function `rc_avpair_add' check_radius.c:129: error: too few arguments to function `rc_avpair_add' check_radius.c:139: error: too few arguments to function `rc_avpair_add' check_radius.c:145: error: too few arguments to function `rc_send_server' make[2]: *** [check_radius.o] Error 1 make[2]: Leaving directory `/usr/local/src/nagios-plugins-1.4/plugins' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/usr/local/src/nagios-plugins-1.4' make: *** [all] Error 2 I uninstalled the package ppp-2.4.2-i486-2 and redo a make and all was fine. After I reinstalled ppp-2.4.2-i486-2. ppp-2.4.2-i486-2 has a file radiusclient.h. S?bas ---------------------------------------------------------------------- >Comment By: Holger Weiss (hweiss) Date: 2007-09-15 16:56 Message: Logged In: YES user_id=759506 Originator: NO JFTR (as we chattet on this issue via IRC already): IMO both solutions are just fine, though I'd prefer wrapper functions over #ifdefs. Most of the wrapper functions could actually be replaced by simple macros, but I don't really care. Thanks, Matthias! Please commit :-) Holger ---------------------------------------------------------------------- Comment By: Matthias Eble (psychotrahe) Date: 2007-08-07 23:33 Message: Logged In: YES user_id=1694341 Originator: NO File Added: ifdef.patch ---------------------------------------------------------------------- Comment By: Matthias Eble (psychotrahe) Date: 2007-08-07 23:32 Message: Logged In: YES user_id=1694341 Originator: NO File Added: wrapper.patch ---------------------------------------------------------------------- Comment By: Matthias Eble (psychotrahe) Date: 2007-08-07 23:31 Message: Logged In: YES user_id=1694341 Originator: NO i made two patches for this one. one using ifdefs all the time rc_ functions are called and one using wrapper functions for the majority(the incompatible) functions of radiusclient. Please post your objections about which approach we should check in.. Matthias File Added: configure.patch ---------------------------------------------------------------------- Comment By: Bob Ingraham (rwingraham) Date: 2005-09-22 21:42 Message: Logged In: YES user_id=1086870 Here's the patch to check_radius.c in 'diff -u' format: --- check_radius.c.ORIGINAL 2004-12-25 16:17:44.000000000 -0700 +++ check_radius.c 2005-09-19 16:03:49.000000000 - 0600 @@ -27,7 +27,7 @@ #include "utils.h" #include "netutils.h" -#include +#include int process_arguments (int, char **); void print_help (void); @@ -108,6 +108,7 @@ int result = STATE_UNKNOWN; UINT4 client_id; char *str; + rc_handle *rch = NULL; setlocale (LC_ALL, ""); bindtextdomain (PACKAGE, LOCALEDIR); @@ -117,32 +118,32 @@ usage4 (_("Could not parse arguments")); str = strdup ("dictionary"); - if ((config_file && rc_read_config (config_file)) || - rc_read_dictionary (rc_conf_str (str))) + if ((config_file && (rch = rc_read_config (config_file))) || + rc_read_dictionary (rch, rc_conf_str (rch, str))) die (STATE_UNKNOWN, _("Config file error")); service = PW_AUTHENTICATE_ONLY; - if (!(rc_avpair_add (&data.send_pairs, PW_SERVICE_TYPE, &service, 0) && - rc_avpair_add (&data.send_pairs, PW_USER_NAME, username, 0) && - rc_avpair_add (&data.send_pairs, PW_USER_PASSWORD, password, 0) && - (nasid==NULL || rc_avpair_add (&data.send_pairs, PW_NAS_IDENTIFIER, nasid, 0)))) + if (!(rc_avpair_add (rch, &data.send_pairs, PW_SERVICE_TYPE, &service, -1, 0) && + rc_avpair_add (rch, &data.send_pairs, PW_USER_NAME, username, -1, 0) && + rc_avpair_add (rch, &data.send_pairs, PW_USER_PASSWORD, password, -1, 0) && + (nasid==NULL || rc_avpair_add (rch, &data.send_pairs, PW_NAS_IDENTIFIER, nasid, -1, 0)))) die (STATE_UNKNOWN, _("Out of Memory?")); /* * Fill in NAS-IP-Address */ - if ((client_id = rc_own_ipaddress ()) == 0) + if ((client_id = rc_own_ipaddress (rch)) == 0) return (ERROR_RC); - if (rc_avpair_add (&(data.send_pairs), PW_NAS_IP_ADDRESS, &client_id, 0) == + if (rc_avpair_add (rch, &(data.send_pairs), PW_NAS_IP_ADDRESS, &client_id, -1, 0) == NULL) return (ERROR_RC); - rc_buildreq (&data, PW_ACCESS_REQUEST, server, port, (int)timeout_interval, + rc_buildreq (rch, &data, PW_ACCESS_REQUEST, server, port, (int)timeout_interval, retries); - result = rc_send_server (&data, msg); + result = rc_send_server (rch, &data, msg); rc_avpair_free (data.send_pairs); if (data.receive_pairs) rc_avpair_free (data.receive_pairs); ---------------------------------------------------------------------- Comment By: Bob Ingraham (rwingraham) Date: 2005-09-22 21:36 Message: Logged In: YES user_id=1086870 I ran into this same problem. The current radiusclient library (radiusclient-ng) has an updated API which requires a "config-file-handle" first argument to most of the API entry points. I've updated check_radius.c to adhere to the new radiusclient- ng API conventions. Assuming that you have this current library installed, then check_radius.c compiles and link cleanly now. I don't see where I can attach the updated check_radius.c file as an upload with this comment... Let me know how I can send it in without opening a new case. Note also that the configure script needs to be updated to check for libradisclient-ng (instead of libradiusclient). Bob ---------------------------------------------------------------------- Comment By: Bradley Hook (coder7) Date: 2005-09-22 19:13 Message: Logged In: YES user_id=903812 Just an update to my previous post. I emailed the distribution maintainer for Slackware, Patrick Volkerding. Here is his response: ---begin quote--- Generally I won't move header files since their location should be up to the upstream maintainer(s), not me. In this case the version of radiusclient is rather old though, and perhaps it's useless to everyone anyway and should simply be removed. You might try writing to them to see if they have an opinion about it, though. Also, even if I were to keep the functional parts of the included radiusclient I could remove the header, .a library, and .so symlink if everyone is using radiusclient-ng to compile against now anyway. Anyway, thanks for the info. I'll ponder a bit whether radiusclient is useless on Slackware. (it is to me, but... :) ---end quote--- ---------------------------------------------------------------------- Comment By: Bradley Hook (coder7) Date: 2005-09-21 20:47 Message: Logged In: YES user_id=903812 Can we get a small note added to the README until a more permanent solution is found? I will submit this to the Slackware people to see if the radiusclient.h is even needed in the ppp package, they might be able to remove it or move it. ---------------------------------------------------------------------- Comment By: M. Sean Finney (seanius) Date: 2005-07-14 13:25 Message: Logged In: YES user_id=226838 hi, thanks for the extra info. i'll try and look more into this in the next couple of weeks, and see if i can do some voodoo in autoconf to determine the correct prototypes and version of radiusclient. ---------------------------------------------------------------------- Comment By: John Warburton (johnwarburton) Date: 2005-07-14 03:05 Message: Logged In: YES user_id=1192023 Hi Guys The problem isn't specific to Slackware. It is anyone that runs with newer versions of the radiusclient library. The REQUIREMENTS file says they can be found at http://www.cityline.net/~lf/radius/ versions radiusclient-0.3.1-1 That website no longer exists, but I have tracked down the developer to http://developer.berlios.de/projects/radiusclient-ng/ I was getting the same compile time errors on Solaris 8 with radiusclient-0.4.9 as S?bastien. I downloaded an earlier client library - radiusclient-0.3.3, which compiled, but I have no idea on configuring, so doesn't seem to work. It seems to me the radius client library has moved on, but the Nagios plugin hasn't. Since my site has moved to openradius, I will just use a very simple shell script as a plugin to attempt login using the openradius "radclient" program. Regards John ---------------------------------------------------------------------- Comment By: S?bastien Guay (sebasguay) Date: 2005-07-05 20:11 Message: Logged In: YES user_id=265586 Hi Sean, > this looks like a problem with slackware or the slackware > package of ppp then. where is the radiusclient.h provided > by your libradius package (or whatever the slackware > equivalent is that provides radiusclient.h)? The file radiusclient.h is part of the package ppp (or I misunderstood your question?). > i'm not sure why installing ppp would plop an include file > used to build ppp in a compiler accessible directory in the > first place, Not sure either :) > but unless you can provide a convincing reason > why this is a problem with the nagios plugins, i'm going to > close out the bug in a week's time. My goal was not to convince anybody, it was just to let you know that any Slackware user may have a problem to compile nagios plugins if they have the ppp package installed. As I said, the problem was easily solved on my side by uninstalling ppp and re-installing it after. Here's the definition of rc_avpair_add() function in the radiusclient.h file in the ppp package VALUE_PAIR *rc_avpair_add __P((VALUE_PAIR **, int, void *, int, int)); and here's the call of rc_avpair_add in check_radius.c rc_avpair_add (&data.send_pairs, PW_SERVICE_TYPE, &service, 0) I don't know anything about libradius. Do you know what is the *supposed* arguments number for rc_avpair_add()? If it's 4, I can send a bug report to Patrick. The radiusclient.h file is in attach. S?bas ---------------------------------------------------------------------- Comment By: M. Sean Finney (seanius) Date: 2005-06-28 04:06 Message: Logged In: YES user_id=226838 hi sebastien, this looks like a problem with slackware or the slackware package of ppp then. where is the radiusclient.h provided by your libradius package (or whatever the slackware equivalent is that provides radiusclient.h)? i'm not sure why installing ppp would plop an include file used to build ppp in a compiler accessible directory in the first place, but unless you can provide a convincing reason why this is a problem with the nagios plugins, i'm going to close out the bug in a week's time. thanks, sean ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=397597&aid=1218438&group_id=29880 From holger at CIS.FU-Berlin.DE Sat Sep 15 17:17:20 2007 From: holger at CIS.FU-Berlin.DE (Holger Weiss) Date: Sat, 15 Sep 2007 17:17:20 +0200 Subject: [Nagiosplug-devel] Nagios::Plugin perl module integrated into SVN In-Reply-To: <4ABE8CAF-6D2F-416A-AABA-75D99469945C@altinity.com> References: <4ABE8CAF-6D2F-416A-AABA-75D99469945C@altinity.com> Message-ID: <20070915151720.GM6828@CIS.FU-Berlin.DE> * Ton Voon [2007-09-13 12:50]: > I've finally got round to integrating Nagios::Plugin into the core code. Nice! > It is currently optional, though I would expect to make it default to > install in future (though you will still be able to disable). > > Any feedback? Out of curiosity, why should disabling N::P remain supported in the future? Don't we want to use it in our own Perl plugins? > I think a release is probably in order soon, because Holger and > Thomas have fixed quite a few problems. Matthias, don't you want to commit your libradisclient-ng support for check_radius[*]? I guess that would make quite a few users happy. Apart from that, a new release sounds good to me. Next to the bug fixes, I'd guess the unicast support for check_dhcp will be useful for quite a few sites. I'll leave my "configurable output format" stuff for the next release. I guess apart from me there's nobody really _that_ interested in this feature anyway ;-) Holger [*] http://sourceforge.net/tracker/?func=detail&aid=1218438&group_id=29880&atid=397597 From ton.voon at altinity.com Sat Sep 15 21:04:52 2007 From: ton.voon at altinity.com (Ton Voon) Date: Sat, 15 Sep 2007 20:04:52 +0100 Subject: [Nagiosplug-devel] Nagios::Plugin perl module integrated into SVN In-Reply-To: <20070915151720.GM6828@CIS.FU-Berlin.DE> References: <4ABE8CAF-6D2F-416A-AABA-75D99469945C@altinity.com> <20070915151720.GM6828@CIS.FU-Berlin.DE> Message-ID: <7FDE0ADE-370C-46C2-9DE3-1AD95880F477@altinity.com> On 15 Sep 2007, at 16:17, Holger Weiss wrote: > * Ton Voon [2007-09-13 12:50]: >> It is currently optional, though I would expect to make it default to >> install in future (though you will still be able to disable). >> >> Any feedback? > > Out of curiosity, why should disabling N::P remain supported in the > future? Don't we want to use it in our own Perl plugins? Yes, I'd expect all our perl plugins to use N::P. The disabling is for package maintainers as they may want to install N::P into system directories (via other policies) instead of Nagios directories. >> I think a release is probably in order soon, because Holger and >> Thomas have fixed quite a few problems. > > Matthias, don't you want to commit your libradisclient-ng support for > check_radius[*]? I guess that would make quite a few users happy. > > Apart from that, a new release sounds good to me. Next to the bug > fixes, I'd guess the unicast support for check_dhcp will be useful for > quite a few sites. I'll leave my "configurable output format" > stuff for > the next release. I guess apart from me there's nobody really _that_ > interested in this feature anyway ;-) Sounds good. I'm thinking that this is a 1.4.10. Maybe make the default install N::P and "configurable output format" as 1.5. Ton http://www.altinity.com T: +44 (0)870 787 9243 F: +44 (0)845 280 1725 Skype: tonvoon From dermoth at aei.ca Sun Sep 16 07:53:01 2007 From: dermoth at aei.ca (Thomas Guyot-Sionnest) Date: Sun, 16 Sep 2007 01:53:01 -0400 Subject: [Nagiosplug-devel] Nagios::Plugin perl module integrated into SVN In-Reply-To: <7FDE0ADE-370C-46C2-9DE3-1AD95880F477@altinity.com> References: <4ABE8CAF-6D2F-416A-AABA-75D99469945C@altinity.com> <20070915151720.GM6828@CIS.FU-Berlin.DE> <7FDE0ADE-370C-46C2-9DE3-1AD95880F477@altinity.com> Message-ID: <46ECC4BD.4050902@aei.ca> On 15/09/07 03:04 PM, Ton Voon wrote: > On 15 Sep 2007, at 16:17, Holger Weiss wrote: > > Sounds good. I'm thinking that this is a 1.4.10. Maybe make the > default install N::P and "configurable output format" as 1.5. Sounds good to me too... I didn't worked much on the project lately but I'm trying to get back up to speed... :) On a side note I just written a Perl plugin for checking M$ SQL databases (attached). It fully uses N::P, including thresholds and performance data (and it's awesome how easy it is now!). Strangely right after that I noticed there is a bash check_mssql in /contrib so I thought maybe we could include mine as a replacement. I believe it's also a good example of a N::P plugin. If we don't include it I'll upload it to NagiosExchange. I don't care whenever it gets in before or after next release either... Thomas -------------- next part -------------- A non-text attachment was scrubbed... Name: check_mssql.pl Type: application/x-perl Size: 4963 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 252 bytes Desc: OpenPGP digital signature URL: From holger at CIS.FU-Berlin.DE Sun Sep 16 16:53:18 2007 From: holger at CIS.FU-Berlin.DE (Holger Weiss) Date: Sun, 16 Sep 2007 16:53:18 +0200 Subject: [Nagiosplug-devel] Nagios::Plugin perl module integrated into SVN In-Reply-To: <7FDE0ADE-370C-46C2-9DE3-1AD95880F477@altinity.com> References: <4ABE8CAF-6D2F-416A-AABA-75D99469945C@altinity.com> <20070915151720.GM6828@CIS.FU-Berlin.DE> <7FDE0ADE-370C-46C2-9DE3-1AD95880F477@altinity.com> Message-ID: <20070916145318.GN6828@CIS.FU-Berlin.DE> * Ton Voon [2007-09-15 20:04]: > On 15 Sep 2007, at 16:17, Holger Weiss wrote: > > * Ton Voon [2007-09-13 12:50]: > >> It is currently optional, though I would expect to make it default to > >> install in future (though you will still be able to disable). > >> > >> Any feedback? > > > > Out of curiosity, why should disabling N::P remain supported in the > > future? Don't we want to use it in our own Perl plugins? > > Yes, I'd expect all our perl plugins to use N::P. > > The disabling is for package maintainers as they may want to install > N::P into system directories (via other policies) instead of Nagios > directories. Oh okay, I misunderstood "optional" :-) This makes sense of course. > >> I think a release is probably in order soon, because Holger and > >> Thomas have fixed quite a few problems. > > > > Matthias, don't you want to commit your libradisclient-ng support for > > check_radius[*]? I guess that would make quite a few users happy. > > > > Apart from that, a new release sounds good to me. Next to the bug > > fixes, I'd guess the unicast support for check_dhcp will be useful for > > quite a few sites. I'll leave my "configurable output format" stuff > > for the next release. I guess apart from me there's nobody really > > _that_ interested in this feature anyway ;-) > > Sounds good. I'm thinking that this is a 1.4.10. Maybe make the default > install N::P and "configurable output format" as 1.5. Fine with me of course. Holger From matthias.eble at mailing.kaufland-informationssysteme.com Mon Sep 17 09:13:10 2007 From: matthias.eble at mailing.kaufland-informationssysteme.com (Matthias Eble) Date: Mon, 17 Sep 2007 09:13:10 +0200 Subject: [Nagiosplug-devel] Nagios::Plugin perl module integrated into SVN In-Reply-To: <20070915151720.GM6828@CIS.FU-Berlin.DE> References: <4ABE8CAF-6D2F-416A-AABA-75D99469945C@altinity.com> <20070915151720.GM6828@CIS.FU-Berlin.DE> Message-ID: <46EE2906.1040903@mailing.kaufland-informationssysteme.com> > Matthias, don't you want to commit your libradisclient-ng support for > check_radius[*]? I guess that would make quite a few users happy. Yes. I wanted to post this one today :) I'm currently working on an enhancement for check_disk to ignore filesystems based on regexes. I only need to write some test cases for utils and check_disk. It will be ready until friday I guess. Would it be OK to release early next week? So I'll be able to review the bugtracker again. Matthias From ton.voon at altinity.com Mon Sep 17 09:48:34 2007 From: ton.voon at altinity.com (Ton Voon) Date: Mon, 17 Sep 2007 08:48:34 +0100 Subject: [Nagiosplug-devel] Nagios::Plugin perl module integrated into SVN In-Reply-To: <46ECC4BD.4050902@aei.ca> References: <4ABE8CAF-6D2F-416A-AABA-75D99469945C@altinity.com> <20070915151720.GM6828@CIS.FU-Berlin.DE> <7FDE0ADE-370C-46C2-9DE3-1AD95880F477@altinity.com> <46ECC4BD.4050902@aei.ca> Message-ID: On 16 Sep 2007, at 06:53, Thomas Guyot-Sionnest wrote: > On a side note I just written a Perl plugin for checking M$ SQL > databases (attached). It fully uses N::P, including thresholds and > performance data (and it's awesome how easy it is now!). Strangely > right > after that I noticed there is a bash check_mssql in /contrib so I > thought maybe we could include mine as a replacement. I believe it's > also a good example of a N::P plugin. I'd definitely want an example plugin to include. I've had a quick look through yours (as much as I can without a mssql server) and it looks good. I notice that the contrib version has number of users in the output - could that be added (don't worry about thresholds for that yet)? Then we can remove the contrib version. > If we don't include it I'll upload it to NagiosExchange. Also, if you want it distributed in the core distribution, could you set the copyright as Nagios Plugins Development Team (you can list yourself as the original author). If you want to retain personal copyright, which is your entitlement, then it should be hosted on NagiosExchange. Ton http://www.altinity.com T: +44 (0)870 787 9243 F: +44 (0)845 280 1725 Skype: tonvoon From ton.voon at altinity.com Mon Sep 17 09:59:34 2007 From: ton.voon at altinity.com (Ton Voon) Date: Mon, 17 Sep 2007 08:59:34 +0100 Subject: [Nagiosplug-devel] Nagios::Plugin perl module integrated into SVN In-Reply-To: <46EE2906.1040903@mailing.kaufland-informationssysteme.com> References: <4ABE8CAF-6D2F-416A-AABA-75D99469945C@altinity.com> <20070915151720.GM6828@CIS.FU-Berlin.DE> <46EE2906.1040903@mailing.kaufland-informationssysteme.com> Message-ID: On 17 Sep 2007, at 08:13, Matthias Eble wrote: > Yes. I wanted to post this one today :) > I'm currently working on an enhancement for check_disk to ignore > filesystems based on regexes. I only need to write some test cases for > utils and check_disk. It will be ready until friday I guess. Sounds good. > Would it be OK to release early next week? So I'll be able to > review the > bugtracker again. Shall we say 26th September as something to aim for? There is no urgency for the release, there's just some nice stuff that I think we should let others play with. p.s. I've just noticed tinderbox failures due to the perl mods - I'll get that fixed today. Ton http://www.altinity.com T: +44 (0)870 787 9243 F: +44 (0)845 280 1725 Skype: tonvoon From matthias.eble at mailing.kaufland-informationssysteme.com Mon Sep 17 15:40:37 2007 From: matthias.eble at mailing.kaufland-informationssysteme.com (Matthias Eble) Date: Mon, 17 Sep 2007 15:40:37 +0200 Subject: [Nagiosplug-devel] changing check_disk -E behaviour Message-ID: <46EE83D5.8050109@mailing.kaufland-informationssysteme.com> hi all, I'm currently working on check_disk to let users ignore mountpoints/devices based on regular expressions. There seems to be a problem with parsing of the options I want to hear your opinion about. To compare the regexes against devname and mountdir, the best_match pointer needs to be set. Unfortunately this clashes with -E (exact match) which is allowed to be specified everywhere in the command line. I'd suggest to change -E to be only allowed prior to -p and -r arguments. This would cause an incompatibility but would also become revealed instantly after upgrading (check_disk exiting UNKNOWN). Thanks Matthias From ae at op5.se Mon Sep 17 16:05:57 2007 From: ae at op5.se (Andreas Ericsson) Date: Mon, 17 Sep 2007 16:05:57 +0200 Subject: [Nagiosplug-devel] changing check_disk -E behaviour In-Reply-To: <46EE83D5.8050109@mailing.kaufland-informationssysteme.com> References: <46EE83D5.8050109@mailing.kaufland-informationssysteme.com> Message-ID: <46EE89C5.2090901@op5.se> Matthias Eble wrote: > hi all, > > I'm currently working on check_disk to let users ignore > mountpoints/devices based on regular expressions. > > There seems to be a problem with parsing of the options I want to hear > your opinion about. > > To compare the regexes against devname and mountdir, the best_match > pointer needs to be set. Unfortunately this clashes with -E (exact > match) which is allowed to be specified everywhere in the command line. > > I'd suggest to change -E to be only allowed prior to -p and -r > arguments. This would cause an incompatibility but would also become > revealed instantly after upgrading (check_disk exiting UNKNOWN). > Hand-parse the arguments once before going through the optind routines. That way you can bail with a sane error message. > Thanks > Matthias > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________________ > Nagios Plugin Development Mailing List Nagiosplug-devel at lists.sourceforge.net > Unsubscribe at https://lists.sourceforge.net/lists/listinfo/nagiosplug-devel > ::: Please include plugins version (-v) and OS when reporting any issue. > ::: Messages without supporting info will risk being sent to /dev/null -- Andreas Ericsson andreas.ericsson at op5.se OP5 AB www.op5.se Tel: +46 8-230225 Fax: +46 8-230231 From thomas at zango.com Mon Sep 17 21:35:28 2007 From: thomas at zango.com (Thomas Guyot-Sionnest) Date: Mon, 17 Sep 2007 15:35:28 -0400 Subject: [Nagiosplug-devel] Nagios::Plugin perl module integrated into SVN In-Reply-To: References: <4ABE8CAF-6D2F-416A-AABA-75D99469945C@altinity.com> <20070915151720.GM6828@CIS.FU-Berlin.DE> <7FDE0ADE-370C-46C2-9DE3-1AD95880F477@altinity.com> <46ECC4BD.4050902@aei.ca> Message-ID: <46EED700.3010501@zango.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Ton Voon wrote: > On 16 Sep 2007, at 06:53, Thomas Guyot-Sionnest wrote: > >> On a side note I just written a Perl plugin for checking M$ SQL >> databases (attached). It fully uses N::P, including thresholds and >> performance data (and it's awesome how easy it is now!). Strangely >> right >> after that I noticed there is a bash check_mssql in /contrib so I >> thought maybe we could include mine as a replacement. I believe it's >> also a good example of a N::P plugin. > > I'd definitely want an example plugin to include. check_stuff.pl was a good source of inspiration for me, though check_mssql is a bit more useful :) > I've had a quick look through yours (as much as I can without a mssql > server) and it looks good. I notice that the contrib version has It would certainly work on any database if you change the DB driver and specify the right port. That could be useful for testing (I don't have any M$SQL db at home either). > number of users in the output - could that be added (don't worry > about thresholds for that yet)? Then we can remove the contrib version. I could possibly. I'll have to look around or test since the method used seems a bit special. This check script query "select loginame from sysprocesses where spid > $spid order by loginame asc" (where $spid varies between version 7 and 2000, how about 2005?), filter out a bunch of lines and count the rest. However in all honesty I think this kind of check is flaky. I was rather thinking of a pair of options to override the query and check the result (optionnal), and another pair to set a label (optionnal) and print the result. I think that would benefit more people and DBAs can always create SPROCs to do the dirty work. > Also, if you want it distributed in the core distribution, could you > set the copyright as Nagios Plugins Development Team (you can list I have no problem with that. Thomas -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFG7tcA6dZ+Kt5BchYRAoVHAKDmkKPIMXUi9+2TGB3+gve1o1rFcQCeOMDu SMubZtd7Zozuc2K8fTRc3EU= =Xkqo -----END PGP SIGNATURE----- From matthias.eble at mailing.kaufland-informationssysteme.com Tue Sep 18 08:21:55 2007 From: matthias.eble at mailing.kaufland-informationssysteme.com (Matthias Eble) Date: Tue, 18 Sep 2007 08:21:55 +0200 Subject: [Nagiosplug-devel] changing check_disk -E behaviour In-Reply-To: <46EE89C5.2090901@op5.se> References: <46EE83D5.8050109@mailing.kaufland-informationssysteme.com> <46EE89C5.2090901@op5.se> Message-ID: <46EF6E83.7080201@mailing.kaufland-informationssysteme.com> >> I'd suggest to change -E to be only allowed prior to -p and -r >> arguments. This would cause an incompatibility but would also become >> revealed instantly after upgrading (check_disk exiting UNKNOWN). >> > > Hand-parse the arguments once before going through the optind routines. > That way you can bail with a sane error message. That'd be how to do it. My question was more whether you/the list think the breaking of backward compatibility is passable in that case. I didn't make that clear enough though. Matthias From ton.voon at altinity.com Tue Sep 18 10:26:07 2007 From: ton.voon at altinity.com (Ton Voon) Date: Tue, 18 Sep 2007 09:26:07 +0100 Subject: [Nagiosplug-devel] changing check_disk -E behaviour In-Reply-To: <46EE83D5.8050109@mailing.kaufland-informationssysteme.com> References: <46EE83D5.8050109@mailing.kaufland-informationssysteme.com> Message-ID: On 17 Sep 2007, at 14:40, Matthias Eble wrote: > To compare the regexes against devname and mountdir, the best_match > pointer needs to be set. Unfortunately this clashes with -E (exact > match) which is allowed to be specified everywhere in the command > line. > > I'd suggest to change -E to be only allowed prior to -p and -r > arguments. This would cause an incompatibility but would also become > revealed instantly after upgrading (check_disk exiting UNKNOWN). I think this is an acceptable change in command line options - just make sure it is clearly written in the CHANGES file. Ton http://www.altinity.com T: +44 (0)870 787 9243 F: +44 (0)845 280 1725 Skype: tonvoon From dermoth at aei.ca Wed Sep 19 09:13:27 2007 From: dermoth at aei.ca (Thomas Guyot-Sionnest) Date: Wed, 19 Sep 2007 03:13:27 -0400 Subject: [Nagiosplug-devel] max_state logic? Message-ID: <46F0CC17.5080907@aei.ca> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hey, I was trying to replicate max_state from utils.c in Perl, but the logic there seems broken: int max_state (int a, int b) { if (a == STATE_CRITICAL || b == STATE_CRITICAL) return STATE_CRITICAL; else if (a == STATE_WARNING || b == STATE_WARNING) return STATE_WARNING; else if (a == STATE_OK || b == STATE_OK) return STATE_OK; else if (a == STATE_UNKNOWN || b == STATE_UNKNOWN) return STATE_UNKNOWN; else if (a == STATE_DEPENDENT || b == STATE_DEPENDENT) return STATE_DEPENDENT; else return max (a, b); } Given that, OK + UNKNOWN or OK + DEPENDENT will always return OK. Is that right? IMO the OK test should be moved at the end. Thomas -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFG8MwX6dZ+Kt5BchYRAujPAJ0RXtQI9kQqaMv//OwYmOJdm7fuyQCg8pEl gibuZDTBAx+41rBiDYPhtDQ= =uWfB -----END PGP SIGNATURE----- From dermoth at aei.ca Wed Sep 19 09:46:04 2007 From: dermoth at aei.ca (Thomas Guyot-Sionnest) Date: Wed, 19 Sep 2007 03:46:04 -0400 Subject: [Nagiosplug-devel] New function for N::P Message-ID: <46F0D3BC.9090602@aei.ca> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I'd like to add a new function (max_state) to N::P but I never played with perl libs, so I'll let it to more experienced programmers. According to the way max_state is written in C (plus the fix I suggested in the other thread), the code should look like this: sub max_state { my $ret = shift; while (defined(my $state = shift)) { if ($state == CRITICAL) { $ret = CRITICAL; } elsif ($state == WARNING && $ret != CRITICAL) { $ret = WARNING; } elsif ($state == UNKNOWN && $ret != CRITICAL && $ret != WARNING) { $ret = UNKNOWN; } elsif ($state == DEPENDENT && $ret != CRITICAL && $ret != WARNING && $ret != UNKNOWN) { $ret = DEPENDENT; } elsif ($state > DEPENDENT) { $ret = $state if ($state > $ret ); } } return $ret; } Contradictory to its C counterpart, this one can accept more than two values. For the doc, I guess it should go to the exit methods section: =item max_state( $result1, $result2, ...) Return the most critical state. The order is CRITICAL, WARNING, UNKNOWN, DEPENDENT then the highest non-0 result. It returns OK only if all parameters are OK. And an example for the synopsis: $ret = max_state($result1, $result2); Thomas -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFG8NO86dZ+Kt5BchYRAqExAKC/TIeHRNPLxPmXw0fJMe16jfcNigCguaDc Kj2IEp2f1Pmd+leh81eDqDk= =1SWt -----END PGP SIGNATURE----- From ton.voon at altinity.com Wed Sep 19 10:12:18 2007 From: ton.voon at altinity.com (Ton Voon) Date: Wed, 19 Sep 2007 09:12:18 +0100 Subject: [Nagiosplug-devel] max_state logic? In-Reply-To: <46F0CC17.5080907@aei.ca> References: <46F0CC17.5080907@aei.ca> Message-ID: On 19 Sep 2007, at 08:13, Thomas Guyot-Sionnest wrote: > I was trying to replicate max_state from utils.c in Perl, but the > logic > there seems broken: > > int > max_state (int a, int b) > { > if (a == STATE_CRITICAL || b == STATE_CRITICAL) > return STATE_CRITICAL; > else if (a == STATE_WARNING || b == STATE_WARNING) > return STATE_WARNING; > else if (a == STATE_OK || b == STATE_OK) > return STATE_OK; > else if (a == STATE_UNKNOWN || b == STATE_UNKNOWN) > return STATE_UNKNOWN; > else if (a == STATE_DEPENDENT || b == STATE_DEPENDENT) > return STATE_DEPENDENT; > else > return max (a, b); > } > > Given that, OK + UNKNOWN or OK + DEPENDENT will always return OK. Is > that right? IMO the OK test should be moved at the end. > Yes, that does look broken. I think DEPENDENT was a really old state, which I don't think should be used anymore, though I can see it is used in check_http and check_snmp. Anyone know the history of this? Thomas, could you fix? Ideally there should be some tests against it but that would involve moving max_state into utils_base.c. Ton http://www.altinity.com T: +44 (0)870 787 9243 F: +44 (0)845 280 1725 Skype: tonvoon From ton.voon at altinity.com Wed Sep 19 10:16:30 2007 From: ton.voon at altinity.com (Ton Voon) Date: Wed, 19 Sep 2007 09:16:30 +0100 Subject: [Nagiosplug-devel] New function for N::P In-Reply-To: <46F0D3BC.9090602@aei.ca> References: <46F0D3BC.9090602@aei.ca> Message-ID: On 19 Sep 2007, at 08:46, Thomas Guyot-Sionnest wrote: > I'd like to add a new function (max_state) to N::P but I never played > with perl libs, so I'll let it to more experienced programmers. It is available in N::P::Functions already, though there is probably a documentation hole if it is not documented in N::P. I note it also has the same bug in giving precedence to OK above UNKNOWN and DEPENDENT. Do you want to try and patch that? Make sure you run "make test"! Ton http://www.altinity.com T: +44 (0)870 787 9243 F: +44 (0)845 280 1725 Skype: tonvoon From rouilj at cs.umb.edu Wed Sep 19 12:55:01 2007 From: rouilj at cs.umb.edu (John P. Rouillard) Date: Wed, 19 Sep 2007 06:55:01 -0400 Subject: [Nagiosplug-devel] max_state logic? In-Reply-To: Your message of "Wed, 19 Sep 2007 09:12:18 BST." Message-ID: <200709191055.l8JAt1tk009993@mx1.cs.umb.edu> In message , Ton Voon writes: >On 19 Sep 2007, at 08:13, Thomas Guyot-Sionnest wrote: >> I was trying to replicate max_state from utils.c in Perl, but the >> logic there seems broken: >> >> int >> max_state (int a, int b) >> [...] >> Given that, OK + UNKNOWN or OK + DEPENDENT will always return OK. Is >> that right? IMO the OK test should be moved at the end. >> > >Yes, that does look broken. I think DEPENDENT was a really old state, >which I don't think should be used anymore, though I can see it is >used in check_http and check_snmp. Anyone know the history of this? Is state dependent = 4? IIRC in nagios, there are 5 states 0-4. State 4 was the code that was used for B when host A is the parent of B and A is down (I.E. reachability of B depended on A). But I think the state was called unreachable or some such. I am not sure if a plugin can return that, or if it was an internal nagios only thingy. -- rouilj John Rouillard =========================================================================== My employers don't acknowledge my existence much less my opinions. From dermoth at aei.ca Wed Sep 19 13:26:06 2007 From: dermoth at aei.ca (Thomas Guyot-Sionnest) Date: Wed, 19 Sep 2007 07:26:06 -0400 Subject: [Nagiosplug-devel] max_state logic? In-Reply-To: <200709191055.l8JAt1tk009993@mx1.cs.umb.edu> References: <200709191055.l8JAt1tk009993@mx1.cs.umb.edu> Message-ID: <46F1074E.6040309@aei.ca> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 19/09/07 06:55 AM, John P. Rouillard wrote: > In message , > Ton Voon writes: >> On 19 Sep 2007, at 08:13, Thomas Guyot-Sionnest wrote: >>> I was trying to replicate max_state from utils.c in Perl, but the >>> logic there seems broken: >>> >>> int >>> max_state (int a, int b) >>> [...] >>> Given that, OK + UNKNOWN or OK + DEPENDENT will always return OK. Is >>> that right? IMO the OK test should be moved at the end. >>> >> Yes, that does look broken. I think DEPENDENT was a really old state, >> which I don't think should be used anymore, though I can see it is >> used in check_http and check_snmp. Anyone know the history of this? > > Is state dependent = 4? Correct. > IIRC in nagios, there are 5 states 0-4. State 4 was the code that was > used for B when host A is the parent of B and A is down > (I.E. reachability of B depended on A). But I think the state was > called unreachable or some such. I am not sure if a plugin can return > that, or if it was an internal nagios only thingy. It is an "internal" thingy, though it could end up in checks like check_cluster which re-use Nagios status codes! I think the safest option is not to narrow our use_case to only know cases and keep it. Also I wasn't thinking about the other non-0 values. At the end it takes the max value of both parameters. If I remove the "OK" check then it'll do like the Perl example I sent (return higher non-0 before OK) while leaving the "OK" check before it will make it use out-of-bound values only if there's no OK state. A conservative thinking dictates me that any non-0 value is worse than OK so we're better let Nagios complain about it than ignore it (in other words we'd let max(a,b) deal with OK states). Any objections? Thomas -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFG8QdO6dZ+Kt5BchYRAsMjAKDtqYAduPJZAwl8PIguZk2GbYk21QCfeybl S/cggnTKxyH4sFtlxY5n89s= =erD5 -----END PGP SIGNATURE----- From thomas at zango.com Wed Sep 19 17:52:39 2007 From: thomas at zango.com (Thomas Guyot-Sionnest) Date: Wed, 19 Sep 2007 11:52:39 -0400 Subject: [Nagiosplug-devel] New function for N::P In-Reply-To: References: <46F0D3BC.9090602@aei.ca> Message-ID: <46F145C7.2050502@zango.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Ton Voon wrote: > On 19 Sep 2007, at 08:46, Thomas Guyot-Sionnest wrote: > >> I'd like to add a new function (max_state) to N::P but I never played >> with perl libs, so I'll let it to more experienced programmers. > > It is available in N::P::Functions already, though there is probably > a documentation hole if it is not documented in N::P. I note it also > has the same bug in giving precedence to OK above UNKNOWN and > DEPENDENT. Do you want to try and patch that? Make sure you run "make > test"! I "fixed" it and wrote some looping code to compare the two implementation with all possible values. However I realized that some plugins might have wanted to return OK if one of the checks returns UNKNOWN (i.e. the service is available but there's some information we couldn't get). Maybe I could create max_state_alt (or better name?) so that we have both possible behavior. The other thing it the N::P's behavior of returning UNKNOWN if ALL values are out of bound (i.e. "5", "-1") which isn't the way the C version works. I have no problem with that (and it make some sense actually; normaly the plugin shouldn't use anything else) but I think it shouldn't return OK if ANY value is out of bound. I assume we can safely ignore Nagios 1 "-1" return code too .... In short, my suggestion is: max_state: CRITICAL, WARNING, [unknown value = UNKNOWN], OK, UNKNOWN, DEPENDENT max_state_alt?: CRITICAL, WARNING, UNKNOWN, DEPENDENT, [unknown value = UNKNOWN], OK I'm open to comments... Thomas -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFG8UXH6dZ+Kt5BchYRAkdKAKCRuxvOisj9bjS1iyGFBGALwIqmewCeJsXP MHvNFdczzwUgORaXl09TXvA= =NavD -----END PGP SIGNATURE----- From noreply at sourceforge.net Thu Sep 20 15:52:01 2007 From: noreply at sourceforge.net (SourceForge.net) Date: Thu, 20 Sep 2007 06:52:01 -0700 Subject: [Nagiosplug-devel] [ nagiosplug-Patches-1798774 ] check_ntp: honor ntp flags Message-ID: Patches item #1798774, was opened at 2007-09-20 15:52 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=397599&aid=1798774&group_id=29880 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Bugfix Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: MAtteo HCE Valsasna (mvalsasna) Assigned to: Nobody/Anonymous (nobody) Summary: check_ntp: honor ntp flags Initial Comment: Patch against Plugin Version (-V output): check_ntp (nagios-plugins 1.4.9) 1.25 Plugin Name: check_ntp Example Plugin Commandline: ./check_ntp -H Tested on operating system: nagios host: debian etch i386, Version 2.0b3 NTP server: openwrt kamikaze 7.07 running openntpd 3.9.1p1 Tested on architecture: nagios host: i386 NTP server: mips Tested with compiler: gcc version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21) check_ntp fails to check ntp flags in the response it receives from servers, and accepts servers who respond with a valid stratum but with flags bit set to 11 (LI_ALARM). those servers were then refused by clients. this patch adds a check for ntp flags value, so that servers with flags != 00 (LI_NOWARNING) are discarded because of the complex structure of the plugin, which checks all IP addresses that correspond to the hostname given, and gives OK if at least one of them is OK, I couldn't easily add an explanatory error message additionally, if offset_result==STATE_CRITICAL (which happens also if all servers are rejected due to NTP flags), perfdata_line would have been used without being initialized, leading to printing of garbage, or possibly worse. this is corrected in the last chunk of the patch, by initializing perfdata_line ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=397599&aid=1798774&group_id=29880 From Alan.Hagge at warnerbros.com Thu Sep 20 18:52:16 2007 From: Alan.Hagge at warnerbros.com (Alan Hagge) Date: Thu, 20 Sep 2007 09:52:16 -0700 Subject: [Nagiosplug-devel] check_disk plugin fails on 80 TB filesystem Message-ID: <46F2A540.1040600@warnerbros.com> We're trying to use check_disk to monitor a number of Quantum (nee ADIC) StorNext filesystems on a SAN. We have a number of 16 TB filesystems and 3 80 TB (yup...80 terabyte) filesystems. check-disk seems to work fine on the 16 TB filesystems, but fails completely on the 80 TB filesystems: 16 TB filesystem: [root at backup ~]# /usr/lib/nagios/plugins/check_disk -vvvv -w 20 -c 10 -p /sans/hpsans10 For /sans/hpsans10, used_pct=47 free_pct=53 used_units=7.74397e+06 free_units=9.0322e+06 total_units=1.67762e+07 used_inodes_pct=15 free_inodes_pct=85 Freespace_units result=0 Freespace% result=0 Usedspace_units result=0 Usedspace_percent result=0 Usedinodes_percent result=0 Freeinodes_percent result=0 DISK OK - free space: /sans/hpsans10 9032201 MB (53% inode=85%);| /sans/hpsans10=7743974MB;16776156;16776166;0;16776176 80 TB filesystem: [root at backup ~]# /usr/lib/nagios/plugins/check_disk -vvvv -w 20 -c 10 -p /sans/hpfata07 For /sans/hpfata07, used_pct=100 free_pct=0 used_units=0 free_units=0 total_units=0 used_inodes_pct=100 free_inodes_pct=0 Freespace_units result=2 Freespace% result=0 Usedspace_units result=0 Usedspace_percent result=0 Usedinodes_percent result=0 Freeinodes_percent result=0 DISK CRITICAL - free space: /sans/hpfata07 0 MB (0% inode=0%);| /sans/hpfata07=0MB;-20;-10;0;0 I'm not sure if this is an issue of having to use statfs64 vs statfs, or an issue of variable sizes too small. I'll be glad to test any patches... Thanks in advance! From matthias.eble at mailing.kaufland-informationssysteme.com Fri Sep 21 10:33:02 2007 From: matthias.eble at mailing.kaufland-informationssysteme.com (Matthias Eble) Date: Fri, 21 Sep 2007 10:33:02 +0200 Subject: [Nagiosplug-devel] check_disk plugin fails on 80 TB filesystem In-Reply-To: <46F2A540.1040600@warnerbros.com> References: <46F2A540.1040600@warnerbros.com> Message-ID: <46F381BE.9080901@mailing.kaufland-informationssysteme.com> > I'm not sure if this is an issue of having to use statfs64 vs statfs, or > an issue of variable sizes too small. I'll be glad to test any patches... > Is this a linux system? If yes, can df display these sizes without problems? Matthias From ae at op5.se Fri Sep 21 13:01:57 2007 From: ae at op5.se (Andreas Ericsson) Date: Fri, 21 Sep 2007 13:01:57 +0200 Subject: [Nagiosplug-devel] [Nagiosplug-checkins] SF.net SVN: nagiosplug: [1783] nagiosplug/trunk/plugins/check_disk.c In-Reply-To: References: Message-ID: <46F3A4A5.7090308@op5.se> dermoth at users.sourceforge.net wrote: > Revision: 1783 > http://nagiosplug.svn.sourceforge.net/nagiosplug/?rev=1783&view=rev > Author: dermoth > Date: 2007-09-20 22:05:58 -0700 (Thu, 20 Sep 2007) > > Log Message: > ----------- > My solaris box needs %llu to display 64bits integers. > %llu is not available on all compilers though. In practice this doesn't matter much for the plugins project since its already used in check_icmp, check_disk and check_snmp. -- Andreas Ericsson andreas.ericsson at op5.se OP5 AB www.op5.se Tel: +46 8-230225 Fax: +46 8-230231 From noreply at sourceforge.net Fri Sep 21 14:22:03 2007 From: noreply at sourceforge.net (SourceForge.net) Date: Fri, 21 Sep 2007 05:22:03 -0700 Subject: [Nagiosplug-devel] [ nagiosplug-Patches-1798774 ] check_ntp: honor ntp flags Message-ID: Patches item #1798774, was opened at 2007-09-20 09:52 Message generated for change (Comment added) made by dermoth You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=397599&aid=1798774&group_id=29880 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Bugfix Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: MAtteo HCE Valsasna (mvalsasna) >Assigned to: Thomas Guyot (dermoth) Summary: check_ntp: honor ntp flags Initial Comment: Patch against Plugin Version (-V output): check_ntp (nagios-plugins 1.4.9) 1.25 Plugin Name: check_ntp Example Plugin Commandline: ./check_ntp -H Tested on operating system: nagios host: debian etch i386, Version 2.0b3 NTP server: openwrt kamikaze 7.07 running openntpd 3.9.1p1 Tested on architecture: nagios host: i386 NTP server: mips Tested with compiler: gcc version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21) check_ntp fails to check ntp flags in the response it receives from servers, and accepts servers who respond with a valid stratum but with flags bit set to 11 (LI_ALARM). those servers were then refused by clients. this patch adds a check for ntp flags value, so that servers with flags != 00 (LI_NOWARNING) are discarded because of the complex structure of the plugin, which checks all IP addresses that correspond to the hostname given, and gives OK if at least one of them is OK, I couldn't easily add an explanatory error message additionally, if offset_result==STATE_CRITICAL (which happens also if all servers are rejected due to NTP flags), perfdata_line would have been used without being initialized, leading to printing of garbage, or possibly worse. this is corrected in the last chunk of the patch, by initializing perfdata_line ---------------------------------------------------------------------- >Comment By: Thomas Guyot (dermoth) Date: 2007-09-21 08:22 Message: Logged In: YES user_id=375623 Originator: NO Thanks for submitting. I will review/test it shortly and get it included. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=397599&aid=1798774&group_id=29880 From Alan.Hagge at warnerbros.com Fri Sep 21 22:49:07 2007 From: Alan.Hagge at warnerbros.com (Alan Hagge) Date: Fri, 21 Sep 2007 13:49:07 -0700 Subject: [Nagiosplug-devel] check_disk plugin fails on 80 TB filesystem Message-ID: <46F42E43.2030507@warnerbros.com> Matthias wrote: > Is this a linux system? > If yes, can df display these sizes without problems? Yes, it is (RHEL4). And yes, df can display sizes without problems: [root at backup ~]# df /sans/hpsans10 Filesystem 1K-blocks Used Available Use% Mounted on /dev/cvfsctl4_hpsans10 17178804224 11927464768 5251339456 70% /sans/hpsans10 [root at backup ~]# df /sans/hpfata07 Filesystem 1K-blocks Used Available Use% Mounted on /dev/cvfsctl1_hpsans7 85854740480 67022606640 18832133840 79% /sans/hpfata07 [root at backup ~]# df -h /sans/hpfata07 Filesystem Size Used Avail Use% Mounted on /dev/cvfsctl1_hpsans7 80T 63T 18T 79% /sans/hpfata07 Alan From thomas at zango.com Fri Sep 21 23:13:02 2007 From: thomas at zango.com (Thomas Guyot-Sionnest) Date: Fri, 21 Sep 2007 17:13:02 -0400 Subject: [Nagiosplug-devel] check_disk plugin fails on 80 TB filesystem In-Reply-To: <46F381BE.9080901@mailing.kaufland-informationssysteme.com> References: <46F2A540.1040600@warnerbros.com> <46F381BE.9080901@mailing.kaufland-informationssysteme.com> Message-ID: <46F433DE.4080504@zango.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Matthias Eble wrote: >> I'm not sure if this is an issue of having to use statfs64 vs statfs, or >> an issue of variable sizes too small. I'll be glad to test any patches... >> > > Is this a linux system? > If yes, can df display these sizes without problems? Ideally we'd need to know: - - The type/version of operating system (uname -a) - - The type of executables (32, 64bit?). (file /path/to/check_disk) - - Which compiler (cc -v, cc --version, cc -V, ???) - - The full output of strace or equivalent, if possible. Also did you compile Nagios-plugins on that server or on another? - ----- I did some testing with a 80TiB loop device on my computer (Ubuntu 64Bit) and check_disk works like a charm on it. I then copied a 32bit check_disk binary from a server and ran it: it failed. - From strace I can see that the same statfs call that works with the 64bit library returns -1 EOVERFLOW (Value too large for defined data type) on the 32bit libs, though I have no idea if it's the same kind of issue. I also tested artificially setting the variables that are normally set by get_fs_usage(). It worked nicely on 64-bit systems (Ubuntu 64, Solaris 10), while on 32bit the perfdata part was broken (the functions uses signed integers). In both case the alerting worked properly though. - -- Thomas -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFG9DPe6dZ+Kt5BchYRAje2AJ4pw8weKr7vcLfxikpEJpio1IQf+wCfdWgu SayBSa+YjGjZqi0YXrAXrfU= =V7vv -----END PGP SIGNATURE----- From noreply at sourceforge.net Sat Sep 22 00:42:04 2007 From: noreply at sourceforge.net (SourceForge.net) Date: Fri, 21 Sep 2007 15:42:04 -0700 Subject: [Nagiosplug-devel] [ nagiosplug-Patches-1485559 ] Changes to the check_ntp perl-plugin Message-ID: Patches item #1485559, was opened at 2006-05-10 09:09 Message generated for change (Comment added) made by dermoth You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=397599&aid=1485559&group_id=29880 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Bugfix Group: None >Status: Closed >Resolution: Wont Fix Priority: 5 Private: No Submitted By: Johan Nilsson (riksdagen) Assigned to: Nobody/Anonymous (nobody) Summary: Changes to the check_ntp perl-plugin Initial Comment: In the course of upgrading Nagios from 1.3 to 2.1 on a Debian/GNU-machine, I saw a problem with the check_ntp perl-script. The plugin returns "UNKNOWN" if the ntp-server replies to the ntpdate-request, but the ntpq-request times out. The exact error-message is "Use of uninitialized value in division (/) at ./check_ntp line 431.", but on the next row the plugin reports the status of the ntp-server. ---------------------------------------------------------------------- >Comment By: Thomas Guyot (dermoth) Date: 2007-09-21 18:42 Message: Logged In: YES user_id=375623 Originator: NO Thanks for your submission. The check_ntp perl-plugin is deprecated in favor of the new check_ntp C plug-in which doesn't have such issues. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=397599&aid=1485559&group_id=29880 From noreply at sourceforge.net Sat Sep 22 00:44:50 2007 From: noreply at sourceforge.net (SourceForge.net) Date: Fri, 21 Sep 2007 15:44:50 -0700 Subject: [Nagiosplug-devel] [ nagiosplug-Patches-1190900 ] Jabber Plugin Message-ID: Patches item #1190900, was opened at 2005-04-27 06:22 Message generated for change (Comment added) made by dermoth You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=397599&aid=1190900&group_id=29880 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None >Status: Closed >Resolution: None Priority: 5 Private: No Submitted By: C.Doblado (cdoblado) Assigned to: Nobody/Anonymous (nobody) Summary: Jabber Plugin Initial Comment: Plugin for monitoring the status of a Jabber server running in a remote host. Developed in Perl, it receives as argument the server ip address or hostname and optionally, the port where Jabber should be running (the default is 5222). Help and version options are also available. The output may be OK, CRITICAL or UNKNOWN status. ---------------------------------------------------------------------- >Comment By: Thomas Guyot (dermoth) Date: 2007-09-21 18:44 Message: Logged In: YES user_id=375623 Originator: NO check_jabber is already implemented with check_tcp. Please use the mailing list or the bug tracker if you have any issue with it. Thanks. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=397599&aid=1190900&group_id=29880 From noreply at sourceforge.net Sat Sep 22 00:49:33 2007 From: noreply at sourceforge.net (SourceForge.net) Date: Fri, 21 Sep 2007 15:49:33 -0700 Subject: [Nagiosplug-devel] [ nagiosplug-Patches-1251684 ] check_jabber non-SSL fix Message-ID: Patches item #1251684, was opened at 2005-08-04 04:39 Message generated for change (Comment added) made by dermoth You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=397599&aid=1251684&group_id=29880 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None >Status: Closed >Resolution: Fixed Priority: 5 Private: No Submitted By: Peter Pramberger (peterpramb) Assigned to: Nobody/Anonymous (nobody) Summary: check_jabber non-SSL fix Initial Comment: Allow for unencrypted connection to jabber server even with SSL support enabled. ---------------------------------------------------------------------- >Comment By: Thomas Guyot (dermoth) Date: 2007-09-21 18:49 Message: Logged In: YES user_id=375623 Originator: NO Thanks for your submission. check_jabber (check_tcp) have already been changed to default to non-ssl (SSL can be enabled with the -S switch). ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=397599&aid=1251684&group_id=29880 From ton.voon at altinity.com Sat Sep 22 01:17:18 2007 From: ton.voon at altinity.com (Ton Voon) Date: Sat, 22 Sep 2007 00:17:18 +0100 Subject: [Nagiosplug-devel] Negate patch Message-ID: Hi! Just to let you know I've committed a patch to negate by my colleague, Duncan Ferguson. Basically, negate was causing problems when matched with check_nrpe because it was evaluating its arguments like a shell twice. Old negate: ./negate $PWD/check_dummy 0 "a space separated value" OK: a New negate: ./negate $PWD/check_dummy 0 "a space separated value" OK: a space separated value I think this also helps with some of the reported problems combining check_http with negate. This works like the time command does now by considering the input parameters as an array and passing this array to execve. Also, the runcmd.c file has been re-implemented as a utils_cmd.c file so that we can run libtap tests against it. There's a warning though: existing negate commands might not work properly. Also, we enforce the full path to find the command to execute. Ton http://www.altinity.com T: +44 (0)870 787 9243 F: +44 (0)845 280 1725 Skype: tonvoon From dermoth at aei.ca Sat Sep 22 05:10:01 2007 From: dermoth at aei.ca (Thomas Guyot-Sionnest) Date: Fri, 21 Sep 2007 23:10:01 -0400 Subject: [Nagiosplug-devel] Negate patch In-Reply-To: References: Message-ID: <46F48789.3080306@aei.ca> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 21/09/07 07:17 PM, Ton Voon wrote: > Hi! > > Just to let you know I've committed a patch to negate by my > colleague, Duncan Ferguson. > > Basically, negate was causing problems when matched with check_nrpe > because it was evaluating its arguments like a shell twice. Awesome! I didn't applied Andrea's patch for mapping states in the past mostly because of this issue. It works like a charm now! Since Andrea's patch was all messed up (looks like diff got confused on it) and I didn't have the original code I mostly rewritten it with some fixes I already had in mind. Your already-written tests passed perfectly on the first run :) Also I took the liberty of re-using one of the example that explained to use double-quotes to retain spaces... Now anything works: single, double quotes, even backslash! It's all in SVN now. - -- Thomas -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFG9IeJ6dZ+Kt5BchYRAm9jAJ4lsE2WG7o1sZ37yZpcRYlS4PQJYgCghCGO BAfsz+LevxjAtZwu5WQjmOs= =lgas -----END PGP SIGNATURE----- From seanius at seanius.net Sat Sep 22 16:59:35 2007 From: seanius at seanius.net (sean finney) Date: Sat, 22 Sep 2007 16:59:35 +0200 Subject: [Nagiosplug-devel] check_disk plugin fails on 80 TB filesystem In-Reply-To: <46F42E43.2030507@warnerbros.com> References: <46F42E43.2030507@warnerbros.com> Message-ID: <200709221659.38549.seanius@seanius.net> On Friday 21 September 2007 10:49:07 pm Alan Hagge wrote: > > If yes, can df display these sizes without problems? > > Yes, it is (RHEL4). And yes, df can display sizes without problems: > > [root at backup ~]# df /sans/hpsans10 > Filesystem 1K-blocks Used Available Use% Mounted on > /dev/cvfsctl4_hpsans10 > 17178804224 11927464768 5251339456 70% /sans/hpsans10 > > [root at backup ~]# df /sans/hpfata07 > Filesystem 1K-blocks Used Available Use% Mounted on > /dev/cvfsctl1_hpsans7 > 85854740480 67022606640 18832133840 79% /sans/hpfata07 > > [root at backup ~]# df -h /sans/hpfata07 > Filesystem Size Used Avail Use% Mounted on > /dev/cvfsctl1_hpsans7 > 80T 63T 18T 79% /sans/hpfata07 i'm going to go out on a limb and guess that this is a 32-bit system, or that the plugins are at least 32-bit binaries compiled on a 32-bit system regardless of the architecture of the host. if that's the case, there are various if this is true, then i think you should be able to fix this problem by appending the output of "getconf LFS_CFLAGS" to the CFLAGS used to compile. usually this is something like -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64. ./configure CFLAGS=`getconf LFS_CFLAGS` then, hopefully, assuming taht we've programmed this plugin correctly using the various foo_t's instead of ints, it ought to work. maybe we should make CFLAGS include this (output of getconf LFS_CFLAGS) by default, or provide a configure switch if that's the case? sean -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part. URL: From seanius at seanius.net Sat Sep 22 17:06:37 2007 From: seanius at seanius.net (sean finney) Date: Sat, 22 Sep 2007 17:06:37 +0200 Subject: [Nagiosplug-devel] check_disk plugin fails on 80 TB filesystem In-Reply-To: <200709221659.38549.seanius@seanius.net> References: <46F42E43.2030507@warnerbros.com> <200709221659.38549.seanius@seanius.net> Message-ID: <200709221706.38192.seanius@seanius.net> heya, two quick amendments: On Saturday 22 September 2007 04:59:35 pm sean finney wrote: > regardless of the architecture of the host. if that's the case, there are > various ...foo_t objects that have different sizes depending on the compiler flags and host OS. > > ./configure CFLAGS=`getconf LFS_CFLAGS` ./configure CFLAGS="`getconf LFS_CFLAGS`" you'll probably need double quotes on that... -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part. URL: From dermoth at aei.ca Sat Sep 22 17:59:42 2007 From: dermoth at aei.ca (Thomas Guyot-Sionnest) Date: Sat, 22 Sep 2007 11:59:42 -0400 Subject: [Nagiosplug-devel] check_disk support for large filesystems (was: Re: check_disk plugin fails on 80 TB filesystem) In-Reply-To: <200709221706.38192.seanius@seanius.net> References: <46F42E43.2030507@warnerbros.com> <200709221659.38549.seanius@seanius.net> <200709221706.38192.seanius@seanius.net> Message-ID: <46F53BEE.8000409@aei.ca> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 22/09/07 11:06 AM, sean finney wrote: > heya, > > two quick amendments: > > On Saturday 22 September 2007 04:59:35 pm sean finney wrote: >> regardless of the architecture of the host. if that's the case, there are >> various > > ...foo_t objects that have different sizes depending on the compiler flags and > host OS. > >> ./configure CFLAGS=`getconf LFS_CFLAGS` > > ./configure CFLAGS="`getconf LFS_CFLAGS`" > > you'll probably need double quotes on that... Shouldn't we add it by default? Or maybe as a compiler option (if it could break something). We could possibly add a line in check_disk - --help and --verbose that indicates if large file system support is enabled too... Thomas -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFG9Tvt6dZ+Kt5BchYRAoXJAKCV50BHGCh+S39NAV9+CWbP8sWFGQCffHw8 KtTnBlV0yq74z+YbG0GGn2A= =4JyA -----END PGP SIGNATURE----- From dermoth at aei.ca Sun Sep 23 02:50:46 2007 From: dermoth at aei.ca (Thomas Guyot-Sionnest) Date: Sat, 22 Sep 2007 20:50:46 -0400 Subject: [Nagiosplug-devel] check_sql Perl plugin (was Re: Nagios::Plugin perl module integrated into SVN]) Message-ID: <46F5B866.2070602@aei.ca> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I put more work into check_sql (formerly check_mssql). The additions are numerous: - - Can work as check_mysql or check_mssql (symlink). check_sql has an additional parameter to define the Perl driver to use. - - Query can be specified - - Expect string can be specified - - Expect string can be a Perl regexp - - Support thresholds on numeric results - - Support custom labels - - Support performance data on numeric results (using LABEL,UOM label format) - - Support printing the result in the status line - - Support database selection Technically speaking the feature of contrib/check_mssql.sh can be done with this new plugin by using a server-side stored procedure. Anyone calling himself a MSSQL DBA should be able to write one. Ton, I haven't looked much into what needs to be done to include it in Nagios-plugin. If you have a good idea of what's required (apart "use lib [...]" and symlinks) and want to get in in the current state, you can go ahead :). I'll have to write a test script as well (no sure how to include the new parameters without breaking the tinderbox either)... Attatched: 203ca7bce66d0fcfcac79daade579c2a check_sql.pl - -- Thomas - -------- Original Message -------- Ton Voon wrote: > On 16 Sep 2007, at 06:53, Thomas Guyot-Sionnest wrote: > >> On a side note I just written a Perl plugin for checking M$ SQL >> databases (attached). It fully uses N::P, including thresholds and >> performance data (and it's awesome how easy it is now!). Strangely >> right >> after that I noticed there is a bash check_mssql in /contrib so I >> thought maybe we could include mine as a replacement. I believe it's >> also a good example of a N::P plugin. > > I'd definitely want an example plugin to include. check_stuff.pl was a good source of inspiration for me, though check_mssql is a bit more useful :) > I've had a quick look through yours (as much as I can without a mssql > server) and it looks good. I notice that the contrib version has It would certainly work on any database if you change the DB driver and specify the right port. That could be useful for testing (I don't have any M$SQL db at home either). > number of users in the output - could that be added (don't worry > about thresholds for that yet)? Then we can remove the contrib version. I could possibly. I'll have to look around or test since the method used seems a bit special. This check script query "select loginame from sysprocesses where spid > $spid order by loginame asc" (where $spid varies between version 7 and 2000, how about 2005?), filter out a bunch of lines and count the rest. However in all honesty I think this kind of check is flaky. I was rather thinking of a pair of options to override the query and check the result (optionnal), and another pair to set a label (optionnal) and print the result. I think that would benefit more people and DBAs can always create SPROCs to do the dirty work. > Also, if you want it distributed in the core distribution, could you > set the copyright as Nagios Plugins Development Team (you can list I have no problem with that. Thomas -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFG9bhm6dZ+Kt5BchYRAtTXAJ9MfsI5sZWcq3ll7ukxsYB3TVhfiQCg0N59 xaK/ZPJB7z7agvYpkfmnj1M= =ObCY -----END PGP SIGNATURE----- -------------- next part -------------- A non-text attachment was scrubbed... Name: check_sql.pl Type: application/x-perl Size: 9371 bytes Desc: not available URL: From dermoth at aei.ca Sun Sep 23 03:01:08 2007 From: dermoth at aei.ca (Thomas Guyot-Sionnest) Date: Sat, 22 Sep 2007 21:01:08 -0400 Subject: [Nagiosplug-devel] N::P not exporting max_state? Message-ID: <46F5BAD4.3040004@aei.ca> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I think N::P should export max_state, which would avoid having to load N::P::Functions to use that function. Any objections I commit the following patch? (Please review as I have very little knowledge of Perl module programming). Thomas -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFG9brU6dZ+Kt5BchYRAsm5AJ9p8/kNjYXPOhd5ot7a0biA3HFljgCg8WPj zYQCbH0IGISS6ZXS7v1n2Zo= =rc3d -----END PGP SIGNATURE----- -------------- next part -------------- A non-text attachment was scrubbed... Name: N::P_export_max_state.patch Type: text/x-patch Size: 1431 bytes Desc: not available URL: From gavin at openfusion.com.au Sun Sep 23 05:15:29 2007 From: gavin at openfusion.com.au (Gavin Carr) Date: Sun, 23 Sep 2007 13:15:29 +1000 Subject: [Nagiosplug-devel] N::P not exporting max_state? In-Reply-To: <46F5BAD4.3040004@aei.ca> References: <46F5BAD4.3040004@aei.ca> Message-ID: <20070923031529.GB3311@openfusion.com.au> On Sat, Sep 22, 2007 at 09:01:08PM -0400, Thomas Guyot-Sionnest wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > I think N::P should export max_state, which would avoid having to load > N::P::Functions to use that function. Any objections I commit the > following patch? (Please review as I have very little knowledge of Perl > module programming). No, it shouldn't. N::P is an OO-interface. You should use N::P::Functions directly if you want to get it imported, and doing so is fine. The docs should probably be more explicit about that. Cheers, Gavin From dermoth at aei.ca Sun Sep 23 08:02:59 2007 From: dermoth at aei.ca (Thomas Guyot-Sionnest) Date: Sun, 23 Sep 2007 02:02:59 -0400 Subject: [Nagiosplug-devel] N::P not exporting max_state? In-Reply-To: <20070923031529.GB3311@openfusion.com.au> References: <46F5BAD4.3040004@aei.ca> <20070923031529.GB3311@openfusion.com.au> Message-ID: <46F60193.5040203@aei.ca> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 22/09/07 11:15 PM, Gavin Carr wrote: > On Sat, Sep 22, 2007 at 09:01:08PM -0400, Thomas Guyot-Sionnest wrote: >> >> I think N::P should export max_state, which would avoid having to load >> N::P::Functions to use that function. Any objections I commit the >> following patch? (Please review as I have very little knowledge of Perl >> module programming). > > No, it shouldn't. N::P is an OO-interface. You should use N::P::Functions > directly if you want to get it imported, and doing so is fine. > > The docs should probably be more explicit about that. Then what about a warper function only, so we could do $np->max_state? Most of the functions needed for any type of plugins are provided trough N::P already... Correct me if I'm wrong, but I think it would be sense to make all of them available trough it... Thomas -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFG9gGS6dZ+Kt5BchYRAr2dAKDJ3w2U8b1F8BxK54v3lnaVgHcdVQCglVuK EORRPh+B1o0itwUSYNkJRDg= =8lIN -----END PGP SIGNATURE----- From dermoth at aei.ca Sun Sep 23 10:54:13 2007 From: dermoth at aei.ca (Thomas Guyot-Sionnest) Date: Sun, 23 Sep 2007 04:54:13 -0400 Subject: [Nagiosplug-devel] check_sql Perl plugin (was Re: Nagios::Plugin perl module integrated into SVN]) In-Reply-To: <46F5B866.2070602@aei.ca> References: <46F5B866.2070602@aei.ca> Message-ID: <46F629B5.3010802@aei.ca> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 22/09/07 08:50 PM, Thomas Guyot-Sionnest wrote: > > Ton, I haven't looked much into what needs to be done to include it in > Nagios-plugin. If you have a good idea of what's required (apart "use > lib [...]" and symlinks) and want to get in in the current state, you > can go ahead :). I'll have to write a test script as well (no sure how > to include the new parameters without breaking the tinderbox either)... I wrote the test script. Also fixed two things: - - I shipped the wrong plug-in with a patched N::P (won't run, and patched max_state wasn't working properly anyway). - - Connection string used Sybase's server= instead of host=. With MySQL server was ignored and used local pipe. Thomas -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFG9im16dZ+Kt5BchYRAudOAKDWtzOc7PTuMykmr5xHVoOTKgaNeQCgrDuW 23ofIR9QMgtM6azdwbW9bdA= =bmzw -----END PGP SIGNATURE----- -------------- next part -------------- A non-text attachment was scrubbed... Name: check_sql.t Type: text/troff Size: 4321 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: check_sql.pl Type: application/x-perl Size: 9605 bytes Desc: not available URL: From noreply at sourceforge.net Sun Sep 23 13:15:29 2007 From: noreply at sourceforge.net (SourceForge.net) Date: Sun, 23 Sep 2007 04:15:29 -0700 Subject: [Nagiosplug-devel] [ nagiosplug-Bugs-1218438 ] check_radius.c: In function `main': Message-ID: Bugs item #1218438, was opened at 2005-06-10 21:34 Message generated for change (Comment added) made by psychotrahe You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=397597&aid=1218438&group_id=29880 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Compilation Group: None >Status: Closed Resolution: None Priority: 5 Private: No Submitted By: S?bastien Guay (sebasguay) Assigned to: M. Sean Finney (seanius) Summary: check_radius.c: In function `main': Initial Comment: When trying to compile on slackware I got the following check_radius.c: In function `main': check_radius.c:126: error: too few arguments to function `rc_avpair_add' check_radius.c:127: error: too few arguments to function `rc_avpair_add' check_radius.c:128: error: too few arguments to function `rc_avpair_add' check_radius.c:129: error: too few arguments to function `rc_avpair_add' check_radius.c:139: error: too few arguments to function `rc_avpair_add' check_radius.c:145: error: too few arguments to function `rc_send_server' make[2]: *** [check_radius.o] Error 1 make[2]: Leaving directory `/usr/local/src/nagios-plugins-1.4/plugins' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/usr/local/src/nagios-plugins-1.4' make: *** [all] Error 2 I uninstalled the package ppp-2.4.2-i486-2 and redo a make and all was fine. After I reinstalled ppp-2.4.2-i486-2. ppp-2.4.2-i486-2 has a file radiusclient.h. S?bas ---------------------------------------------------------------------- >Comment By: Matthias Eble (psychotrahe) Date: 2007-09-23 13:15 Message: Logged In: YES user_id=1694341 Originator: NO I committed the changes as you proposed. Nearly everything is implemented as defines, now. Please check if everything works fine using the old library. But I don't think there will be a problem. The plugin has some strange option parsing. This should be changed imo. if (argc == 9) causes positional parameter parsing. Nobody expects that. It's a mess for end users. Thanks for your input, Holger Matthias ---------------------------------------------------------------------- Comment By: Holger Weiss (hweiss) Date: 2007-09-15 16:56 Message: Logged In: YES user_id=759506 Originator: NO JFTR (as we chattet on this issue via IRC already): IMO both solutions are just fine, though I'd prefer wrapper functions over #ifdefs. Most of the wrapper functions could actually be replaced by simple macros, but I don't really care. Thanks, Matthias! Please commit :-) Holger ---------------------------------------------------------------------- Comment By: Matthias Eble (psychotrahe) Date: 2007-08-07 23:33 Message: Logged In: YES user_id=1694341 Originator: NO File Added: ifdef.patch ---------------------------------------------------------------------- Comment By: Matthias Eble (psychotrahe) Date: 2007-08-07 23:32 Message: Logged In: YES user_id=1694341 Originator: NO File Added: wrapper.patch ---------------------------------------------------------------------- Comment By: Matthias Eble (psychotrahe) Date: 2007-08-07 23:31 Message: Logged In: YES user_id=1694341 Originator: NO i made two patches for this one. one using ifdefs all the time rc_ functions are called and one using wrapper functions for the majority(the incompatible) functions of radiusclient. Please post your objections about which approach we should check in.. Matthias File Added: configure.patch ---------------------------------------------------------------------- Comment By: Bob Ingraham (rwingraham) Date: 2005-09-22 21:42 Message: Logged In: YES user_id=1086870 Here's the patch to check_radius.c in 'diff -u' format: --- check_radius.c.ORIGINAL 2004-12-25 16:17:44.000000000 -0700 +++ check_radius.c 2005-09-19 16:03:49.000000000 - 0600 @@ -27,7 +27,7 @@ #include "utils.h" #include "netutils.h" -#include +#include int process_arguments (int, char **); void print_help (void); @@ -108,6 +108,7 @@ int result = STATE_UNKNOWN; UINT4 client_id; char *str; + rc_handle *rch = NULL; setlocale (LC_ALL, ""); bindtextdomain (PACKAGE, LOCALEDIR); @@ -117,32 +118,32 @@ usage4 (_("Could not parse arguments")); str = strdup ("dictionary"); - if ((config_file && rc_read_config (config_file)) || - rc_read_dictionary (rc_conf_str (str))) + if ((config_file && (rch = rc_read_config (config_file))) || + rc_read_dictionary (rch, rc_conf_str (rch, str))) die (STATE_UNKNOWN, _("Config file error")); service = PW_AUTHENTICATE_ONLY; - if (!(rc_avpair_add (&data.send_pairs, PW_SERVICE_TYPE, &service, 0) && - rc_avpair_add (&data.send_pairs, PW_USER_NAME, username, 0) && - rc_avpair_add (&data.send_pairs, PW_USER_PASSWORD, password, 0) && - (nasid==NULL || rc_avpair_add (&data.send_pairs, PW_NAS_IDENTIFIER, nasid, 0)))) + if (!(rc_avpair_add (rch, &data.send_pairs, PW_SERVICE_TYPE, &service, -1, 0) && + rc_avpair_add (rch, &data.send_pairs, PW_USER_NAME, username, -1, 0) && + rc_avpair_add (rch, &data.send_pairs, PW_USER_PASSWORD, password, -1, 0) && + (nasid==NULL || rc_avpair_add (rch, &data.send_pairs, PW_NAS_IDENTIFIER, nasid, -1, 0)))) die (STATE_UNKNOWN, _("Out of Memory?")); /* * Fill in NAS-IP-Address */ - if ((client_id = rc_own_ipaddress ()) == 0) + if ((client_id = rc_own_ipaddress (rch)) == 0) return (ERROR_RC); - if (rc_avpair_add (&(data.send_pairs), PW_NAS_IP_ADDRESS, &client_id, 0) == + if (rc_avpair_add (rch, &(data.send_pairs), PW_NAS_IP_ADDRESS, &client_id, -1, 0) == NULL) return (ERROR_RC); - rc_buildreq (&data, PW_ACCESS_REQUEST, server, port, (int)timeout_interval, + rc_buildreq (rch, &data, PW_ACCESS_REQUEST, server, port, (int)timeout_interval, retries); - result = rc_send_server (&data, msg); + result = rc_send_server (rch, &data, msg); rc_avpair_free (data.send_pairs); if (data.receive_pairs) rc_avpair_free (data.receive_pairs); ---------------------------------------------------------------------- Comment By: Bob Ingraham (rwingraham) Date: 2005-09-22 21:36 Message: Logged In: YES user_id=1086870 I ran into this same problem. The current radiusclient library (radiusclient-ng) has an updated API which requires a "config-file-handle" first argument to most of the API entry points. I've updated check_radius.c to adhere to the new radiusclient- ng API conventions. Assuming that you have this current library installed, then check_radius.c compiles and link cleanly now. I don't see where I can attach the updated check_radius.c file as an upload with this comment... Let me know how I can send it in without opening a new case. Note also that the configure script needs to be updated to check for libradisclient-ng (instead of libradiusclient). Bob ---------------------------------------------------------------------- Comment By: Bradley Hook (coder7) Date: 2005-09-22 19:13 Message: Logged In: YES user_id=903812 Just an update to my previous post. I emailed the distribution maintainer for Slackware, Patrick Volkerding. Here is his response: ---begin quote--- Generally I won't move header files since their location should be up to the upstream maintainer(s), not me. In this case the version of radiusclient is rather old though, and perhaps it's useless to everyone anyway and should simply be removed. You might try writing to them to see if they have an opinion about it, though. Also, even if I were to keep the functional parts of the included radiusclient I could remove the header, .a library, and .so symlink if everyone is using radiusclient-ng to compile against now anyway. Anyway, thanks for the info. I'll ponder a bit whether radiusclient is useless on Slackware. (it is to me, but... :) ---end quote--- ---------------------------------------------------------------------- Comment By: Bradley Hook (coder7) Date: 2005-09-21 20:47 Message: Logged In: YES user_id=903812 Can we get a small note added to the README until a more permanent solution is found? I will submit this to the Slackware people to see if the radiusclient.h is even needed in the ppp package, they might be able to remove it or move it. ---------------------------------------------------------------------- Comment By: M. Sean Finney (seanius) Date: 2005-07-14 13:25 Message: Logged In: YES user_id=226838 hi, thanks for the extra info. i'll try and look more into this in the next couple of weeks, and see if i can do some voodoo in autoconf to determine the correct prototypes and version of radiusclient. ---------------------------------------------------------------------- Comment By: John Warburton (johnwarburton) Date: 2005-07-14 03:05 Message: Logged In: YES user_id=1192023 Hi Guys The problem isn't specific to Slackware. It is anyone that runs with newer versions of the radiusclient library. The REQUIREMENTS file says they can be found at http://www.cityline.net/~lf/radius/ versions radiusclient-0.3.1-1 That website no longer exists, but I have tracked down the developer to http://developer.berlios.de/projects/radiusclient-ng/ I was getting the same compile time errors on Solaris 8 with radiusclient-0.4.9 as S?bastien. I downloaded an earlier client library - radiusclient-0.3.3, which compiled, but I have no idea on configuring, so doesn't seem to work. It seems to me the radius client library has moved on, but the Nagios plugin hasn't. Since my site has moved to openradius, I will just use a very simple shell script as a plugin to attempt login using the openradius "radclient" program. Regards John ---------------------------------------------------------------------- Comment By: S?bastien Guay (sebasguay) Date: 2005-07-05 20:11 Message: Logged In: YES user_id=265586 Hi Sean, > this looks like a problem with slackware or the slackware > package of ppp then. where is the radiusclient.h provided > by your libradius package (or whatever the slackware > equivalent is that provides radiusclient.h)? The file radiusclient.h is part of the package ppp (or I misunderstood your question?). > i'm not sure why installing ppp would plop an include file > used to build ppp in a compiler accessible directory in the > first place, Not sure either :) > but unless you can provide a convincing reason > why this is a problem with the nagios plugins, i'm going to > close out the bug in a week's time. My goal was not to convince anybody, it was just to let you know that any Slackware user may have a problem to compile nagios plugins if they have the ppp package installed. As I said, the problem was easily solved on my side by uninstalling ppp and re-installing it after. Here's the definition of rc_avpair_add() function in the radiusclient.h file in the ppp package VALUE_PAIR *rc_avpair_add __P((VALUE_PAIR **, int, void *, int, int)); and here's the call of rc_avpair_add in check_radius.c rc_avpair_add (&data.send_pairs, PW_SERVICE_TYPE, &service, 0) I don't know anything about libradius. Do you know what is the *supposed* arguments number for rc_avpair_add()? If it's 4, I can send a bug report to Patrick. The radiusclient.h file is in attach. S?bas ---------------------------------------------------------------------- Comment By: M. Sean Finney (seanius) Date: 2005-06-28 04:06 Message: Logged In: YES user_id=226838 hi sebastien, this looks like a problem with slackware or the slackware package of ppp then. where is the radiusclient.h provided by your libradius package (or whatever the slackware equivalent is that provides radiusclient.h)? i'm not sure why installing ppp would plop an include file used to build ppp in a compiler accessible directory in the first place, but unless you can provide a convincing reason why this is a problem with the nagios plugins, i'm going to close out the bug in a week's time. thanks, sean ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=397597&aid=1218438&group_id=29880 From gavin at openfusion.com.au Sun Sep 23 13:20:02 2007 From: gavin at openfusion.com.au (Gavin Carr) Date: Sun, 23 Sep 2007 21:20:02 +1000 Subject: [Nagiosplug-devel] N::P not exporting max_state? In-Reply-To: <46F60193.5040203@aei.ca> References: <46F5BAD4.3040004@aei.ca> <20070923031529.GB3311@openfusion.com.au> <46F60193.5040203@aei.ca> Message-ID: <20070923112002.GA7547@openfusion.com.au> On Sun, Sep 23, 2007 at 02:02:59AM -0400, Thomas Guyot-Sionnest wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > On 22/09/07 11:15 PM, Gavin Carr wrote: > > On Sat, Sep 22, 2007 at 09:01:08PM -0400, Thomas Guyot-Sionnest wrote: > >> > >> I think N::P should export max_state, which would avoid having to load > >> N::P::Functions to use that function. Any objections I commit the > >> following patch? (Please review as I have very little knowledge of Perl > >> module programming). > > > > No, it shouldn't. N::P is an OO-interface. You should use N::P::Functions > > directly if you want to get it imported, and doing so is fine. > > > > The docs should probably be more explicit about that. > > Then what about a warper function only, so we could do $np->max_state? > > Most of the functions needed for any type of plugins are provided trough > N::P already... Correct me if I'm wrong, but I think it would be sense > to make all of them available trough it... I'm fine with a wrapper function there. Cheers, Gavin From noreply at sourceforge.net Sun Sep 23 14:33:11 2007 From: noreply at sourceforge.net (SourceForge.net) Date: Sun, 23 Sep 2007 05:33:11 -0700 Subject: [Nagiosplug-devel] [ nagiosplug-Patches-1769653 ] check_by_ssh multiline capability Message-ID: Patches item #1769653, was opened at 2007-08-07 22:45 Message generated for change (Comment added) made by psychotrahe You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=397599&aid=1769653&group_id=29880 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Bugfix Group: None >Status: Closed >Resolution: Accepted Priority: 5 Private: No Submitted By: mflacke (mflacke) Assigned to: Nobody/Anonymous (nobody) Summary: check_by_ssh multiline capability Initial Comment: Hi list, being not sure whether this is an enhancement or a bugfix ;-) I attached a small patch against nagios-plugins-trunk-200708071200 which provides multiline capability for check_by_ssh. The existing code prints out only the first line of output while the patch appends all lines. The backward compatibility to Nagios 2.x installations is still given because all additional lines are discarded there. Best regards, Matthias Flacke ---------------------------------------------------------------------- >Comment By: Matthias Eble (psychotrahe) Date: 2007-09-23 14:33 Message: Logged In: YES user_id=1694341 Originator: NO Hi Matthias, thanks for the patch. I checked it in, a couple of minutes ago. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=397599&aid=1769653&group_id=29880 From noreply at sourceforge.net Sun Sep 23 16:57:16 2007 From: noreply at sourceforge.net (SourceForge.net) Date: Sun, 23 Sep 2007 07:57:16 -0700 Subject: [Nagiosplug-devel] [ nagiosplug-Bugs-1218438 ] check_radius.c: In function `main': Message-ID: Bugs item #1218438, was opened at 2005-06-10 15:34 Message generated for change (Comment added) made by dermoth You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=397597&aid=1218438&group_id=29880 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Compilation Group: None Status: Closed >Resolution: Fixed Priority: 5 Private: No Submitted By: S?bastien Guay (sebasguay) Assigned to: M. Sean Finney (seanius) Summary: check_radius.c: In function `main': Initial Comment: When trying to compile on slackware I got the following check_radius.c: In function `main': check_radius.c:126: error: too few arguments to function `rc_avpair_add' check_radius.c:127: error: too few arguments to function `rc_avpair_add' check_radius.c:128: error: too few arguments to function `rc_avpair_add' check_radius.c:129: error: too few arguments to function `rc_avpair_add' check_radius.c:139: error: too few arguments to function `rc_avpair_add' check_radius.c:145: error: too few arguments to function `rc_send_server' make[2]: *** [check_radius.o] Error 1 make[2]: Leaving directory `/usr/local/src/nagios-plugins-1.4/plugins' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/usr/local/src/nagios-plugins-1.4' make: *** [all] Error 2 I uninstalled the package ppp-2.4.2-i486-2 and redo a make and all was fine. After I reinstalled ppp-2.4.2-i486-2. ppp-2.4.2-i486-2 has a file radiusclient.h. S?bas ---------------------------------------------------------------------- >Comment By: Thomas Guyot (dermoth) Date: 2007-09-23 10:57 Message: Logged In: YES user_id=375623 Originator: NO I confirm backward-compatibility with the old radiusclient library On a side note I accidentally noticed it segfaults if the -u parameter is not given (the segfault happens in the library, confirmed on multiple releases dating as far as 1.4.3). You might want to make sure all required parameters are enforced. NB: Changed the resolution to Fixed. ---------------------------------------------------------------------- Comment By: Matthias Eble (psychotrahe) Date: 2007-09-23 07:15 Message: Logged In: YES user_id=1694341 Originator: NO I committed the changes as you proposed. Nearly everything is implemented as defines, now. Please check if everything works fine using the old library. But I don't think there will be a problem. The plugin has some strange option parsing. This should be changed imo. if (argc == 9) causes positional parameter parsing. Nobody expects that. It's a mess for end users. Thanks for your input, Holger Matthias ---------------------------------------------------------------------- Comment By: Holger Weiss (hweiss) Date: 2007-09-15 10:56 Message: Logged In: YES user_id=759506 Originator: NO JFTR (as we chattet on this issue via IRC already): IMO both solutions are just fine, though I'd prefer wrapper functions over #ifdefs. Most of the wrapper functions could actually be replaced by simple macros, but I don't really care. Thanks, Matthias! Please commit :-) Holger ---------------------------------------------------------------------- Comment By: Matthias Eble (psychotrahe) Date: 2007-08-07 17:33 Message: Logged In: YES user_id=1694341 Originator: NO File Added: ifdef.patch ---------------------------------------------------------------------- Comment By: Matthias Eble (psychotrahe) Date: 2007-08-07 17:32 Message: Logged In: YES user_id=1694341 Originator: NO File Added: wrapper.patch ---------------------------------------------------------------------- Comment By: Matthias Eble (psychotrahe) Date: 2007-08-07 17:31 Message: Logged In: YES user_id=1694341 Originator: NO i made two patches for this one. one using ifdefs all the time rc_ functions are called and one using wrapper functions for the majority(the incompatible) functions of radiusclient. Please post your objections about which approach we should check in.. Matthias File Added: configure.patch ---------------------------------------------------------------------- Comment By: Bob Ingraham (rwingraham) Date: 2005-09-22 15:42 Message: Logged In: YES user_id=1086870 Here's the patch to check_radius.c in 'diff -u' format: --- check_radius.c.ORIGINAL 2004-12-25 16:17:44.000000000 -0700 +++ check_radius.c 2005-09-19 16:03:49.000000000 - 0600 @@ -27,7 +27,7 @@ #include "utils.h" #include "netutils.h" -#include +#include int process_arguments (int, char **); void print_help (void); @@ -108,6 +108,7 @@ int result = STATE_UNKNOWN; UINT4 client_id; char *str; + rc_handle *rch = NULL; setlocale (LC_ALL, ""); bindtextdomain (PACKAGE, LOCALEDIR); @@ -117,32 +118,32 @@ usage4 (_("Could not parse arguments")); str = strdup ("dictionary"); - if ((config_file && rc_read_config (config_file)) || - rc_read_dictionary (rc_conf_str (str))) + if ((config_file && (rch = rc_read_config (config_file))) || + rc_read_dictionary (rch, rc_conf_str (rch, str))) die (STATE_UNKNOWN, _("Config file error")); service = PW_AUTHENTICATE_ONLY; - if (!(rc_avpair_add (&data.send_pairs, PW_SERVICE_TYPE, &service, 0) && - rc_avpair_add (&data.send_pairs, PW_USER_NAME, username, 0) && - rc_avpair_add (&data.send_pairs, PW_USER_PASSWORD, password, 0) && - (nasid==NULL || rc_avpair_add (&data.send_pairs, PW_NAS_IDENTIFIER, nasid, 0)))) + if (!(rc_avpair_add (rch, &data.send_pairs, PW_SERVICE_TYPE, &service, -1, 0) && + rc_avpair_add (rch, &data.send_pairs, PW_USER_NAME, username, -1, 0) && + rc_avpair_add (rch, &data.send_pairs, PW_USER_PASSWORD, password, -1, 0) && + (nasid==NULL || rc_avpair_add (rch, &data.send_pairs, PW_NAS_IDENTIFIER, nasid, -1, 0)))) die (STATE_UNKNOWN, _("Out of Memory?")); /* * Fill in NAS-IP-Address */ - if ((client_id = rc_own_ipaddress ()) == 0) + if ((client_id = rc_own_ipaddress (rch)) == 0) return (ERROR_RC); - if (rc_avpair_add (&(data.send_pairs), PW_NAS_IP_ADDRESS, &client_id, 0) == + if (rc_avpair_add (rch, &(data.send_pairs), PW_NAS_IP_ADDRESS, &client_id, -1, 0) == NULL) return (ERROR_RC); - rc_buildreq (&data, PW_ACCESS_REQUEST, server, port, (int)timeout_interval, + rc_buildreq (rch, &data, PW_ACCESS_REQUEST, server, port, (int)timeout_interval, retries); - result = rc_send_server (&data, msg); + result = rc_send_server (rch, &data, msg); rc_avpair_free (data.send_pairs); if (data.receive_pairs) rc_avpair_free (data.receive_pairs); ---------------------------------------------------------------------- Comment By: Bob Ingraham (rwingraham) Date: 2005-09-22 15:36 Message: Logged In: YES user_id=1086870 I ran into this same problem. The current radiusclient library (radiusclient-ng) has an updated API which requires a "config-file-handle" first argument to most of the API entry points. I've updated check_radius.c to adhere to the new radiusclient- ng API conventions. Assuming that you have this current library installed, then check_radius.c compiles and link cleanly now. I don't see where I can attach the updated check_radius.c file as an upload with this comment... Let me know how I can send it in without opening a new case. Note also that the configure script needs to be updated to check for libradisclient-ng (instead of libradiusclient). Bob ---------------------------------------------------------------------- Comment By: Bradley Hook (coder7) Date: 2005-09-22 13:13 Message: Logged In: YES user_id=903812 Just an update to my previous post. I emailed the distribution maintainer for Slackware, Patrick Volkerding. Here is his response: ---begin quote--- Generally I won't move header files since their location should be up to the upstream maintainer(s), not me. In this case the version of radiusclient is rather old though, and perhaps it's useless to everyone anyway and should simply be removed. You might try writing to them to see if they have an opinion about it, though. Also, even if I were to keep the functional parts of the included radiusclient I could remove the header, .a library, and .so symlink if everyone is using radiusclient-ng to compile against now anyway. Anyway, thanks for the info. I'll ponder a bit whether radiusclient is useless on Slackware. (it is to me, but... :) ---end quote--- ---------------------------------------------------------------------- Comment By: Bradley Hook (coder7) Date: 2005-09-21 14:47 Message: Logged In: YES user_id=903812 Can we get a small note added to the README until a more permanent solution is found? I will submit this to the Slackware people to see if the radiusclient.h is even needed in the ppp package, they might be able to remove it or move it. ---------------------------------------------------------------------- Comment By: M. Sean Finney (seanius) Date: 2005-07-14 07:25 Message: Logged In: YES user_id=226838 hi, thanks for the extra info. i'll try and look more into this in the next couple of weeks, and see if i can do some voodoo in autoconf to determine the correct prototypes and version of radiusclient. ---------------------------------------------------------------------- Comment By: John Warburton (johnwarburton) Date: 2005-07-13 21:05 Message: Logged In: YES user_id=1192023 Hi Guys The problem isn't specific to Slackware. It is anyone that runs with newer versions of the radiusclient library. The REQUIREMENTS file says they can be found at http://www.cityline.net/~lf/radius/ versions radiusclient-0.3.1-1 That website no longer exists, but I have tracked down the developer to http://developer.berlios.de/projects/radiusclient-ng/ I was getting the same compile time errors on Solaris 8 with radiusclient-0.4.9 as S?bastien. I downloaded an earlier client library - radiusclient-0.3.3, which compiled, but I have no idea on configuring, so doesn't seem to work. It seems to me the radius client library has moved on, but the Nagios plugin hasn't. Since my site has moved to openradius, I will just use a very simple shell script as a plugin to attempt login using the openradius "radclient" program. Regards John ---------------------------------------------------------------------- Comment By: S?bastien Guay (sebasguay) Date: 2005-07-05 14:11 Message: Logged In: YES user_id=265586 Hi Sean, > this looks like a problem with slackware or the slackware > package of ppp then. where is the radiusclient.h provided > by your libradius package (or whatever the slackware > equivalent is that provides radiusclient.h)? The file radiusclient.h is part of the package ppp (or I misunderstood your question?). > i'm not sure why installing ppp would plop an include file > used to build ppp in a compiler accessible directory in the > first place, Not sure either :) > but unless you can provide a convincing reason > why this is a problem with the nagios plugins, i'm going to > close out the bug in a week's time. My goal was not to convince anybody, it was just to let you know that any Slackware user may have a problem to compile nagios plugins if they have the ppp package installed. As I said, the problem was easily solved on my side by uninstalling ppp and re-installing it after. Here's the definition of rc_avpair_add() function in the radiusclient.h file in the ppp package VALUE_PAIR *rc_avpair_add __P((VALUE_PAIR **, int, void *, int, int)); and here's the call of rc_avpair_add in check_radius.c rc_avpair_add (&data.send_pairs, PW_SERVICE_TYPE, &service, 0) I don't know anything about libradius. Do you know what is the *supposed* arguments number for rc_avpair_add()? If it's 4, I can send a bug report to Patrick. The radiusclient.h file is in attach. S?bas ---------------------------------------------------------------------- Comment By: M. Sean Finney (seanius) Date: 2005-06-27 22:06 Message: Logged In: YES user_id=226838 hi sebastien, this looks like a problem with slackware or the slackware package of ppp then. where is the radiusclient.h provided by your libradius package (or whatever the slackware equivalent is that provides radiusclient.h)? i'm not sure why installing ppp would plop an include file used to build ppp in a compiler accessible directory in the first place, but unless you can provide a convincing reason why this is a problem with the nagios plugins, i'm going to close out the bug in a week's time. thanks, sean ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=397597&aid=1218438&group_id=29880 From rouilj at cs.umb.edu Sun Sep 23 18:17:40 2007 From: rouilj at cs.umb.edu (John P. Rouillard) Date: Sun, 23 Sep 2007 12:17:40 -0400 Subject: [Nagiosplug-devel] [ nagiosplug-Patches-1769653 ] check_by_ssh multiline capability In-Reply-To: Your message of "Sun, 23 Sep 2007 05:33:11 PDT." Message-ID: <200709231617.l8NGHjgX015779@mx1.cs.umb.edu> In message , "SourceForge.net" writes: >Submitted By: mflacke (mflacke) >Assigned to: Nobody/Anonymous (nobody) >Summary: check_by_ssh multiline capability >[...] >being not sure whether this is an enhancement or a bugfix ;-) I >attached a small patch against nagios-plugins-trunk-200708071200 which >provides multiline capability for check_by_ssh. > >The existing code prints out only the first line of output while the >patch appends all lines. > >The backward compatibility to Nagios 2.x installations is still given >because all additional lines are discarded there. Actually they aren't supposed to be. You are supposed to be able to specify multiple commands for check_by_ssh to run. The first line is returned as output for the check_by_ssh command and the subsequent output is supposed to be sent to the nagios core as as passive commands to set the status of the additional services check_by_ssh is supposed to check. >>Comment By: Matthias Eble (psychotrahe) >Date: 2007-09-23 14:33 > >Message: >Logged In: YES >user_id=1694341 >Originator: NO > >Hi Matthias, >thanks for the patch. I checked it in, a couple of minutes ago. So does this mean that there is no chance to fix check_by_ssh to run multiple commands (which is really useful for reducing load)? -- rouilj John Rouillard =========================================================================== My employers don't acknowledge my existence much less my opinions. From Matthias.Flacke at gmx.de Sun Sep 23 19:07:38 2007 From: Matthias.Flacke at gmx.de (Matthias Flacke) Date: Sun, 23 Sep 2007 19:07:38 +0200 Subject: [Nagiosplug-devel] [ nagiosplug-Patches-1769653 ] check_by_ssh multiline capability In-Reply-To: <200709231617.l8NGHjgX015779@mx1.cs.umb.edu> References: <200709231617.l8NGHjgX015779@mx1.cs.umb.edu> Message-ID: <46F69D5A.3020109@gmx.de> Hello John, John P. Rouillard wrote: > In message , > "SourceForge.net" writes: >> Submitted By: mflacke (mflacke) >> Assigned to: Nobody/Anonymous (nobody) >> Summary: check_by_ssh multiline capability >> [...] >> being not sure whether this is an enhancement or a bugfix ;-) I >> attached a small patch against nagios-plugins-trunk-200708071200 which >> provides multiline capability for check_by_ssh. >> >> The existing code prints out only the first line of output while the >> patch appends all lines. >> >> The backward compatibility to Nagios 2.x installations is still given >> because all additional lines are discarded there. > > Actually they aren't supposed to be. You are supposed to be able to > specify multiple commands for check_by_ssh to run. The first line is > returned as output for the check_by_ssh command and the subsequent > output is supposed to be sent to the nagios core as as passive > commands to set the status of the additional services check_by_ssh is > supposed to check. The passive 'trick' is untouched by the patch. The additional multiline transport is only working for _active_ commands: 109 /* this is simple if we're not supposed to be passive. 110 * Wrap up quickly and keep the tricks below */ **111 if(!passive) {** 112 if (chld_out.lines > skip_stdout) 113 for (i = skip_stdout; i < chld_out.lines; i++) 114 puts (chld_out.line[i]); 115 else 116 printf (_("%s - check_by_ssh: Remote command '%s' returned status %d\n"), 117 state_text(result), remotecmd, result); 118 return result; /* return error status from remote command */ 119 } The passive stuff is following and behaves like you know it. >>> Comment By: Matthias Eble (psychotrahe) >> Date: 2007-09-23 14:33 >> >> Message: >> Logged In: YES >> user_id=1694341 >> Originator: NO >> >> Hi Matthias, >> thanks for the patch. I checked it in, a couple of minutes ago. > > So does this mean that there is no chance to fix check_by_ssh to run > multiple commands (which is really useful for reducing load)? For that I'm with you - in fact my patch should just provide the means to run multiline plugins in Nagios 3.x in order to save resources. -Matthias > > -- rouilj > John Rouillard > =========================================================================== > My employers don't acknowledge my existence much less my opinions. > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________________ > Nagios Plugin Development Mailing List Nagiosplug-devel at lists.sourceforge.net > Unsubscribe at https://lists.sourceforge.net/lists/listinfo/nagiosplug-devel > ::: Please include plugins version (-v) and OS when reporting any issue. > ::: Messages without supporting info will risk being sent to /dev/null > > -- http://my-plugin.de/check_multi From noreply at sourceforge.net Mon Sep 24 02:44:16 2007 From: noreply at sourceforge.net (SourceForge.net) Date: Sun, 23 Sep 2007 17:44:16 -0700 Subject: [Nagiosplug-devel] [ nagiosplug-Bugs-1218438 ] check_radius.c: In function `main': Message-ID: Bugs item #1218438, was opened at 2005-06-10 21:34 Message generated for change (Comment added) made by hweiss You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=397597&aid=1218438&group_id=29880 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Compilation Group: None Status: Closed Resolution: Fixed Priority: 5 Private: No Submitted By: S?bastien Guay (sebasguay) Assigned to: M. Sean Finney (seanius) Summary: check_radius.c: In function `main': Initial Comment: When trying to compile on slackware I got the following check_radius.c: In function `main': check_radius.c:126: error: too few arguments to function `rc_avpair_add' check_radius.c:127: error: too few arguments to function `rc_avpair_add' check_radius.c:128: error: too few arguments to function `rc_avpair_add' check_radius.c:129: error: too few arguments to function `rc_avpair_add' check_radius.c:139: error: too few arguments to function `rc_avpair_add' check_radius.c:145: error: too few arguments to function `rc_send_server' make[2]: *** [check_radius.o] Error 1 make[2]: Leaving directory `/usr/local/src/nagios-plugins-1.4/plugins' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/usr/local/src/nagios-plugins-1.4' make: *** [all] Error 2 I uninstalled the package ppp-2.4.2-i486-2 and redo a make and all was fine. After I reinstalled ppp-2.4.2-i486-2. ppp-2.4.2-i486-2 has a file radiusclient.h. S?bas ---------------------------------------------------------------------- >Comment By: Holger Weiss (hweiss) Date: 2007-09-24 02:44 Message: Logged In: YES user_id=759506 Originator: NO Works fine for me with the old radiusclient library, too. Thanks a lot, Matthias! ---------------------------------------------------------------------- Comment By: Thomas Guyot (dermoth) Date: 2007-09-23 16:57 Message: Logged In: YES user_id=375623 Originator: NO I confirm backward-compatibility with the old radiusclient library On a side note I accidentally noticed it segfaults if the -u parameter is not given (the segfault happens in the library, confirmed on multiple releases dating as far as 1.4.3). You might want to make sure all required parameters are enforced. NB: Changed the resolution to Fixed. ---------------------------------------------------------------------- Comment By: Matthias Eble (psychotrahe) Date: 2007-09-23 13:15 Message: Logged In: YES user_id=1694341 Originator: NO I committed the changes as you proposed. Nearly everything is implemented as defines, now. Please check if everything works fine using the old library. But I don't think there will be a problem. The plugin has some strange option parsing. This should be changed imo. if (argc == 9) causes positional parameter parsing. Nobody expects that. It's a mess for end users. Thanks for your input, Holger Matthias ---------------------------------------------------------------------- Comment By: Holger Weiss (hweiss) Date: 2007-09-15 16:56 Message: Logged In: YES user_id=759506 Originator: NO JFTR (as we chattet on this issue via IRC already): IMO both solutions are just fine, though I'd prefer wrapper functions over #ifdefs. Most of the wrapper functions could actually be replaced by simple macros, but I don't really care. Thanks, Matthias! Please commit :-) Holger ---------------------------------------------------------------------- Comment By: Matthias Eble (psychotrahe) Date: 2007-08-07 23:33 Message: Logged In: YES user_id=1694341 Originator: NO File Added: ifdef.patch ---------------------------------------------------------------------- Comment By: Matthias Eble (psychotrahe) Date: 2007-08-07 23:32 Message: Logged In: YES user_id=1694341 Originator: NO File Added: wrapper.patch ---------------------------------------------------------------------- Comment By: Matthias Eble (psychotrahe) Date: 2007-08-07 23:31 Message: Logged In: YES user_id=1694341 Originator: NO i made two patches for this one. one using ifdefs all the time rc_ functions are called and one using wrapper functions for the majority(the incompatible) functions of radiusclient. Please post your objections about which approach we should check in.. Matthias File Added: configure.patch ---------------------------------------------------------------------- Comment By: Bob Ingraham (rwingraham) Date: 2005-09-22 21:42 Message: Logged In: YES user_id=1086870 Here's the patch to check_radius.c in 'diff -u' format: --- check_radius.c.ORIGINAL 2004-12-25 16:17:44.000000000 -0700 +++ check_radius.c 2005-09-19 16:03:49.000000000 - 0600 @@ -27,7 +27,7 @@ #include "utils.h" #include "netutils.h" -#include +#include int process_arguments (int, char **); void print_help (void); @@ -108,6 +108,7 @@ int result = STATE_UNKNOWN; UINT4 client_id; char *str; + rc_handle *rch = NULL; setlocale (LC_ALL, ""); bindtextdomain (PACKAGE, LOCALEDIR); @@ -117,32 +118,32 @@ usage4 (_("Could not parse arguments")); str = strdup ("dictionary"); - if ((config_file && rc_read_config (config_file)) || - rc_read_dictionary (rc_conf_str (str))) + if ((config_file && (rch = rc_read_config (config_file))) || + rc_read_dictionary (rch, rc_conf_str (rch, str))) die (STATE_UNKNOWN, _("Config file error")); service = PW_AUTHENTICATE_ONLY; - if (!(rc_avpair_add (&data.send_pairs, PW_SERVICE_TYPE, &service, 0) && - rc_avpair_add (&data.send_pairs, PW_USER_NAME, username, 0) && - rc_avpair_add (&data.send_pairs, PW_USER_PASSWORD, password, 0) && - (nasid==NULL || rc_avpair_add (&data.send_pairs, PW_NAS_IDENTIFIER, nasid, 0)))) + if (!(rc_avpair_add (rch, &data.send_pairs, PW_SERVICE_TYPE, &service, -1, 0) && + rc_avpair_add (rch, &data.send_pairs, PW_USER_NAME, username, -1, 0) && + rc_avpair_add (rch, &data.send_pairs, PW_USER_PASSWORD, password, -1, 0) && + (nasid==NULL || rc_avpair_add (rch, &data.send_pairs, PW_NAS_IDENTIFIER, nasid, -1, 0)))) die (STATE_UNKNOWN, _("Out of Memory?")); /* * Fill in NAS-IP-Address */ - if ((client_id = rc_own_ipaddress ()) == 0) + if ((client_id = rc_own_ipaddress (rch)) == 0) return (ERROR_RC); - if (rc_avpair_add (&(data.send_pairs), PW_NAS_IP_ADDRESS, &client_id, 0) == + if (rc_avpair_add (rch, &(data.send_pairs), PW_NAS_IP_ADDRESS, &client_id, -1, 0) == NULL) return (ERROR_RC); - rc_buildreq (&data, PW_ACCESS_REQUEST, server, port, (int)timeout_interval, + rc_buildreq (rch, &data, PW_ACCESS_REQUEST, server, port, (int)timeout_interval, retries); - result = rc_send_server (&data, msg); + result = rc_send_server (rch, &data, msg); rc_avpair_free (data.send_pairs); if (data.receive_pairs) rc_avpair_free (data.receive_pairs); ---------------------------------------------------------------------- Comment By: Bob Ingraham (rwingraham) Date: 2005-09-22 21:36 Message: Logged In: YES user_id=1086870 I ran into this same problem. The current radiusclient library (radiusclient-ng) has an updated API which requires a "config-file-handle" first argument to most of the API entry points. I've updated check_radius.c to adhere to the new radiusclient- ng API conventions. Assuming that you have this current library installed, then check_radius.c compiles and link cleanly now. I don't see where I can attach the updated check_radius.c file as an upload with this comment... Let me know how I can send it in without opening a new case. Note also that the configure script needs to be updated to check for libradisclient-ng (instead of libradiusclient). Bob ---------------------------------------------------------------------- Comment By: Bradley Hook (coder7) Date: 2005-09-22 19:13 Message: Logged In: YES user_id=903812 Just an update to my previous post. I emailed the distribution maintainer for Slackware, Patrick Volkerding. Here is his response: ---begin quote--- Generally I won't move header files since their location should be up to the upstream maintainer(s), not me. In this case the version of radiusclient is rather old though, and perhaps it's useless to everyone anyway and should simply be removed. You might try writing to them to see if they have an opinion about it, though. Also, even if I were to keep the functional parts of the included radiusclient I could remove the header, .a library, and .so symlink if everyone is using radiusclient-ng to compile against now anyway. Anyway, thanks for the info. I'll ponder a bit whether radiusclient is useless on Slackware. (it is to me, but... :) ---end quote--- ---------------------------------------------------------------------- Comment By: Bradley Hook (coder7) Date: 2005-09-21 20:47 Message: Logged In: YES user_id=903812 Can we get a small note added to the README until a more permanent solution is found? I will submit this to the Slackware people to see if the radiusclient.h is even needed in the ppp package, they might be able to remove it or move it. ---------------------------------------------------------------------- Comment By: M. Sean Finney (seanius) Date: 2005-07-14 13:25 Message: Logged In: YES user_id=226838 hi, thanks for the extra info. i'll try and look more into this in the next couple of weeks, and see if i can do some voodoo in autoconf to determine the correct prototypes and version of radiusclient. ---------------------------------------------------------------------- Comment By: John Warburton (johnwarburton) Date: 2005-07-14 03:05 Message: Logged In: YES user_id=1192023 Hi Guys The problem isn't specific to Slackware. It is anyone that runs with newer versions of the radiusclient library. The REQUIREMENTS file says they can be found at http://www.cityline.net/~lf/radius/ versions radiusclient-0.3.1-1 That website no longer exists, but I have tracked down the developer to http://developer.berlios.de/projects/radiusclient-ng/ I was getting the same compile time errors on Solaris 8 with radiusclient-0.4.9 as S?bastien. I downloaded an earlier client library - radiusclient-0.3.3, which compiled, but I have no idea on configuring, so doesn't seem to work. It seems to me the radius client library has moved on, but the Nagios plugin hasn't. Since my site has moved to openradius, I will just use a very simple shell script as a plugin to attempt login using the openradius "radclient" program. Regards John ---------------------------------------------------------------------- Comment By: S?bastien Guay (sebasguay) Date: 2005-07-05 20:11 Message: Logged In: YES user_id=265586 Hi Sean, > this looks like a problem with slackware or the slackware > package of ppp then. where is the radiusclient.h provided > by your libradius package (or whatever the slackware > equivalent is that provides radiusclient.h)? The file radiusclient.h is part of the package ppp (or I misunderstood your question?). > i'm not sure why installing ppp would plop an include file > used to build ppp in a compiler accessible directory in the > first place, Not sure either :) > but unless you can provide a convincing reason > why this is a problem with the nagios plugins, i'm going to > close out the bug in a week's time. My goal was not to convince anybody, it was just to let you know that any Slackware user may have a problem to compile nagios plugins if they have the ppp package installed. As I said, the problem was easily solved on my side by uninstalling ppp and re-installing it after. Here's the definition of rc_avpair_add() function in the radiusclient.h file in the ppp package VALUE_PAIR *rc_avpair_add __P((VALUE_PAIR **, int, void *, int, int)); and here's the call of rc_avpair_add in check_radius.c rc_avpair_add (&data.send_pairs, PW_SERVICE_TYPE, &service, 0) I don't know anything about libradius. Do you know what is the *supposed* arguments number for rc_avpair_add()? If it's 4, I can send a bug report to Patrick. The radiusclient.h file is in attach. S?bas ---------------------------------------------------------------------- Comment By: M. Sean Finney (seanius) Date: 2005-06-28 04:06 Message: Logged In: YES user_id=226838 hi sebastien, this looks like a problem with slackware or the slackware package of ppp then. where is the radiusclient.h provided by your libradius package (or whatever the slackware equivalent is that provides radiusclient.h)? i'm not sure why installing ppp would plop an include file used to build ppp in a compiler accessible directory in the first place, but unless you can provide a convincing reason why this is a problem with the nagios plugins, i'm going to close out the bug in a week's time. thanks, sean ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=397597&aid=1218438&group_id=29880 From noreply at sourceforge.net Mon Sep 24 02:50:38 2007 From: noreply at sourceforge.net (SourceForge.net) Date: Sun, 23 Sep 2007 17:50:38 -0700 Subject: [Nagiosplug-devel] [ nagiosplug-Patches-1525363 ] radiusclient-ng vs. check_radius plugin Message-ID: Patches item #1525363, was opened at 2006-07-19 17:19 Message generated for change (Comment added) made by hweiss You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=397599&aid=1525363&group_id=29880 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None >Status: Closed >Resolution: Fixed Priority: 5 Private: No Submitted By: Andy Shevchenko (andy_shev) Assigned to: Holger Weiss (hweiss) Summary: radiusclient-ng vs. check_radius plugin Initial Comment: Hi! I've done to patch the check_radius for compilant to radiusclient-ng. Related stuff you can find at https://bugzilla.redhat.com/bugzilla/ show_bug.cgi?id=199395 Andy. ---------------------------------------------------------------------- >Comment By: Holger Weiss (hweiss) Date: 2007-09-24 02:50 Message: Logged In: YES user_id=759506 Originator: NO Matthias committed a patch which is backward compatible, will be in the next release. Thanks, Holger ---------------------------------------------------------------------- Comment By: Holger Weiss (hweiss) Date: 2007-02-01 20:10 Message: Logged In: YES user_id=759506 Originator: NO This patch isn't backward compatible, as it doesn't allow building check_radius against the original 'radiusclient' library. If you could provide a version of the patch which works with both libraries (by defining appropriate macros via Autoconf), I'd look into committing it. Otherwise, I might have a go at it myself, but that might take some time. BTW, personally, I'd prefer 'libradius' over 'radiusclient[-ng]' (for various reasons). Maybe I'll add support for that one sometime ... Thanks! Holger ---------------------------------------------------------------------- Comment By: Andy Shevchenko (andy_shev) Date: 2006-07-19 17:20 Message: Logged In: YES user_id=448807 Url without cuttings: https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=199395 ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=397599&aid=1525363&group_id=29880 From matthias.eble at mailing.kaufland-informationssysteme.com Mon Sep 24 18:33:03 2007 From: matthias.eble at mailing.kaufland-informationssysteme.com (Matthias Eble) Date: Mon, 24 Sep 2007 18:33:03 +0200 Subject: [Nagiosplug-devel] 1.4.10 Release Message-ID: <46F7E6BF.5090009@mailing.kaufland-informationssysteme.com> Hi All, just want to tell that I committed all my planned changes for 1.4.10. Maybe someone wants to fix option processing in check_radius before releasing. I'd also recommend to change or drop positional argument support for check_radius. It's just too confusing if you ask me. Although it's no showstopper for me. Matthias From Alan.Hagge at warnerbros.com Mon Sep 24 16:32:12 2007 From: Alan.Hagge at warnerbros.com (Alan Hagge) Date: Mon, 24 Sep 2007 07:32:12 -0700 Subject: [Nagiosplug-devel] check_disk plugin fails on 80 TB filesystem In-Reply-To: <200709221659.38549.seanius@seanius.net> References: <46F42E43.2030507@warnerbros.com> <200709221659.38549.seanius@seanius.net> Message-ID: <46F7CA6C.6040108@warnerbros.com> Thomas Guyot-Sionnest wrote: > From strace I can see that the same statfs call that works with the > 64bit library returns -1 EOVERFLOW (Value too large for defined data > type) on the 32bit libs, though I have no idea if it's the same kind of > issue. > Yes, my issue is the same. Running strace on my system also yields: read(3, "", 4096) = 0 close(3) = 0 munmap(0xb7d1d000, 4096) = 0 stat64("/sans/hpfata07", {st_mode=S_IFDIR|0755, st_size=2048, ...}) = 0 statfs("/sans/hpfata07", 0xbfe4a970) = -1 EOVERFLOW (Value too large for defined data type) fstat64(1, {st_mode=S_IFREG|0644, st_size=2369, ...}) = 0 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7d1d000 write(1, "DISK UNKNOWN - free space:|\n", 28DISK UNKNOWN - free space:| ) = 28 Also: Sean Finney wrote: > if this is true, then i think you should be able to fix this problem by > appending the output of "getconf LFS_CFLAGS" to the CFLAGS used to compile. > usually this is something like -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64. I'd originally been using a binary RPM package downloaded from http://dag.wieers.com/rpm/packages/nagios-plugins/ I just grabbed the source RPM and modified it to include your CFLAGS modification, then recompiled on a 32-bit machine and tried it again on my target (which is also running 32-bit RHEL4, BTW). And yes, it worked fine: [root at backup ~]# /usr/lib/nagios/plugins/check_disk -w 20 -c 10 -p /sans/hpfata07 DISK OK - free space: /sans/hpfata07 18384600 MB (21% inode=12%);| /sans/hpfata07=65457919MB;83842500;83842510;0;83842520 So that seems to resolve the issue for me. Given that I'm sure others will, like me, download binary RPMs which were likely compiled on 32-bit architectures, I guess the bigger question now is "Is there any way to make this the default without impacting anything else?" Could you perhaps try the statfs using the 32-bit code first, and if the EOVERFLOW error is returned, automatically retry with the 64-bit options? As for me, thanks to all for the quick assistance! From ton.voon at altinity.com Mon Sep 24 21:01:41 2007 From: ton.voon at altinity.com (Ton Voon) Date: Mon, 24 Sep 2007 15:01:41 -0400 Subject: [Nagiosplug-devel] Nagios::Plugin suggestions In-Reply-To: <02781CA0-546D-4A54-A3D3-95F3036F3BB0@altinity.com> References: <3067C011-D884-4483-9AB8-A1BBE986928F@altinity.com> <20070208222527.GA29260@openfusion.com.au> <02781CA0-546D-4A54-A3D3-95F3036F3BB0@altinity.com> Message-ID: <2DFE9F16-621D-4157-8E83-AC2BFF187CB0@altinity.com> On 9 Feb 2007, at 04:19, Ton Voon wrote: >>> HELP OUTPUT >>> >>> Currently this is sent to stderr. This should be stdout with >>> respects >>> to the C plugins, though I can't find it documented in the dev >>> guidelines. Agreed? >> >> Happy either way. > > OK, I'll make the change here and document in dev guidelines too. I've finally got round to doing this. Uploaded to CPAN now. Ton http://www.altinity.com T: +44 (0)870 787 9243 F: +44 (0)845 280 1725 Skype: tonvoon From noreply at sourceforge.net Mon Sep 24 21:19:52 2007 From: noreply at sourceforge.net (SourceForge.net) Date: Mon, 24 Sep 2007 12:19:52 -0700 Subject: [Nagiosplug-devel] [ nagiosplug-Bugs-1595449 ] check_procs bus error, ... on Solaris 8, 9 & 10 Message-ID: Bugs item #1595449, was opened at 2006-11-13 09:23 Message generated for change (Settings changed) made by psychotrahe You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=397597&aid=1595449&group_id=29880 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None >Status: Pending Resolution: None Priority: 5 Private: No Submitted By: Alex Peeters (zxr750) Assigned to: Nobody/Anonymous (nobody) Summary: check_procs bus error, ... on Solaris 8, 9 & 10 Initial Comment: check_procs bus error, segmentation fault or wrong output on Solaris 8, 9 & 10 Do first the next configure! ---------------------------- ./configure --with-ps_command="/usr/bin/ps -eo 's uid pid ppid vsz rss pcpu etime comm args'" --with-ps_format='%s %d %d %d %d %d %f %s %s %n' --with-ps_cols=10 --with-ps_varlist='procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procetime,procprog,&pos' --with-trusted-path=/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin To solve the bus error and /or segmentation fault on Solaris 8: -------------------------------------------------- replace into check_procs.c if ( cols >= expected_cols ) { resultsum = 0; - asprintf (&procargs, "%s", input_line + pos); strip (procargs); with if ( cols >= expected_cols ) { resultsum = 0; + asprintf (&procargs, "%s", input_line); strip (procargs); To solve the wrong output on Solaris 8, 9 & 10: ----------------------------------------------- change into common.h MAX_INPUT_BUFFER 1024 to MAX_INPUT_BUFFER 4096 ---------------------------------------------------------------------- Comment By: Matthias Eble (psychotrahe) Date: 2007-07-14 23:31 Message: Logged In: YES user_id=1694341 Originator: NO Hi Alex, is the bus error still there? Matthias ---------------------------------------------------------------------- Comment By: Thomas Guyot (dermoth) Date: 2007-02-17 15:05 Message: Logged In: YES user_id=375623 Originator: NO The patch can be found on bug #1630970. It is also fixed in the latest release, 1.4.6 https://sourceforge.net/tracker/index.php?func=detail&aid=1630970&group_id=29880&atid=397597 ---------------------------------------------------------------------- Comment By: msB (msbenjamin12) Date: 2007-02-16 13:41 Message: Logged In: YES user_id=1097533 Originator: NO Where is the original code, I need to fix this I get the wrong output on Solaris 9. ---------------------------------------------------------------------- Comment By: Thomas Guyot (dermoth) Date: 2007-01-17 06:37 Message: Logged In: YES user_id=375623 Originator: NO The wrong output bug should be fixed (1630970). I (or somebody else) will have to look further for the bus error. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=397597&aid=1595449&group_id=29880 From noreply at sourceforge.net Mon Sep 24 22:16:24 2007 From: noreply at sourceforge.net (SourceForge.net) Date: Mon, 24 Sep 2007 13:16:24 -0700 Subject: [Nagiosplug-devel] [ nagiosplug-Feature Requests-1485683 ] check_disk addition to exclude all mountpoints within a path Message-ID: Feature Requests item #1485683, was opened at 2006-05-10 17:19 Message generated for change (Comment added) made by psychotrahe You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=397600&aid=1485683&group_id=29880 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None >Status: Closed Priority: 5 Private: No Submitted By: maemigh (maemigh) Assigned to: Ton Voon (tonvoon) Summary: check_disk addition to exclude all mountpoints within a path Initial Comment: check_disk currently allows mount points to be excluded via the -x /mount/point command; however, this is causing some issues with Solaris and its cdrom. It would be nice to have the -x command updated to allow a wildcard to be used to exclude all mountpoints within a path. ie -x /cdrom/* I've included some output to illustrate why I believe this to be necessary. Here is a snippet of output from the check_disk command: /cdrom/sol_9_905_sparc/s2=0MB;0;0;0;0 /cdrom/sol_9_905_sparc/s1=494MB;444;469;0;494 /cdrom/sol_9_905_sparc/s0=2349MB;2114;2231;0;2349 df -h: /vol/dev/dsk/c0t0d0/sol_9_905_sparc/s5 31K 2K 26K 8% /cdrom/sol_9_905_sparc/s5 /vol/dev/dsk/c0t0d0/sol_9_905_sparc/s4 31K 2K 26K 8% /cdrom/sol_9_905_sparc/s4 /vol/dev/dsk/c0t0d0/sol_9_905_sparc/s3 31K 2K 26K 8% /cdrom/sol_9_905_sparc/s3 /vol/dev/dsk/c0t0d0/sol_9_905_sparc/s2 31K 2K 26K 8% /cdrom/sol_9_905_sparc/s2 /vol/dev/dsk/c0t0d0/sol_9_905_sparc/s1 495M 468M 0K 100% /cdrom/sol_9_905_sparc/s1 /vol/dev/dsk/c0t0d0/sol_9_905_sparc/s0 2.3G 2.3G 0K 100% /cdrom/sol_9_905_sparc/s0 ---------------------------------------------------------------------- >Comment By: Matthias Eble (psychotrahe) Date: 2007-09-24 22:16 Message: Logged In: YES user_id=1694341 Originator: NO hey maemigh, upcoming version 1.4.10 will have -i/-I flags. to ignore filesystems based on regexes so I'm closing this issue.. if you're still interested. Matthias ---------------------------------------------------------------------- Comment By: Ton Voon (tonvoon) Date: 2006-05-18 14:39 Message: Logged In: YES user_id=664364 maemigh, Couldn't you use -X cdfs? Ton ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=397600&aid=1485683&group_id=29880 From noreply at sourceforge.net Mon Sep 24 22:20:27 2007 From: noreply at sourceforge.net (SourceForge.net) Date: Mon, 24 Sep 2007 13:20:27 -0700 Subject: [Nagiosplug-devel] [ nagiosplug-Feature Requests-1326060 ] check_disk default setting to scan unspecified partition Message-ID: Feature Requests item #1326060, was opened at 2005-10-13 20:04 Message generated for change (Comment added) made by psychotrahe You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=397600&aid=1326060&group_id=29880 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Interface Improvements (example) Group: Next Release (example) >Status: Closed Priority: 5 Private: No Submitted By: John Rouillard (rouilj) Assigned to: Nobody/Anonymous (nobody) Summary: check_disk default setting to scan unspecified partition Initial Comment: currently check disk can apply thresholds on multiple disks. If no disks are specified, all of the disks are checked automatically. Multiple disks can be specified with different thresholds, but then unspecified disks aren't checked. What I would like is for the fag "-p" to take an argument of '*' (or some other character @, % etc) that means apply the current thresholds to all disks that have not yet been specified. Disks excluded using -x or -X ould not be included in the '*' scan. This would of course go at the end of the command string. Thi feature could also be used to warn the user if any disks are not being monitored for those sites that specify all their disks. By manually speciying al the disks using -p or -x and setting "-c 100%" -c 100000000000 -p *' will result in any unspecified disk causing a critical alert if it isn't 100% free and have how ever many oodles of bytes I have specified above free. -- rouilj ---------------------------------------------------------------------- >Comment By: Matthias Eble (psychotrahe) Date: 2007-09-24 22:20 Message: Logged In: YES user_id=1694341 Originator: NO Hi John, long time has gone.. This was added in 1.4.8 Matthias ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=397600&aid=1326060&group_id=29880 From seanius at seanius.net Tue Sep 25 08:43:58 2007 From: seanius at seanius.net (sean finney) Date: Tue, 25 Sep 2007 08:43:58 +0200 Subject: [Nagiosplug-devel] check_disk plugin fails on 80 TB filesystem In-Reply-To: <46F7CA6C.6040108@warnerbros.com> References: <46F42E43.2030507@warnerbros.com> <200709221659.38549.seanius@seanius.net> <46F7CA6C.6040108@warnerbros.com> Message-ID: <200709250843.59342.seanius@seanius.net> hiya, On Monday 24 September 2007 04:32:12 pm Alan Hagge wrote: > I just grabbed the source RPM and modified it to include your CFLAGS > modification, then recompiled on a 32-bit machine and tried it again on > my target (which is also running 32-bit RHEL4, BTW). And yes, it worked > fine: cool! > Given that I'm sure others will, like me, download binary RPMs which > were likely compiled on 32-bit architectures, I guess the bigger > question now is "Is there any way to make this the default without > impacting anything else?" Could you perhaps try the statfs using the > 32-bit code first, and if the EOVERFLOW error is returned, automatically > retry with the 64-bit options? i think it would be simpler to just compile with those options by default. more specifically, in ./configure: - test for the existance of getconf - test for non-empty output of getconf LFS_CFLAGS - if non-empty, append it to CFLAGS - provide a way to disable that if no one has any objections i guess i can take a stab at this. sean -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part. URL: From ton.voon at altinity.com Tue Sep 25 11:18:08 2007 From: ton.voon at altinity.com (Ton Voon) Date: Tue, 25 Sep 2007 05:18:08 -0400 Subject: [Nagiosplug-devel] check_disk plugin fails on 80 TB filesystem In-Reply-To: <200709250843.59342.seanius@seanius.net> References: <46F42E43.2030507@warnerbros.com> <200709221659.38549.seanius@seanius.net> <46F7CA6C.6040108@warnerbros.com> <200709250843.59342.seanius@seanius.net> Message-ID: <3967B942-D6F4-458E-AADE-108D9F798931@altinity.com> Hi, On 25 Sep 2007, at 02:43, sean finney wrote: >> Given that I'm sure others will, like me, download binary RPMs which >> were likely compiled on 32-bit architectures, I guess the bigger >> question now is "Is there any way to make this the default without >> impacting anything else?" Could you perhaps try the statfs using the >> 32-bit code first, and if the EOVERFLOW error is returned, >> automatically >> retry with the 64-bit options? > > i think it would be simpler to just compile with those options by > default. > > more specifically, in ./configure: > > - test for the existance of getconf > - test for non-empty output of getconf LFS_CFLAGS > - if non-empty, append it to CFLAGS > - provide a way to disable that > > > if no one has any objections i guess i can take a stab at this. Can I suggest you have a look at how coreutils does this? We use the gnulibs directly, but I'm guessing that coreutil's df command handles this nicely. Ton http://www.altinity.com T: +44 (0)870 787 9243 F: +44 (0)845 280 1725 Skype: tonvoon From holger at CIS.FU-Berlin.DE Tue Sep 25 19:40:32 2007 From: holger at CIS.FU-Berlin.DE (Holger Weiss) Date: Tue, 25 Sep 2007 19:40:32 +0200 Subject: [Nagiosplug-devel] 1.4.10 Release In-Reply-To: <46F7E6BF.5090009@mailing.kaufland-informationssysteme.com> References: <46F7E6BF.5090009@mailing.kaufland-informationssysteme.com> Message-ID: <20070925174032.GN6565795@CIS.FU-Berlin.DE> * Matthias Eble [2007-09-24 18:33]: > just want to tell that I committed all my planned changes for 1.4.10. Me too. > Maybe someone wants to fix option processing in check_radius before > releasing. I'd also recommend to change or drop positional argument > support for check_radius. It's just too confusing if you ask me. Indeed. Does anyone have an idea why it was added in the first place? The first revision in SVN already has it, and there's no comment in the code. It's not documented in the --help output, so I'd tend to simply removing it. Any objections against the attached patch (which also checks whether all required arguments have been specified as suggested by Thomas in #1218438)? > Although it's no showstopper for me. Agreed. Holger -------------- next part -------------- Index: check_radius.c =================================================================== --- check_radius.c (revision 1798) +++ check_radius.c (working copy) @@ -228,27 +228,6 @@ if (argc < 2) return ERROR; - if (argc == 9) { - config_file = argv[1]; - username = argv[2]; - password = argv[3]; - if (is_intpos (argv[4])) - timeout_interval = atoi (argv[4]); - else - usage2 (_("Timeout interval must be a positive integer"), optarg); - if (is_intpos (argv[5])) - retries = atoi (argv[5]); - else - usage4 (_("Number of retries must be a positive integer")); - server = argv[6]; - if (is_intpos (argv[7])) - port = atoi (argv[7]); - else - usage4 (_("Port must be a positive integer")); - expect = argv[8]; - return OK; - } - while (1) { c = getopt_long (argc, argv, "+hVvH:P:F:u:p:n:t:r:e:", longopts, &option); @@ -309,6 +288,16 @@ break; } } + + if (server == NULL) + usage4 (_("Host not specified")); + if (username == NULL) + usage4 (_("User not specified")); + if (password == NULL) + usage4 (_("Password not specified")); + if (config_file == NULL) + usage4 (_("Configuration file not specified")); + return OK; } From webknowledge at gmail.com Tue Sep 25 19:49:50 2007 From: webknowledge at gmail.com (Marcel) Date: Tue, 25 Sep 2007 14:49:50 -0300 Subject: [Nagiosplug-devel] 1.4.10 Release In-Reply-To: <20070925174032.GN6565795@CIS.FU-Berlin.DE> References: <46F7E6BF.5090009@mailing.kaufland-informationssysteme.com> <20070925174032.GN6565795@CIS.FU-Berlin.DE> Message-ID: <2dfcbd1b0709251049i5f345845r54346f1a91f8758@mail.gmail.com> Just a comment on check_radius, I've tried to use the latest version, with the recommended (and end up trying all versions) of libradiusclient version with no luck at all. Ended up using freeradius and crafting another plugin. suse 10.1 x86_64, nagios2.9, plugins 1.4.9. cheers On 9/25/07, Holger Weiss wrote: > > * Matthias Eble > [2007-09-24 18:33]: > > just want to tell that I committed all my planned changes for 1.4.10. > > Me too. > > > Maybe someone wants to fix option processing in check_radius before > > releasing. I'd also recommend to change or drop positional argument > > support for check_radius. It's just too confusing if you ask me. > > Indeed. Does anyone have an idea why it was added in the first place? > The first revision in SVN already has it, and there's no comment in the > code. It's not documented in the --help output, so I'd tend to simply > removing it. Any objections against the attached patch (which also > checks whether all required arguments have been specified as suggested > by Thomas in #1218438)? > > > Although it's no showstopper for me. > > Agreed. > > Holger > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________________ > Nagios Plugin Development Mailing List > Nagiosplug-devel at lists.sourceforge.net > Unsubscribe at > https://lists.sourceforge.net/lists/listinfo/nagiosplug-devel > ::: Please include plugins version (-v) and OS when reporting any issue. > ::: Messages without supporting info will risk being sent to /dev/null > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From holger at CIS.FU-Berlin.DE Tue Sep 25 20:08:24 2007 From: holger at CIS.FU-Berlin.DE (Holger Weiss) Date: Tue, 25 Sep 2007 20:08:24 +0200 Subject: [Nagiosplug-devel] 1.4.10 Release In-Reply-To: <2dfcbd1b0709251049i5f345845r54346f1a91f8758@mail.gmail.com> References: <46F7E6BF.5090009@mailing.kaufland-informationssysteme.com> <20070925174032.GN6565795@CIS.FU-Berlin.DE> <2dfcbd1b0709251049i5f345845r54346f1a91f8758@mail.gmail.com> Message-ID: <20070925180824.GO6565795@CIS.FU-Berlin.DE> * Marcel [2007-09-25 14:49]: > Just a comment on check_radius, I've tried to use the latest version, with > the recommended (and end up trying all versions) of libradiusclient version > with no luck at all. Define "no luck at all" :-) Did you have trouble compiling or using it? Which error messages did you get? It works fine for me both with Debian's libradius1-dev 0.3.2-8 package and with radiusclient installed from source[1]. Thanks to a patch by Matthias, the next release will also support radiusclient-ng[2]. Holger [1] ftp://ftp.cityline.net/pub/radiusclient/radiusclient-0.3.2.tar.gz [2] http://developer.berlios.de/projects/radiusclient-ng/ From webknowledge at gmail.com Wed Sep 26 01:24:17 2007 From: webknowledge at gmail.com (Marcel) Date: Tue, 25 Sep 2007 20:24:17 -0300 Subject: [Nagiosplug-devel] 1.4.10 Release In-Reply-To: <20070925180824.GO6565795@CIS.FU-Berlin.DE> References: <46F7E6BF.5090009@mailing.kaufland-informationssysteme.com> <20070925174032.GN6565795@CIS.FU-Berlin.DE> <2dfcbd1b0709251049i5f345845r54346f1a91f8758@mail.gmail.com> <20070925180824.GO6565795@CIS.FU-Berlin.DE> Message-ID: <2dfcbd1b0709251624s55344f4byb5c1d6c7e1d23152@mail.gmail.com> While I was suffering from that pain, i was able to sniffer both sides of the radius connection, and the packet was getting in malformed, reported by the radius server side. It appears that on 64bits arch some libs get a little messed up. Tried all versions of radiusclient, but not within 32bits arch. Shifting to freeradius and crafting a new plugin solved the problem. If you locate the problem and release a new version, i'll be happy to test it again. cheers, On 9/25/07, Holger Weiss wrote: > > * Marcel [2007-09-25 14:49]: > > Just a comment on check_radius, I've tried to use the latest version, > with > > the recommended (and end up trying all versions) of libradiusclient > version > > with no luck at all. > > Define "no luck at all" :-) Did you have trouble compiling or using it? > Which error messages did you get? > > It works fine for me both with Debian's libradius1-dev 0.3.2-8 package > and with radiusclient installed from source[1]. Thanks to a patch by > Matthias, the next release will also support radiusclient-ng[2]. > > Holger > > [1] ftp://ftp.cityline.net/pub/radiusclient/radiusclient-0.3.2.tar.gz > [2] http://developer.berlios.de/projects/radiusclient-ng/ > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________________ > Nagios Plugin Development Mailing List > Nagiosplug-devel at lists.sourceforge.net > Unsubscribe at > https://lists.sourceforge.net/lists/listinfo/nagiosplug-devel > ::: Please include plugins version (-v) and OS when reporting any issue. > ::: Messages without supporting info will risk being sent to /dev/null > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ton.voon at altinity.com Wed Sep 26 01:50:43 2007 From: ton.voon at altinity.com (Ton Voon) Date: Tue, 25 Sep 2007 19:50:43 -0400 Subject: [Nagiosplug-devel] 1.4.10 Release In-Reply-To: <2dfcbd1b0709251624s55344f4byb5c1d6c7e1d23152@mail.gmail.com> References: <46F7E6BF.5090009@mailing.kaufland-informationssysteme.com> <20070925174032.GN6565795@CIS.FU-Berlin.DE> <2dfcbd1b0709251049i5f345845r54346f1a91f8758@mail.gmail.com> <20070925180824.GO6565795@CIS.FU-Berlin.DE> <2dfcbd1b0709251624s55344f4byb5c1d6c7e1d23152@mail.gmail.com> Message-ID: Marcel, On 25 Sep 2007, at 19:24, Marcel wrote: > If you locate the problem and release a new version, i'll be happy > to test it again. Can you try the snapshot at http://nagiosplug.sf.net/snapshot? This has Matthias' change and is a release candidate for 1.4.10. Ton http://www.altinity.com T: +44 (0)870 787 9243 F: +44 (0)845 280 1725 Skype: tonvoon From dermoth at aei.ca Wed Sep 26 05:17:58 2007 From: dermoth at aei.ca (Thomas Guyot-Sionnest) Date: Tue, 25 Sep 2007 23:17:58 -0400 Subject: [Nagiosplug-devel] 1.4.10 Release In-Reply-To: References: <46F7E6BF.5090009@mailing.kaufland-informationssysteme.com> <20070925174032.GN6565795@CIS.FU-Berlin.DE> <2dfcbd1b0709251049i5f345845r54346f1a91f8758@mail.gmail.com> <20070925180824.GO6565795@CIS.FU-Berlin.DE> <2dfcbd1b0709251624s55344f4byb5c1d6c7e1d23152@mail.gmail.com> Message-ID: <46F9CF66.9040206@aei.ca> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 25/09/07 07:50 PM, Ton Voon wrote: > Marcel, > > On 25 Sep 2007, at 19:24, Marcel wrote: > >> If you locate the problem and release a new version, i'll be happy >> to test it again. > > Can you try the snapshot at http://nagiosplug.sf.net/snapshot? This > has Matthias' change and is a release candidate for 1.4.10. Assuming that the problem was from the library you should try with radiusclient-ng: http://developer.berlios.de/projects/radiusclient-ng/ Thomas -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFG+c9m6dZ+Kt5BchYRAoyVAKDW7nY/JHyn0JZ5zpE2MW6vMV1TlQCeIRVO JrFDq1uUy36tG5bCFTGFxtU= =TLaW -----END PGP SIGNATURE----- From noreply at sourceforge.net Wed Sep 26 06:18:11 2007 From: noreply at sourceforge.net (SourceForge.net) Date: Tue, 25 Sep 2007 21:18:11 -0700 Subject: [Nagiosplug-devel] [ nagiosplug-Patches-1798774 ] check_ntp: honor ntp flags Message-ID: Patches item #1798774, was opened at 2007-09-20 09:52 Message generated for change (Comment added) made by dermoth You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=397599&aid=1798774&group_id=29880 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Bugfix Group: None >Status: Closed >Resolution: Fixed Priority: 5 Private: No Submitted By: MAtteo HCE Valsasna (mvalsasna) Assigned to: Thomas Guyot (dermoth) Summary: check_ntp: honor ntp flags Initial Comment: Patch against Plugin Version (-V output): check_ntp (nagios-plugins 1.4.9) 1.25 Plugin Name: check_ntp Example Plugin Commandline: ./check_ntp -H Tested on operating system: nagios host: debian etch i386, Version 2.0b3 NTP server: openwrt kamikaze 7.07 running openntpd 3.9.1p1 Tested on architecture: nagios host: i386 NTP server: mips Tested with compiler: gcc version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21) check_ntp fails to check ntp flags in the response it receives from servers, and accepts servers who respond with a valid stratum but with flags bit set to 11 (LI_ALARM). those servers were then refused by clients. this patch adds a check for ntp flags value, so that servers with flags != 00 (LI_NOWARNING) are discarded because of the complex structure of the plugin, which checks all IP addresses that correspond to the hostname given, and gives OK if at least one of them is OK, I couldn't easily add an explanatory error message additionally, if offset_result==STATE_CRITICAL (which happens also if all servers are rejected due to NTP flags), perfdata_line would have been used without being initialized, leading to printing of garbage, or possibly worse. this is corrected in the last chunk of the patch, by initializing perfdata_line ---------------------------------------------------------------------- >Comment By: Thomas Guyot (dermoth) Date: 2007-09-26 00:18 Message: Logged In: YES user_id=375623 Originator: NO This is in SVN. It was a nice patch, thanks for your time. ---------------------------------------------------------------------- Comment By: Thomas Guyot (dermoth) Date: 2007-09-21 08:22 Message: Logged In: YES user_id=375623 Originator: NO Thanks for submitting. I will review/test it shortly and get it included. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=397599&aid=1798774&group_id=29880 From noreply at sourceforge.net Wed Sep 26 07:37:42 2007 From: noreply at sourceforge.net (SourceForge.net) Date: Tue, 25 Sep 2007 22:37:42 -0700 Subject: [Nagiosplug-devel] [ nagiosplug-Bugs-1595449 ] check_procs bus error, ... on Solaris 8, 9 & 10 Message-ID: Bugs item #1595449, was opened at 2006-11-13 09:23 Message generated for change (Comment added) made by zxr750 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=397597&aid=1595449&group_id=29880 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None >Status: Open Resolution: None Priority: 5 Private: No Submitted By: Alex Peeters (zxr750) Assigned to: Nobody/Anonymous (nobody) Summary: check_procs bus error, ... on Solaris 8, 9 & 10 Initial Comment: check_procs bus error, segmentation fault or wrong output on Solaris 8, 9 & 10 Do first the next configure! ---------------------------- ./configure --with-ps_command="/usr/bin/ps -eo 's uid pid ppid vsz rss pcpu etime comm args'" --with-ps_format='%s %d %d %d %d %d %f %s %s %n' --with-ps_cols=10 --with-ps_varlist='procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procetime,procprog,&pos' --with-trusted-path=/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin To solve the bus error and /or segmentation fault on Solaris 8: -------------------------------------------------- replace into check_procs.c if ( cols >= expected_cols ) { resultsum = 0; - asprintf (&procargs, "%s", input_line + pos); strip (procargs); with if ( cols >= expected_cols ) { resultsum = 0; + asprintf (&procargs, "%s", input_line); strip (procargs); To solve the wrong output on Solaris 8, 9 & 10: ----------------------------------------------- change into common.h MAX_INPUT_BUFFER 1024 to MAX_INPUT_BUFFER 4096 ---------------------------------------------------------------------- >Comment By: Alex Peeters (zxr750) Date: 2007-09-26 07:37 Message: Logged In: YES user_id=590764 Originator: YES Why pending ? ---------------------------------------------------------------------- Comment By: Matthias Eble (psychotrahe) Date: 2007-07-14 23:31 Message: Logged In: YES user_id=1694341 Originator: NO Hi Alex, is the bus error still there? Matthias ---------------------------------------------------------------------- Comment By: Thomas Guyot (dermoth) Date: 2007-02-17 15:05 Message: Logged In: YES user_id=375623 Originator: NO The patch can be found on bug #1630970. It is also fixed in the latest release, 1.4.6 https://sourceforge.net/tracker/index.php?func=detail&aid=1630970&group_id=29880&atid=397597 ---------------------------------------------------------------------- Comment By: msB (msbenjamin12) Date: 2007-02-16 13:41 Message: Logged In: YES user_id=1097533 Originator: NO Where is the original code, I need to fix this I get the wrong output on Solaris 9. ---------------------------------------------------------------------- Comment By: Thomas Guyot (dermoth) Date: 2007-01-17 06:37 Message: Logged In: YES user_id=375623 Originator: NO The wrong output bug should be fixed (1630970). I (or somebody else) will have to look further for the bus error. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=397597&aid=1595449&group_id=29880 From noreply at sourceforge.net Wed Sep 26 07:38:18 2007 From: noreply at sourceforge.net (SourceForge.net) Date: Tue, 25 Sep 2007 22:38:18 -0700 Subject: [Nagiosplug-devel] [ nagiosplug-Bugs-1595449 ] check_procs bus error, ... on Solaris 8, 9 & 10 Message-ID: Bugs item #1595449, was opened at 2006-11-13 09:23 Message generated for change (Comment added) made by zxr750 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=397597&aid=1595449&group_id=29880 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Alex Peeters (zxr750) Assigned to: Nobody/Anonymous (nobody) Summary: check_procs bus error, ... on Solaris 8, 9 & 10 Initial Comment: check_procs bus error, segmentation fault or wrong output on Solaris 8, 9 & 10 Do first the next configure! ---------------------------- ./configure --with-ps_command="/usr/bin/ps -eo 's uid pid ppid vsz rss pcpu etime comm args'" --with-ps_format='%s %d %d %d %d %d %f %s %s %n' --with-ps_cols=10 --with-ps_varlist='procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procetime,procprog,&pos' --with-trusted-path=/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin To solve the bus error and /or segmentation fault on Solaris 8: -------------------------------------------------- replace into check_procs.c if ( cols >= expected_cols ) { resultsum = 0; - asprintf (&procargs, "%s", input_line + pos); strip (procargs); with if ( cols >= expected_cols ) { resultsum = 0; + asprintf (&procargs, "%s", input_line); strip (procargs); To solve the wrong output on Solaris 8, 9 & 10: ----------------------------------------------- change into common.h MAX_INPUT_BUFFER 1024 to MAX_INPUT_BUFFER 4096 ---------------------------------------------------------------------- >Comment By: Alex Peeters (zxr750) Date: 2007-09-26 07:38 Message: Logged In: YES user_id=590764 Originator: YES Why pending ? ---------------------------------------------------------------------- Comment By: Alex Peeters (zxr750) Date: 2007-09-26 07:37 Message: Logged In: YES user_id=590764 Originator: YES Why pending ? ---------------------------------------------------------------------- Comment By: Matthias Eble (psychotrahe) Date: 2007-07-14 23:31 Message: Logged In: YES user_id=1694341 Originator: NO Hi Alex, is the bus error still there? Matthias ---------------------------------------------------------------------- Comment By: Thomas Guyot (dermoth) Date: 2007-02-17 15:05 Message: Logged In: YES user_id=375623 Originator: NO The patch can be found on bug #1630970. It is also fixed in the latest release, 1.4.6 https://sourceforge.net/tracker/index.php?func=detail&aid=1630970&group_id=29880&atid=397597 ---------------------------------------------------------------------- Comment By: msB (msbenjamin12) Date: 2007-02-16 13:41 Message: Logged In: YES user_id=1097533 Originator: NO Where is the original code, I need to fix this I get the wrong output on Solaris 9. ---------------------------------------------------------------------- Comment By: Thomas Guyot (dermoth) Date: 2007-01-17 06:37 Message: Logged In: YES user_id=375623 Originator: NO The wrong output bug should be fixed (1630970). I (or somebody else) will have to look further for the bus error. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=397597&aid=1595449&group_id=29880 From matthias.eble at mailing.kaufland-informationssysteme.com Wed Sep 26 08:45:00 2007 From: matthias.eble at mailing.kaufland-informationssysteme.com (Matthias Eble) Date: Wed, 26 Sep 2007 08:45:00 +0200 Subject: [Nagiosplug-devel] 1.4.10 Release In-Reply-To: <20070925174032.GN6565795@CIS.FU-Berlin.DE> References: <46F7E6BF.5090009@mailing.kaufland-informationssysteme.com> <20070925174032.GN6565795@CIS.FU-Berlin.DE> Message-ID: <46F9FFEC.9090108@mailing.kaufland-informationssysteme.com> >> Maybe someone wants to fix option processing in check_radius before >> releasing. I'd also recommend to change or drop positional argument >> support for check_radius. It's just too confusing if you ask me. > > Indeed. Does anyone have an idea why it was added in the first place? > The first revision in SVN already has it, and there's no comment in the > code. It's not documented in the --help output, so I'd tend to simply > removing it. Any objections against the attached patch (which also > checks whether all required arguments have been specified as suggested > by Thomas in #1218438)? > Hi Holger, I'd prefer to remove the entire positional block, too. So if you ask me, it should be committed, since it prevents the plugin from working as expected. Matthias From noreply at sourceforge.net Wed Sep 26 12:35:09 2007 From: noreply at sourceforge.net (SourceForge.net) Date: Wed, 26 Sep 2007 03:35:09 -0700 Subject: [Nagiosplug-devel] [ nagiosplug-Bugs-1595449 ] check_procs bus error, ... on Solaris 8, 9 & 10 Message-ID: Bugs item #1595449, was opened at 2006-11-13 09:23 Message generated for change (Comment added) made by hweiss You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=397597&aid=1595449&group_id=29880 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None >Status: Pending Resolution: None Priority: 5 Private: No Submitted By: Alex Peeters (zxr750) Assigned to: Nobody/Anonymous (nobody) Summary: check_procs bus error, ... on Solaris 8, 9 & 10 Initial Comment: check_procs bus error, segmentation fault or wrong output on Solaris 8, 9 & 10 Do first the next configure! ---------------------------- ./configure --with-ps_command="/usr/bin/ps -eo 's uid pid ppid vsz rss pcpu etime comm args'" --with-ps_format='%s %d %d %d %d %d %f %s %s %n' --with-ps_cols=10 --with-ps_varlist='procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procetime,procprog,&pos' --with-trusted-path=/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin To solve the bus error and /or segmentation fault on Solaris 8: -------------------------------------------------- replace into check_procs.c if ( cols >= expected_cols ) { resultsum = 0; - asprintf (&procargs, "%s", input_line + pos); strip (procargs); with if ( cols >= expected_cols ) { resultsum = 0; + asprintf (&procargs, "%s", input_line); strip (procargs); To solve the wrong output on Solaris 8, 9 & 10: ----------------------------------------------- change into common.h MAX_INPUT_BUFFER 1024 to MAX_INPUT_BUFFER 4096 ---------------------------------------------------------------------- >Comment By: Holger Weiss (hweiss) Date: 2007-09-26 12:35 Message: Logged In: YES user_id=759506 Originator: NO I tried your ./configure line on Solaris 8 and on Solaris 10 with Sun's compiler as well as with GCC but I was not able to reproduce your problem. MAX_INPUT_BUFFER is set to 8192 in the current code. The 'pos' offset is correct for me, not using it would let check_procs evaluate a complete ps(1) output line instead of just the 'args' field when checking the process arguments which would clearly be wrong and may lead to incorrect results when using '--argument-array'. Could you test whether you can still reproduce the problem using the snapshot at http://nagiosplug.sf.net/snapshot/ (which is a release candidate for 1.4.10)? If so, could you please post the exact check_procs command line you used, the compiler (version) you used, and the exact result you got (bus error or segfault or incorrect output)? I'll set the status back to 'pending', please re-open the item if you can still reproduce the problem. Thanks a lot, Holger ---------------------------------------------------------------------- Comment By: Alex Peeters (zxr750) Date: 2007-09-26 07:38 Message: Logged In: YES user_id=590764 Originator: YES Why pending ? ---------------------------------------------------------------------- Comment By: Alex Peeters (zxr750) Date: 2007-09-26 07:37 Message: Logged In: YES user_id=590764 Originator: YES Why pending ? ---------------------------------------------------------------------- Comment By: Matthias Eble (psychotrahe) Date: 2007-07-14 23:31 Message: Logged In: YES user_id=1694341 Originator: NO Hi Alex, is the bus error still there? Matthias ---------------------------------------------------------------------- Comment By: Thomas Guyot (dermoth) Date: 2007-02-17 15:05 Message: Logged In: YES user_id=375623 Originator: NO The patch can be found on bug #1630970. It is also fixed in the latest release, 1.4.6 https://sourceforge.net/tracker/index.php?func=detail&aid=1630970&group_id=29880&atid=397597 ---------------------------------------------------------------------- Comment By: msB (msbenjamin12) Date: 2007-02-16 13:41 Message: Logged In: YES user_id=1097533 Originator: NO Where is the original code, I need to fix this I get the wrong output on Solaris 9. ---------------------------------------------------------------------- Comment By: Thomas Guyot (dermoth) Date: 2007-01-17 06:37 Message: Logged In: YES user_id=375623 Originator: NO The wrong output bug should be fixed (1630970). I (or somebody else) will have to look further for the bus error. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=397597&aid=1595449&group_id=29880 From holger at CIS.FU-Berlin.DE Wed Sep 26 13:00:52 2007 From: holger at CIS.FU-Berlin.DE (Holger Weiss) Date: Wed, 26 Sep 2007 13:00:52 +0200 Subject: [Nagiosplug-devel] 1.4.10 Release In-Reply-To: <46F9FFEC.9090108@mailing.kaufland-informationssysteme.com> References: <46F7E6BF.5090009@mailing.kaufland-informationssysteme.com> <20070925174032.GN6565795@CIS.FU-Berlin.DE> <46F9FFEC.9090108@mailing.kaufland-informationssysteme.com> Message-ID: <20070926110052.GQ6565795@CIS.FU-Berlin.DE> * Matthias Eble [2007-09-26 08:45]: > >> Maybe someone wants to fix option processing in check_radius before > >> releasing. I'd also recommend to change or drop positional argument > >> support for check_radius. It's just too confusing if you ask me. > > > > Indeed. Does anyone have an idea why it was added in the first place? > > The first revision in SVN already has it, and there's no comment in the > > code. It's not documented in the --help output, so I'd tend to simply > > removing it. Any objections against the attached patch (which also > > checks whether all required arguments have been specified as suggested > > by Thomas in #1218438)? > > I'd prefer to remove the entire positional block, too. > So if you ask me, it should be committed, since it prevents the plugin > from working as expected. Okay, done. Thanks, Holger From noreply at sourceforge.net Sat Sep 29 01:54:26 2007 From: noreply at sourceforge.net (SourceForge.net) Date: Fri, 28 Sep 2007 16:54:26 -0700 Subject: [Nagiosplug-devel] [ nagiosplug-Bugs-1768817 ] check_linux_raid.pl compilation error Message-ID: Bugs item #1768817, was opened at 2007-08-06 22:01 Message generated for change (Comment added) made by tonvoon You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=397597&aid=1768817&group_id=29880 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: General plugin execution Group: None >Status: Closed Resolution: None Priority: 5 Private: No Submitted By: Jonathan Mills (jonmills1) >Assigned to: Ton Voon (tonvoon) Summary: check_linux_raid.pl compilation error Initial Comment: The affected file is /usr/lib/nagios/plugins/contrib/check_linux_raid.pl =================== ERROR: [root at test4 contrib]# perl ./check_linux_raid.pl md0 Bareword "utils" not allowed while "strict subs" in use at ./check_linux_raid.pl line 26. Bareword "pm" not allowed while "strict subs" in use at ./check_linux_raid.pl line 26. BEGIN not safe after errors--compilation aborted at ./check_linux_raid.pl line 27. ==================== This appears to exist in even the latest versions of nagios-plugins. The recommended fix is to replace line 26 with this: use lib "utils.pm"; Thanks! ---------------------------------------------------------------------- >Comment By: Ton Voon (tonvoon) Date: 2007-09-29 00:54 Message: Logged In: YES user_id=664364 Originator: NO Jonathan, Thanks for the report and the patch. This has been changed in the core code so that the line is 'use lib "/usr/local/nagios/libexec";'. The future direction for perl modules is to use the Nagios::Plugin CPAN module. Also we are removing support of contrib plugins in future. Ton ---------------------------------------------------------------------- Comment By: Jim Nelson (jnelson_neteasy) Date: 2007-08-13 13:11 Message: Logged In: YES user_id=1856924 Originator: NO Here's a patch to fix that error in several files in the /contrib directory - I submitted it on August 1st, but it doesn't show in the archives... -- diff -Nurp nagios-plugins-1.4.9-orig/contrib/check_apc_ups.pl nagios-plugins-1.4.9/contrib/check_apc_ups.pl --- nagios-plugins-1.4.9-orig/contrib/check_apc_ups.pl 2007-07-30 16:35:07.000000000 -0400 +++ nagios-plugins-1.4.9/contrib/check_apc_ups.pl 2007-07-30 16:36:21.000000000 -0400 @@ -13,7 +13,7 @@ use strict; use Getopt::Long; use vars qw($opt_V $opt_h $opt_H $opt_T $opt_t $opt_R $opt_r $opt_L $opt_l $PROGNAME); -use lib utils.pm; +use lib 'utils.pm'; use utils qw(%ERRORS &print_revision &support &usage); sub print_help (); diff -Nurp nagios-plugins-1.4.9-orig/contrib/check_appletalk.pl nagios-plugins-1.4.9/contrib/check_appletalk.pl --- nagios-plugins-1.4.9-orig/contrib/check_appletalk.pl 2007-07-30 16:35:07.000000000 -0400 +++ nagios-plugins-1.4.9/contrib/check_appletalk.pl 2007-07-30 16:36:34.000000000 -0400 @@ -22,7 +22,7 @@ BEGIN { } use strict; -use lib utils.pm; +use lib 'utils.pm'; use utils qw($TIMEOUT %ERRORS &print_revision &support); use vars qw($PROGNAME); diff -Nurp nagios-plugins-1.4.9-orig/contrib/check_linux_raid.pl nagios-plugins-1.4.9/contrib/check_linux_raid.pl --- nagios-plugins-1.4.9-orig/contrib/check_linux_raid.pl 2007-07-30 16:35:07.000000000 -0400 +++ nagios-plugins-1.4.9/contrib/check_linux_raid.pl 2007-07-30 16:36:59.000000000 -0400 @@ -23,7 +23,7 @@ # WARNING md0 status=[UUU_U], recovery=46.4%, finish=123.0min use strict; -use lib utils.pm; +use lib 'utils.pm'; use utils qw(%ERRORS); # die with an error if we're not on Linux diff -Nurp nagios-plugins-1.4.9-orig/contrib/check_snmp_procs.pl nagios-plugins-1.4.9/contrib/check_snmp_procs.pl --- nagios-plugins-1.4.9-orig/contrib/check_snmp_procs.pl 2007-07-30 16:35:07.000000000 -0400 +++ nagios-plugins-1.4.9/contrib/check_snmp_procs.pl 2007-07-30 16:37:30.000000000 -0400 @@ -35,7 +35,7 @@ #use strict; use Getopt::Long; use Net::SNMP qw (oid_lex_sort oid_base_match SNMP_VERSION_1); -use lib utils.pm; +use lib 'utils.pm'; use utils qw(%ERRORS &print_revision &support &usage); my $PROGNAME="check_snmp_procs"; ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=397597&aid=1768817&group_id=29880 From noreply at sourceforge.net Sat Sep 29 01:55:52 2007 From: noreply at sourceforge.net (SourceForge.net) Date: Fri, 28 Sep 2007 16:55:52 -0700 Subject: [Nagiosplug-devel] [ nagiosplug-Bugs-1753164 ] configure script fails to recognise radius libs Message-ID: Bugs item #1753164, was opened at 2007-07-13 04:22 Message generated for change (Comment added) made by tonvoon You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=397597&aid=1753164&group_id=29880 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Compilation Group: Release (specify) >Status: Pending Resolution: None Priority: 5 Private: No Submitted By: Arya (alphamega) >Assigned to: Ton Voon (tonvoon) Summary: configure script fails to recognise radius libs Initial Comment: There's a good chance this has already been fixed in CVS (and apologies if this is the case), but just in case it hasnt.... It looks like the configure script doesnt detect the radiusclient libs, even though they are present. OS: Solaris 10 Plugins Version: 1.4.9 Radiusclient Version: 0.3.2 [root at cbr-x2200-02 /usr/local/src/nagios-plugins-1.4.9] # echo $PATH /usr/local/bin:/usr/sbin:/usr/bin:/usr/openwin/bin:/usr/dt/bin:/usr/local/bin:/usr/local/sbin:/usr/sfw/bin:/usr/sfw/sbin:/usr/ccs/bin:/usr/local/ssl/bin:/opt/64/bin:/opt/64/sbin:/opt/SUNWspro/bin:/usr/ucb:/usr/local/BerkeleyDB.4.4/bin:/usr/local/apache2/bin:/usr/local/mysql/bin/:/usr/local/net-snmp/bin:/usr/local/net-snmp/sbin:/usr/local/openldap/bin:/usr/local/openldap/sbin:/usr/local/php5/bin:/usr/local/radiusclient/sbin:/usr/local/rrdtool/bin [root at cbr-x2200-02 /usr/local/src/nagios-plugins-1.4.9] # crle Configuration file [version 4]: /var/ld/ld.config Default Library Path (ELF): /lib:/usr/local/lib:/usr/local/ssl/lib:/usr/local/BerkeleyDB.4.4/lib:/usr/local/apache2/lib:/usr/local/mysql/lib/mysql:/usr/local/net-snmp/lib:/usr/local/openldap/lib:/usr/local/php5/lib:/usr/local/radiusclient/lib:/usr/local/rrdtool/lib:/usr/lib:/usr/sfw/lib Trusted Directories (ELF): /lib/secure:/usr/lib/secure (system default) Command line: crle -c /var/ld/ld.config -l /lib:/usr/local/lib:/usr/local/ssl/lib:/usr/local/BerkeleyDB.4.4/lib:/usr/local/apache2/lib:/usr/local/mysql/lib/mysql:/usr/local/net-snmp/lib:/usr/local/openldap/lib:/usr/local/php5/lib:/usr/local/radiusclient/lib:/usr/local/rrdtool/lib:/usr/lib:/usr/sfw/lib [root at cbr-x2200-02 /usr/local/src/nagios-plugins-1.4.9] # cat configure-script.sh export CPPFLAGS="-I/usr/local/radiusclient/include -I/usr/local/openldap/include" export LDFLAGS="-L/usr/local/radiusclient/lib -L/usr/local/openldap/lib -R/usr/local/radiusclient/lib -R/usr/local/openldap/lib" export CC=gcc ./configure --prefix=/usr/local/nagios [root at cbr-x2200-02 /usr/local/src/nagios-plugins-1.4.9] # ./configure-script.sh checking for libpq-fe.h... no checking for rc_read_config in -lradiusclient... no configure: WARNING: Skipping radius plugin configure: WARNING: install radius libs to compile this plugin (see REQUIREMENTS). checking for main in -lldap... yes checking for ldap_set_option... yes checking for ldap_init... yes checking for ldap_set_option... (cached) yes checking for ldap_get_option... yes checking for ldap_start_tls_s... yes config.status: creating po/Makefile --with-apt-get-command: --with-ping6-command: --with-ping-command: /usr/sbin/ping -n -s %s 56 %d --with-ipv6: yes --with-mysql: /usr/local/mysql/bin//mysql_config --with-openssl: yes --with-gnutls: no --with-perl: /usr/local/bin/perl --with-cgiurl: /nagios/cgi-bin --with-trusted-path: /bin:/sbin:/usr/bin:/usr/sbin [root at cbr-x2200-02 /usr/local/src/nagios-plugins-1.4.9] # cd /usr/local [root at cbr-x2200-02 /usr/local] # ls -ld radiusclient* 2 lrwxrwxrwx 1 root root 19 Jul 12 16:07 radiusclient -> radiusclient-0.3.2/ 2 drwxr-xr-x 7 root root 512 Jul 12 15:54 radiusclient-0.3.2 [root at cbr-x2200-02 /usr/local] # du -a radiusclient/ 6 radiusclient/include/includes.h 24 radiusclient/include/radiusclient.h 4 radiusclient/include/messages.h 2 radiusclient/include/pathnames.h 38 radiusclient/include 154 radiusclient/lib/libradiusclient.so.0.0.1 2 radiusclient/lib/libradiusclient.so.0 2 radiusclient/lib/libradiusclient.so 2 radiusclient/lib/libradiusclient.la 224 radiusclient/lib/libradiusclient.a 386 radiusclient/lib 52 radiusclient/sbin/radlogin 24 radiusclient/sbin/radstatus 26 radiusclient/sbin/radacct 22 radiusclient/sbin/radexample 126 radiusclient/sbin 2 radiusclient/etc/radiusclient/servers 2 radiusclient/etc/radiusclient/issue 2 radiusclient/etc/radiusclient/port-id-map 6 radiusclient/etc/radiusclient/radiusclient.conf 14 radiusclient/etc/radiusclient/dictionary 26 radiusclient/etc/radiusclient/dictionary.ascend 4 radiusclient/etc/radiusclient/dictionary.compat 2 radiusclient/etc/radiusclient/dictionary.merit 60 radiusclient/etc/radiusclient 62 radiusclient/etc 18 radiusclient/doc/instop.html 20 radiusclient/doc 634 radiusclient Once I comment out some lines in configure (lines 20994 - 21003): #if test "$ac_cv_lib_radiusclient_rc_read_config" = "yes"; then EXTRAS="$EXTRAS check_radius" RADIUSLIBS="-lradiusclient" #else # { echo "$as_me:$LINENO: WARNING: Skipping radius plugin" >&5 #echo "$as_me: WARNING: Skipping radius plugin" >&2;} # { echo "$as_me:$LINENO: WARNING: install radius libs to compile this plugin (see REQUIREMENTS)." >&5 #echo "$as_me: WARNING: install radius libs to compile this plugin (see REQUIREMENTS)." >&2;} #fi I can re-run ./configure-script.sh. Obviously configure will still report this: checking for rc_read_config in -lradiusclient... no However, it pretends it's there, and when I run a 'make', viola, it works. To install radiusclient, I did a simple "./configure --prefix=/usr/local/radiusclient && make && make install" -- which works. [root at cbr-x2200-02 /usr/local/src/nagios-plugins-1.4.9/plugins] # make check_radius if gcc -DLOCALEDIR=\"/usr/local/nagios/share/locale\" -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I../lib -I../gl -I../intl -I/usr/include/ldap -I/usr/include/pgsql -I/usr/local/ssl/include -I/usr/local/radiusclient/include -I/usr/local/openldap/include -D_REENTRANT -I/usr/local/ssl/include -g -O2 -MT check_radius.o -MD -MP -MF ".deps/check_radius.Tpo" -c -o check_radius.o check_radius.c; \ then mv -f ".deps/check_radius.Tpo" ".deps/check_radius.Po"; else rm -f ".deps/check_radius.Tpo"; exit 1; fi In file included from check_radius.c:42: common.h:191: warning: static declaration of 'floorf' follows non-static declaration if gcc -DLOCALEDIR=\"/usr/local/nagios/share/locale\" -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I../lib -I../gl -I../intl -I/usr/include/ldap -I/usr/include/pgsql -I/usr/local/ssl/include -I/usr/local/radiusclient/include -I/usr/local/openldap/include -D_REENTRANT -I/usr/local/ssl/include -g -O2 -MT netutils.o -MD -MP -MF ".deps/netutils.Tpo" -c -o netutils.o netutils.c; \ then mv -f ".deps/netutils.Tpo" ".deps/netutils.Po"; else rm -f ".deps/netutils.Tpo"; exit 1; fi In file included from netutils.c:36: common.h:191: warning: static declaration of 'floorf' follows non-static declaration if gcc -DLOCALEDIR=\"/usr/local/nagios/share/locale\" -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I../lib -I../gl -I../intl -I/usr/include/ldap -I/usr/include/pgsql -I/usr/local/ssl/include -I/usr/local/radiusclient/include -I/usr/local/openldap/include -D_REENTRANT -I/usr/local/ssl/include -g -O2 -MT utils.o -MD -MP -MF ".deps/utils.Tpo" -c -o utils.o utils.c; \ then mv -f ".deps/utils.Tpo" ".deps/utils.Po"; else rm -f ".deps/utils.Tpo"; exit 1; fi In file included from utils.c:17: common.h:191: warning: static declaration of 'floorf' follows non-static declaration /bin/bash ../libtool --tag=CC --mode=link gcc -g -O2 -L/usr/local/radiusclient/lib -L/usr/local/openldap/lib -R/usr/local/radiusclient/lib -R/usr/local/openldap/lib -L. -L/usr/local/ssl/lib -o check_radius check_radius.o netutils.o utils.o ../lib/libnagiosplug.a ../gl/libgnu.a -lnsl -lsocket -lresolv -lradiusclient -lnsl -lsocket mkdir .libs gcc -g -O2 -o check_radius check_radius.o netutils.o utils.o -L/usr/local/radiusclient/lib -L/usr/local/openldap/lib -L/usr/local/src/nagios-plugins-1.4.9/plugins -L/usr/local/ssl/lib ../lib/libnagiosplug.a ../gl/libgnu.a -lresolv /usr/local/radiusclient/lib/libradiusclient.so -lcrypt -lnsl -lsocket -R/usr/local/radiusclient/lib -R/usr/local/radiusclient/lib -R/usr/local/openldap/lib [root at cbr-x2200-02 /usr/local/src/nagios-plugins-1.4.9/plugins] # ldd ./check_radius libresolv.so.2 => /lib/libresolv.so.2 libradiusclient.so.0 => /usr/local/radiusclient/lib/libradiusclient.so.0 libcrypt_i.so.1 => /usr/lib/libcrypt_i.so.1 libnsl.so.1 => /lib/libnsl.so.1 libsocket.so.1 => /lib/libsocket.so.1 libc.so.1 => /lib/libc.so.1 libgen.so.1 => /lib/libgen.so.1 libmp.so.2 => /lib/libmp.so.2 libmd5.so.1 => /lib/libmd5.so.1 libscf.so.1 => /lib/libscf.so.1 libdoor.so.1 => /lib/libdoor.so.1 libuutil.so.1 => /lib/libuutil.so.1 libm.so.2 => /lib/libm.so.2 I suspect what's happening here is that configure is a little too optimistic about how configured the radiusclient installation is :-) ---------------------------------------------------------------------- >Comment By: Ton Voon (tonvoon) Date: 2007-09-29 00:55 Message: Logged In: YES user_id=664364 Originator: NO Arya, Thanks for the report. I think this is already resolved in the latest SVN code. Please try the nightly snapshot at http://nagiosplug.sf.net/snapshot. Ton ---------------------------------------------------------------------- Comment By: Matthias Eble (psychotrahe) Date: 2007-07-24 16:34 Message: Logged In: YES user_id=1694341 Originator: NO does your installed radiusclient library actually have a function called rc_read_config? Matthias ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=397597&aid=1753164&group_id=29880 From noreply at sourceforge.net Sat Sep 29 02:04:12 2007 From: noreply at sourceforge.net (SourceForge.net) Date: Fri, 28 Sep 2007 17:04:12 -0700 Subject: [Nagiosplug-devel] [ nagiosplug-Bugs-1547070 ] HP-UX 11.23/parisc & 1.4.3 Message-ID: Bugs item #1547070, was opened at 2006-08-26 10:10 Message generated for change (Comment added) made by tonvoon You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=397597&aid=1547070&group_id=29880 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Compilation Group: Release (specify) >Status: Pending Resolution: None Priority: 5 Private: No Submitted By: NeoM (neomagic) >Assigned to: Ton Voon (tonvoon) Summary: HP-UX 11.23/parisc & 1.4.3 Initial Comment: i try to compile nagios-plugins (1.4.3) on HP-UX 11i v2 (or 11.23) / parisc and get two quirks: * compilation of check_swap if gcc -DLOCALEDIR=\"/opt/nagios/share/locale\" -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I../lib -I../intl -I/opt/openssl/include -I/opt/openssl/include -Wall -g -O2 -MT check_swap.o -MD -MP -MF ".deps/check_swap.Tpo" -c -o check_swap.o check_swap.c; \ then mv -f ".deps/check_swap.Tpo" ".deps/check_swap.Po"; else rm -f ".deps/check_swap.Tpo"; exit 1; fi check_swap.c: In function `main': check_swap.c:55: warning: unused variable `tmp_mb' check_swap.c: In function `process_arguments': check_swap.c:396: warning: implicit declaration of function `floorf' /bin/sh ../libtool --mode=link --tag=CC gcc -Wall -g -O2 -L. -R/opt/openssl/lib -o check_swap check_swap.o -lm utils.o ../lib/libnagiosplug.a ../lib/libcoreutils.a popen.o -lintl -lgen -lssl -lcrypto gcc -Wall -g -O2 -o check_swap check_swap.o utils.o popen.o -L/export/tmp/nrpe/nagios-plugins-1.4.3/plugins -lm ../lib/libnagiosplug.a ../lib/libcoreutils.a /usr/local/lib/libintl.sl -L/usr/local/lib /usr/local/lib/libiconv.sl -lc -lgen -lssl -lcrypto -Wl,+b -Wl,/usr/local/lib:/opt/openssl/lib /usr/ccs/bin/ld: Unsatisfied symbols: floorf (first referenced in check_swap.o) (code) collect2: ld returned 1 exit status *** Error exit code 1 even with a good configure: checking for swap... no checking for swapinfo... /usr/sbin/swapinfo checking for /usr/sbin/swapinfo format... using HP-UX format swapinfo checking for lsps... no checking for sys/stat.h... (cached) yes checking sys/param.h usability... yes checking sys/param.h presence... yes checking for sys/param.h... yes checking for sys/swap.h... yes checking whether swapctl is declared... no checking for swaptbl_t... no checking for swapent_t... no checking for struct swapent.se_nblks... no * execution of check_disk # /opt/nagios/libexec/check_disk -w 20 -c 10 -p / -p /tmp -p /usr -p /var INPUT ERROR: C_IDFP (0.000000) should be less than W_IDFP (0.0) and both should be between zero and 100 percent, inclusive for / INPUT ERROR: C_IDFP (0.000000) should be less than W_IDFP (0.0) and both should be between zero and 100 percent, inclusive for /tmp INPUT ERROR: C_IDFP (4391739930864948500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.000000) should be less than W_IDFP (3862472858398281400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0) and both should be between zero and 100 percent, inclusive for /usr INPUT ERROR: C_IDFP (21143572731146757000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.000000) should be less than W_IDFP (14255999733776453000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0) and both should be between zero and 100 percent, inclusive for /var check_disk: Could not parse arguments Usage: check_disk -w limit -c limit [-p path | -x device] [-t timeout][-m] [-e] [-W limit] [-K limit] [-v] [-q] # bdf Filesystem kbytes used avail %used Mounted on /dev/vg00/lvol0 819200 336688 478792 41% / /dev/vg00/lvol1 8192000 1667256 6473832 20% /var /dev/vg00/lvol2 5242880 2185480 3033560 42% /usr /dev/vg00/lvol3 1048576 184120 857952 18% /tmp [...] ---------------------------------------------------------------------- >Comment By: Ton Voon (tonvoon) Date: 2007-09-29 01:04 Message: Logged In: YES user_id=664364 Originator: NO NeoM, Thanks for the report. I think this has been fixed in SVN HEAD. Please try the snapshot at http://nagiosplug.sf.net/snapshot. I've marked this call as pending so the call will automatically close. Please set to open if it is still an issue. Ton ---------------------------------------------------------------------- Comment By: Jay Lucky (mordecai) Date: 2006-09-27 18:43 Message: Logged In: YES user_id=47867 I came across this problem as well. The compile error on check_swap is because HPUX doesn't have floorf, so you can edit the plugins/common.h file and enable the inline substitution that's been done for Sun. /* Solaris does not have floorf, but floor works. Should probably be in configure */ /* Neither does HPUX! And yes, it should be in configure? */ #if defined(__sun) || defined(__sun__) || defined(__hpux) || defined(__hpux__) static inline float floorf (float x) { return floor(x); } #endif Probably a dirty hack, but it works... As for check_disk, the CVS version works fine for me. There appear to be signifigant differences in the 1.4.3 release tarball and the CVS source tree for this plug-in. Go with a current CVS tree if you want to get this working under HPUX. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=397597&aid=1547070&group_id=29880 From noreply at sourceforge.net Sat Sep 29 02:06:41 2007 From: noreply at sourceforge.net (SourceForge.net) Date: Fri, 28 Sep 2007 17:06:41 -0700 Subject: [Nagiosplug-devel] [ nagiosplug-Bugs-1523748 ] check_disk should error if warn range is subset of critical Message-ID: Bugs item #1523748, was opened at 2006-07-17 10:37 Message generated for change (Comment added) made by tonvoon You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=397597&aid=1523748&group_id=29880 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None >Status: Open Resolution: None Priority: 5 Private: No Submitted By: Dick van den Burg (vandenburgd) Assigned to: Ton Voon (tonvoon) Summary: check_disk should error if warn range is subset of critical Initial Comment: the new se->w_idfp and se->c_idfp in version 1.4.3 are not initialized resulting in the following error (on HP-UX 11.23) check_disk -c 5% -w 10% -p /dev/vg00/lvol1 INPUT ERROR: C_IDFP (0.000000) should be less than W_IDFP (64768802081573470261722606760322190900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0) and both should be between zero and 100 percent, inclusive for /dev/vg00/lvol1 check_disk: Could not parse arguments Usage: check_disk -w limit -c limit [-p path | -x device] [-t timeout][-m] [-e] [-W limit] [-K limit] [-v] [-q] The following patch corrects this *** check_disk.c Mon Jul 17 11:32:26 2006 --- check_disk.c.good Mon Jul 17 11:32:03 2006 *************** *** 462,467 **** --- 462,469 ---- se->c_df = c_df; se->w_dfp = w_dfp; se->c_dfp = c_dfp; + se->w_idfp = w_idfp; + se->c_idfp = c_idfp; se->found = 0; se->found_len = 0; *pathtail = se; ---------------------------------------------------------------------- >Comment By: Ton Voon (tonvoon) Date: 2007-09-29 01:06 Message: Logged In: YES user_id=664364 Originator: NO I'm reopening this as it needs to be thought about, but there's no plans on how to do this yet. ---------------------------------------------------------------------- Comment By: SourceForge Robot (sf-robot) Date: 2007-06-26 03:20 Message: Logged In: YES user_id=1312539 Originator: NO This Tracker item was closed automatically by the system. It was previously set to a Pending status, and the original submitter did not respond within 14 days (the time period specified by the administrator of this Tracker). ---------------------------------------------------------------------- Comment By: Ton Voon (tonvoon) Date: 2007-06-11 10:13 Message: Logged In: YES user_id=664364 Originator: NO Matthias, Sorry, I should have put some more details in here. Dick's original query was because check_disk used to give an error if the range values did not "make sense" - ie, "./check_disk 0 200" (200% free?) and "./check_disk -w 10% -c 15%" (warn if less than 10%, but critical if less than 15% means warn will neven happen). The changes I made a few months ago for range values does not do any validation for the input values. There are some TODO tests in check_disk.t for invalid values and invalid percent figures - I think these are what Dick would like fixed. I'm unsure how general these cases are. Should you always flag an UNKNOWN state if the warning range is completely within the critical range? Should you check values for data types such as percentages (of course, it is possible to get something as 200% of a previous value...). Matthias, this is probably a good conversation for the mailing list if you want to drive. Ton ---------------------------------------------------------------------- Comment By: Matthias Eble (psychotrahe) Date: 2007-06-11 09:21 Message: Logged In: YES user_id=1694341 Originator: NO Announced pending state by sending emails to vandenburgd. Unfortunately the mail couldn't be delivered. Yet setting to pending. ---------------------------------------------------------------------- Comment By: Matthias Eble (psychotrahe) Date: 2007-05-10 17:52 Message: Logged In: YES user_id=1694341 Originator: NO what do you mean with "consistency check"? matthias ---------------------------------------------------------------------- Comment By: Dick van den Burg (vandenburgd) Date: 2006-07-17 16:46 Message: Logged In: YES user_id=780242 As the changes in CURRENT deleted every reference to w_idfp and c_idfp the error also disappears. Unfortunately the consistency check also dispappeared. Dick ---------------------------------------------------------------------- Comment By: Ton Voon (tonvoon) Date: 2006-07-17 11:27 Message: Logged In: YES user_id=664364 Dick, Can you try the snapshot at http://nagiosplug.sourceforge.net/snapshot. There have been fixes to check_disk recently. Please update if there is still a problem. I've marked the call in pending so it will autoclose in 7 days. Ton ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=397597&aid=1523748&group_id=29880 From noreply at sourceforge.net Sat Sep 29 02:18:15 2007 From: noreply at sourceforge.net (SourceForge.net) Date: Fri, 28 Sep 2007 17:18:15 -0700 Subject: [Nagiosplug-devel] [ nagiosplug-Bugs-1250982 ] check_postgresql: configure test for -lcrypto on OpenBSD Message-ID: Bugs item #1250982, was opened at 2005-08-03 13:09 Message generated for change (Settings changed) made by tonvoon You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=397597&aid=1250982&group_id=29880 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Compilation Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: nsturm (nsturm) Assigned to: M. Sean Finney (seanius) >Summary: check_postgresql: configure test for -lcrypto on OpenBSD Initial Comment: Configure tests for -lcrypt, especially when testing for postgresql. At least OpenBSD does not know about libcrypt but only about libcrypto. Furthermore postgresql tests partly do not honour $PGSQL. See the attached diff for clarification. ---------------------------------------------------------------------- Comment By: nsturm (nsturm) Date: 2005-08-25 20:44 Message: Logged In: YES user_id=1323236 The patch was just meant for clarification. I do not know autoconf and do not know any detail regarding libcrypt, so I cannot provide a proper patch. Sorry, Nikolay. ---------------------------------------------------------------------- Comment By: M. Sean Finney (seanius) Date: 2005-08-24 23:25 Message: Logged In: YES user_id=226838 hi, thanks for the report, but there are two issues i see with your patch: - it's a patch against the configure script generated by autoconf instead of the configure.in template - i'm suspecting this will break things on other OS's that do use -lcrypt instead of -lcrypto if you could supply a patch that deals with both of these, i'll include it into our cvs tree. thanks! ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=397597&aid=1250982&group_id=29880 From srunschke at abit.de Sat Sep 29 04:00:49 2007 From: srunschke at abit.de (Sascha Runschke) Date: Sat, 29 Sep 2007 04:00:49 +0200 Subject: [Nagiosplug-devel] CN=Sascha Runschke/O=ABIT is out of the office. Message-ID: Ich werde ab 27.09.2007 nicht im B?ro sein. Ich kehre zur?ck am 08.10.2007. In dringenden F?llen wenden sie sich bitte an meinen Kollegen Herrn Jost Menke unter 02150/9153-0. From alessandro.ren at opservices.com.br Sat Sep 29 23:13:41 2007 From: alessandro.ren at opservices.com.br (Alessandro Ren) Date: Sat, 29 Sep 2007 18:13:41 -0300 Subject: [Nagiosplug-devel] Further development of nsclient. Message-ID: <46FEC005.4090800@opservices.com.br> Hello Ton, my name is Alessandro Ren and I am the lead developer at OpServices (www.opservices.com.br) a brasilian company that uses nagios as its monitoring platform for customers. We have adopted the old nsclient, have fixed bugs and send it to the community and are in the processes of adding some new features to it. We call it opmonagent now. As of the last version of nsclient, it had a check_nt_new that was sent with the package and it never made into the official check_nt. Now that's my question, can a add new features to the check_nt code and submit it to you or should we make a new check_nt? We would very much like to be on the official nagios plugins package and to contribute these new features to the community. Thanks for your attention. []s. From ton.voon at altinity.com Sat Sep 29 23:46:48 2007 From: ton.voon at altinity.com (Ton Voon) Date: Sat, 29 Sep 2007 17:46:48 -0400 Subject: [Nagiosplug-devel] Further development of nsclient. In-Reply-To: <46FEC005.4090800@opservices.com.br> References: <46FEC005.4090800@opservices.com.br> Message-ID: <479F07E7-E5E9-4136-BF9B-669EDA677BC9@altinity.com> Hi Alessandro, On 29 Sep 2007, at 17:13, Alessandro Ren wrote: > As of the last version of nsclient, it had a check_nt_new that was > sent with the package and it never made into the official check_nt. > Now that's my question, can a add new features to the check_nt code > and submit it to you or should we make a new check_nt? > We would very much like to be on the official nagios plugins > package > and to contribute these new features to the community. A similar request was made by Anthony Montibello back in March: http://thread.gmane.org/gmane.network.nagios.plugins.devel/4742/ focus=4739 And my guess is that your check_nt_new is not compatible with Anthony's check_nc_net. check_nt's protocol has become a defacto standard because it is distributed with Nagios Plugins (both your server software support it) and I don't want to fragment it further without a clear direction. If we accepted both your plugins in the core code, the ground is set for anyone else's special implementation of a windows agent to be included, and I don't particularly want this. So I propose this: you and Anthony (and anyone else interested) get together and agree on a communication protocol that both your server software will accept. You publish the protocol on some website somewhere and agree to maintain that document. You may want to raise a ticket with http://www.iana.org/ to get an official port number assigned to your protocol (I managed to get one for a planned piece of software for Altinity called Opsview Envoy - this will be used internally, so we haven't published a protocol for it. You can see it at http://www.iana.org/assignments/port-numbers). You can then both implement server software that takes requests from clients that conform to this protocol. I believe Anthony's is written in .NET and I guess yours is in C, but that will not matter to the client. Then, I would be more than happy to accept a plugin into the core distribution that conforms to the protocol. I would even say that we can continue the maintenance of the plugin (as long as you don't abuse the protocol by making continual changes). For instance, if you both agree to support encryption later, or another authentication method, I can see that we would help with updating the plugin. After all, we maintain the check_http plugin even though we have no control over the HTTP protocol. Is this fair? Ton http://www.altinity.com T: +44 (0)870 787 9243 F: +44 (0)845 280 1725 Skype: tonvoon From noreply at sourceforge.net Sun Sep 30 19:34:37 2007 From: noreply at sourceforge.net (SourceForge.net) Date: Sun, 30 Sep 2007 10:34:37 -0700 Subject: [Nagiosplug-devel] [ nagiosplug-Bugs-1547070 ] HP-UX 11.23/parisc & 1.4.3 Message-ID: Bugs item #1547070, was opened at 2006-08-26 11:10 Message generated for change (Comment added) made by neomagic You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=397597&aid=1547070&group_id=29880 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Compilation Group: Release (specify) >Status: Open Resolution: None Priority: 5 Private: No Submitted By: NeoM (neomagic) Assigned to: Ton Voon (tonvoon) Summary: HP-UX 11.23/parisc & 1.4.3 Initial Comment: i try to compile nagios-plugins (1.4.3) on HP-UX 11i v2 (or 11.23) / parisc and get two quirks: * compilation of check_swap if gcc -DLOCALEDIR=\"/opt/nagios/share/locale\" -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I../lib -I../intl -I/opt/openssl/include -I/opt/openssl/include -Wall -g -O2 -MT check_swap.o -MD -MP -MF ".deps/check_swap.Tpo" -c -o check_swap.o check_swap.c; \ then mv -f ".deps/check_swap.Tpo" ".deps/check_swap.Po"; else rm -f ".deps/check_swap.Tpo"; exit 1; fi check_swap.c: In function `main': check_swap.c:55: warning: unused variable `tmp_mb' check_swap.c: In function `process_arguments': check_swap.c:396: warning: implicit declaration of function `floorf' /bin/sh ../libtool --mode=link --tag=CC gcc -Wall -g -O2 -L. -R/opt/openssl/lib -o check_swap check_swap.o -lm utils.o ../lib/libnagiosplug.a ../lib/libcoreutils.a popen.o -lintl -lgen -lssl -lcrypto gcc -Wall -g -O2 -o check_swap check_swap.o utils.o popen.o -L/export/tmp/nrpe/nagios-plugins-1.4.3/plugins -lm ../lib/libnagiosplug.a ../lib/libcoreutils.a /usr/local/lib/libintl.sl -L/usr/local/lib /usr/local/lib/libiconv.sl -lc -lgen -lssl -lcrypto -Wl,+b -Wl,/usr/local/lib:/opt/openssl/lib /usr/ccs/bin/ld: Unsatisfied symbols: floorf (first referenced in check_swap.o) (code) collect2: ld returned 1 exit status *** Error exit code 1 even with a good configure: checking for swap... no checking for swapinfo... /usr/sbin/swapinfo checking for /usr/sbin/swapinfo format... using HP-UX format swapinfo checking for lsps... no checking for sys/stat.h... (cached) yes checking sys/param.h usability... yes checking sys/param.h presence... yes checking for sys/param.h... yes checking for sys/swap.h... yes checking whether swapctl is declared... no checking for swaptbl_t... no checking for swapent_t... no checking for struct swapent.se_nblks... no * execution of check_disk # /opt/nagios/libexec/check_disk -w 20 -c 10 -p / -p /tmp -p /usr -p /var INPUT ERROR: C_IDFP (0.000000) should be less than W_IDFP (0.0) and both should be between zero and 100 percent, inclusive for / INPUT ERROR: C_IDFP (0.000000) should be less than W_IDFP (0.0) and both should be between zero and 100 percent, inclusive for /tmp INPUT ERROR: C_IDFP (4391739930864948500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.000000) should be less than W_IDFP (3862472858398281400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0) and both should be between zero and 100 percent, inclusive for /usr INPUT ERROR: C_IDFP (21143572731146757000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.000000) should be less than W_IDFP (14255999733776453000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0) and both should be between zero and 100 percent, inclusive for /var check_disk: Could not parse arguments Usage: check_disk -w limit -c limit [-p path | -x device] [-t timeout][-m] [-e] [-W limit] [-K limit] [-v] [-q] # bdf Filesystem kbytes used avail %used Mounted on /dev/vg00/lvol0 819200 336688 478792 41% / /dev/vg00/lvol1 8192000 1667256 6473832 20% /var /dev/vg00/lvol2 5242880 2185480 3033560 42% /usr /dev/vg00/lvol3 1048576 184120 857952 18% /tmp [...] ---------------------------------------------------------------------- >Comment By: NeoM (neomagic) Date: 2007-09-30 19:34 Message: Logged In: YES user_id=209976 Originator: YES sorry. i do not have anymore access to an hp-ux box, so i can't validate this. if someone else could ... thanks ton ---------------------------------------------------------------------- Comment By: Ton Voon (tonvoon) Date: 2007-09-29 02:04 Message: Logged In: YES user_id=664364 Originator: NO NeoM, Thanks for the report. I think this has been fixed in SVN HEAD. Please try the snapshot at http://nagiosplug.sf.net/snapshot. I've marked this call as pending so the call will automatically close. Please set to open if it is still an issue. Ton ---------------------------------------------------------------------- Comment By: Jay Lucky (mordecai) Date: 2006-09-27 19:43 Message: Logged In: YES user_id=47867 I came across this problem as well. The compile error on check_swap is because HPUX doesn't have floorf, so you can edit the plugins/common.h file and enable the inline substitution that's been done for Sun. /* Solaris does not have floorf, but floor works. Should probably be in configure */ /* Neither does HPUX! And yes, it should be in configure? */ #if defined(__sun) || defined(__sun__) || defined(__hpux) || defined(__hpux__) static inline float floorf (float x) { return floor(x); } #endif Probably a dirty hack, but it works... As for check_disk, the CVS version works fine for me. There appear to be signifigant differences in the 1.4.3 release tarball and the CVS source tree for this plug-in. Go with a current CVS tree if you want to get this working under HPUX. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=397597&aid=1547070&group_id=29880