Page 1 of 1

plugin compile error

Posted: Fri Dec 07, 2012 2:17 pm
by cknowlto
please let me know if this is in the wrong place.

Compiling nagios-plugins-1.4.16 on Red Hat

Code: Select all

uname -a
Linux <hostname> 2.6.32-220.el6.x86_64 #1 SMP Wed Nov 9 08:03:13 EST 2011 x86_64 x86_64 x86_64 GNU/Linux
this is the log:

Code: Select all

make[2]: Entering directory `/u04/apps/nagios_install/nagios-plugins-1.4.16/plugins'
gcc -DLOCALEDIR=\"/usr/local/nagios/share/locale\" -DHAVE_CONFIG_H -I. -I.. -I.. -I../lib -I../gl -I../intl   -I/usr/include   -DNP_VERSION='"1.4.16"' -g -O2 -MT check_http.o -MD -MP -MF .deps/check_http.Tpo -c -o check_http.o check_http.c
check_http.c: In function 'process_arguments':
check_http.c:312: error: 'ssl_version' undeclared (first use in this function)
check_http.c:312: error: (Each undeclared identifier is reported only once
check_http.c:312: error: for each function it appears in.)
make[2]: *** [check_http.o] Error 1
make[2]: Leaving directory `/u04/apps/nagios_install/nagios-plugins-1.4.16/plugins'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/u04/apps/nagios_install/nagios-plugins-1.4.16'
make: *** [all] Error 2
This is the pertinent code: check_http.c
<snip>

Code: Select all

#ifdef HAVE_SSL
int check_cert = FALSE;
int ssl_version;
int days_till_exp_warn, days_till_exp_crit;
char *randbuff;
X509 *server_cert;
#  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 */
<snip>
and
<snip>

Code: Select all

#ifdef HAVE_SSL
      if ((temp=strchr(optarg,','))!=NULL) {
        *temp='\0';
        if (!is_intnonneg (temp))
          usage2 (_("Invalid certificate expiration period"), optarg);
        days_till_exp_warn = atoi(optarg);
        *temp=',';
        temp++;
        if (!is_intnonneg (temp))
          usage2 (_("Invalid certificate expiration period"), temp);
        days_till_exp_crit = atoi (temp);
      }
      else {
        days_till_exp_crit=0;
        if (!is_intnonneg (optarg))
          usage2 (_("Invalid certificate expiration period"), optarg);
        days_till_exp_warn = atoi (optarg);
      }
      check_cert = TRUE;
      /* Fall through to -S option */
#endif
    case 'S': /* use SSL */
#ifndef HAVE_SSL
      usage4 (_("Invalid option - SSL is not available"));
#endif
      use_ssl = TRUE;
      if (optarg == NULL || c != 'S')
>>>>>>>>>>>>>>        ssl_version = 0; <<<<<<<<<<<<<<<<<<<<<
      else {
<snip>
the highlighted line will still be reached and compile attempted even though the #IFDEF skipped the declaration when HAVE_SSL = FALSE.

Re: plugin compile error

Posted: Fri Dec 07, 2012 3:34 pm
by bsdtux
did you ever find a solution to this problem? I am having the same issue. My system is a CentOS machine running in a vm environment. nagios complied find but when compiling the nagios-pluging I get

Code: Select all

check_http.c: In function 'process_arguments':
check_http.c:312: error: 'ssl_version' undeclared (first use in this function)
check_http.c:312: error: (Each undeclared identifier is reported only once
check_http.c:312: error: for each function it appears in.)
make[2]: *** [check_http.o] Error 1
make[2]: Leaving directory `/root/downloads/nagios-plugins-1.4.16/plugins'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/root/downloads/nagios-plugins-1.4.16'
make: *** [all] Error 2



Re: plugin compile error

Posted: Fri Dec 07, 2012 3:48 pm
by bsdtux
Looks like the problem is with version 1.4.16. I just downloaded version 1.4.15 and I was able to compile it with no issues.

Re: plugin compile error

Posted: Fri Dec 07, 2012 9:25 pm
by sreinhardt
I noticed this yesterday, on some linux distributions. However at the same time, on other virtual machines that were nearly if not identical(i386 vs x86_64 or same arch), I had no issues compiling. I attempted to update around 8 machines and only 2-3 failed. Just wanted to give an update that this is something that can work, and is possibly a compiler error but is being looked into. Redownloading the tarball or otherwise starting from scratch did not seem to have an effect. I will update as we have more information.

Re: plugin compile error

Posted: Mon Dec 10, 2012 8:32 am
by lcontreras
Hi

According to the error in check_http while installing the nagios-plugin, if you install httpd-devel and rerun the installation, it should works. Actually I have that version nagios-plugins running on CentOS 6.3.

Re: plugin compile error

Posted: Tue Dec 11, 2012 4:40 pm
by cknowlto
It may be fixed now and, of course, if you have SSL installed and configured, this is not an issue, but the code is just wrong and was not tested for this configuration because it would have failed.

I made changes to the code to insure that the variable was declared no matter what the SSL status variable was and I compiled and installed just fine.

What I am not confident about is what behavior changes I may have introduced. Since it is in a module I barely care about, I was just concerned to get the bug out there in the open.

Re: plugin compile error

Posted: Fri Dec 28, 2012 9:13 am
by cs_nagcc
For anyone else trying to use the 1.4.16 version of the plugins, it still produces the error indicated at the beginning of this thread. Using 1.4.15 worked for me as well.