plugin compile error

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
cknowlto
Posts: 2
Joined: Fri Dec 07, 2012 2:02 pm

plugin compile error

Post 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.
bsdtux
Posts: 2
Joined: Fri Dec 07, 2012 3:31 pm

Re: plugin compile error

Post 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


bsdtux
Posts: 2
Joined: Fri Dec 07, 2012 3:31 pm

Re: plugin compile error

Post 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.
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: plugin compile error

Post 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.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
lcontreras
Posts: 48
Joined: Thu Sep 13, 2012 7:15 pm

Re: plugin compile error

Post 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.
cknowlto
Posts: 2
Joined: Fri Dec 07, 2012 2:02 pm

Re: plugin compile error

Post 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.
cs_nagcc
Posts: 17
Joined: Fri Dec 28, 2012 7:35 am

Re: plugin compile error

Post 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.
Locked