check_http perl script not working with SSL ?

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.
reinaldo.gomes
Posts: 59
Joined: Wed Apr 02, 2014 9:29 am

Re: check_http perl script not working with SSL ?

Post by reinaldo.gomes »

It's a 64b CentOS 6.5.

This is my output:

Code: Select all

[root@localhost libexec]# gcc check_http.c -o check_http2
check_http.c:40:20: error: common.h: No such file or directory
check_http.c:41:22: error: netutils.h: No such file or directory
check_http.c:42:19: error: utils.h: No such file or directory
check_http.c:43:20: error: base64.h: No such file or directory
check_http.c:70: error: ‘FALSE’ undeclared here (not in a function)
check_http.c:81: error: ‘MAX_INPUT_BUFFER’ undeclared here (not in a function)
check_http.c:107: error: ‘NULL’ undeclared here (not in a function)
check_http.c:109: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
check_http.c:115: error: ‘STATE_OK’ undeclared here (not in a function)
check_http.c: In function ‘main’:
check_http.c:151: error: ‘STATE_UNKNOWN’ undeclared (first use in this function)
check_http.c:151: error: (Each undeclared identifier is reported only once
check_http.c:151: error: for each function it appears in.)
check_http.c:153: error: ‘LC_ALL’ undeclared (first use in this function)
check_http.c:154: error: ‘PACKAGE’ undeclared (first use in this function)
check_http.c:154: error: ‘LOCALEDIR’ undeclared (first use in this function)
check_http.c:158: warning: incompatible implicit declaration of built-in function ‘strdup’
check_http.c:159: warning: incompatible implicit declaration of built-in function ‘strlen’
check_http.c:161: error: ‘NP_VERSION’ undeclared (first use in this function)
check_http.c:161: error: ‘VERSION’ undeclared (first use in this function)
check_http.c:164: warning: assignment makes pointer from integer without a cast
check_http.c:166: error: ‘ERROR’ undeclared (first use in this function)
check_http.c:169: error: ‘TRUE’ undeclared (first use in this function)
check_http.c:170: warning: incompatible implicit declaration of built-in function ‘printf’
check_http.c:175: error: ‘SIGALRM’ undeclared (first use in this function)
check_http.c:175: error: ‘socket_timeout_alarm_handler’ undeclared (first use in this function)
check_http.c:176: error: ‘socket_timeout’ undeclared (first use in this function)
check_http.c: In function ‘test_file’:
check_http.c:187: error: ‘R_OK’ undeclared (first use in this function)
check_http.c: In function ‘process_arguments’:
check_http.c:201: error: ‘CHAR_MAX’ undeclared (first use in this function)
check_http.c:206: error: array type has incomplete element type
check_http.c:207: error: ‘STD_LONG_OPTS’ undeclared (first use in this function)
check_http.c:208: error: ‘no_argument’ undeclared (first use in this function)
check_http.c:210: error: ‘optional_argument’ undeclared (first use in this function)
check_http.c:212: error: ‘required_argument’ undeclared (first use in this function)
check_http.c:244: error: ‘ERROR’ undeclared (first use in this function)
check_http.c:248: warning: incompatible implicit declaration of built-in function ‘strcpy’
check_http.c:261: error: ‘EOF’ undeclared (first use in this function)
check_http.c:270: warning: incompatible implicit declaration of built-in function ‘exit’
check_http.c:273: error: ‘NP_VERSION’ undeclared (first use in this function)
check_http.c:277: error: ‘socket_timeout’ undeclared (first use in this function)
check_http.c:277: error: ‘optarg’ undeclared (first use in this function)
check_http.c:290: warning: incompatible implicit declaration of built-in function ‘malloc’
check_http.c:292: warning: incompatible implicit declaration of built-in function ‘realloc’
check_http.c:297: error: ‘TRUE’ undeclared (first use in this function)
check_http.c:359: error: ‘STATE_DEPENDENT’ undeclared (first use in this function)
check_http.c:365: error: ‘STATE_UNKNOWN’ undeclared (first use in this function)
check_http.c:369: error: ‘STATE_WARNING’ undeclared (first use in this function)
check_http.c:371: error: ‘STATE_CRITICAL’ undeclared (first use in this function)
check_http.c:374: warning: incompatible implicit declaration of built-in function ‘printf’
check_http.c:374: warning: passing argument 1 of ‘printf’ makes pointer from integer without a cast
check_http.c:374: note: expected ‘const char *’ but argument is of type ‘int’
check_http.c:378: warning: incompatible implicit declaration of built-in function ‘strdup’
check_http.c:380: warning: incompatible implicit declaration of built-in function ‘strstr’
check_http.c:382: warning: incompatible implicit declaration of built-in function ‘strchr’
check_http.c:391: warning: incompatible implicit declaration of built-in function ‘strlen’
check_http.c:402: warning: incompatible implicit declaration of built-in function ‘strncpy’
check_http.c:417: warning: incompatible implicit declaration of built-in function ‘free’
check_http.c:447: warning: passing argument 1 of ‘printf’ makes pointer from integer without a cast
check_http.c:447: note: expected ‘const char *’ but argument is of type ‘int’
check_http.c:455: error: ‘address_family’ undeclared (first use in this function)
check_http.c:455: error: ‘AF_INET’ undeclared (first use in this function)
check_http.c:505: warning: incompatible implicit declaration of built-in function ‘fprintf’
check_http.c:505: error: ‘stderr’ undeclared (first use in this function)
check_http.c:516: error: ‘optind’ undeclared (first use in this function)
check_http.c:519: warning: incompatible implicit declaration of built-in function ‘strdup’
check_http.c:531: error: ‘thlds’ undeclared (first use in this function)
check_http.c: In function ‘parse_time_string’:
check_http.c:568: error: storage size of ‘tm’ isn’t known
check_http.c:570: warning: incompatible implicit declaration of built-in function ‘memset’
check_http.c:645: error: ‘stdout’ undeclared (first use in this function)
check_http.c:646: warning: incompatible implicit declaration of built-in function ‘printf’
check_http.c: In function ‘expected_statuscode’:
check_http.c:663: warning: incompatible implicit declaration of built-in function ‘strdup’
check_http.c:664: error: ‘STATE_UNKNOWN’ undeclared (first use in this function)
check_http.c:666: warning: assignment makes pointer from integer without a cast
check_http.c:667: warning: incompatible implicit declaration of built-in function ‘strstr’
check_http.c:672: warning: incompatible implicit declaration of built-in function ‘free’
check_http.c: In function ‘check_document_dates’:
check_http.c:707: warning: incompatible implicit declaration of built-in function ‘malloc’
check_http.c:720: warning: incompatible implicit declaration of built-in function ‘strncpy’
check_http.c:723: warning: incompatible implicit declaration of built-in function ‘free’
check_http.c:726: warning: incompatible implicit declaration of built-in function ‘free’
check_http.c:730: warning: incompatible implicit declaration of built-in function ‘free’
check_http.c:737: error: ‘STATE_UNKNOWN’ undeclared (first use in this function)
check_http.c:740: error: ‘STATE_CRITICAL’ undeclared (first use in this function)
check_http.c:764: warning: incompatible implicit declaration of built-in function ‘free’
check_http.c: In function ‘get_content_length’:
check_http.c:799: warning: incompatible implicit declaration of built-in function ‘malloc’
check_http.c:812: warning: incompatible implicit declaration of built-in function ‘strncpy’
check_http.c:815: warning: incompatible implicit declaration of built-in function ‘free’
check_http.c:817: warning: incompatible implicit declaration of built-in function ‘free’
check_http.c: In function ‘prepend_slash’:
check_http.c:831: warning: incompatible implicit declaration of built-in function ‘malloc’
check_http.c:831: warning: incompatible implicit declaration of built-in function ‘strlen’
check_http.c:832: error: ‘STATE_UNKNOWN’ undeclared (first use in this function)
check_http.c:834: warning: incompatible implicit declaration of built-in function ‘strcpy’
check_http.c:835: warning: incompatible implicit declaration of built-in function ‘free’
check_http.c: In function ‘check_http’:
check_http.c:873: error: ‘STATE_CRITICAL’ undeclared (first use in this function)
check_http.c:906: error: ‘TRUE’ undeclared (first use in this function)
check_http.c:929: warning: incompatible implicit declaration of built-in function ‘strlen’
check_http.c:956: warning: incompatible implicit declaration of built-in function ‘printf’
check_http.c:963: warning: incompatible implicit declaration of built-in function ‘strdup’
check_http.c:972: warning: incompatible implicit declaration of built-in function ‘free’
check_http.c:984: error: ‘errno’ undeclared (first use in this function)
check_http.c:984: error: ‘ECONNRESET’ undeclared (first use in this function)
check_http.c:1030: warning: incompatible implicit declaration of built-in function ‘strcspn’
check_http.c:1032: warning: incompatible implicit declaration of built-in function ‘strspn’
check_http.c:1081: warning: incompatible implicit declaration of built-in function ‘strchr’
check_http.c:1100: error: ‘STATE_WARNING’ undeclared (first use in this function)
check_http.c:1105: error: ‘STATE_DEPENDENT’ undeclared (first use in this function)
check_http.c:1127: warning: incompatible implicit declaration of built-in function ‘strstr’
check_http.c:1128: warning: incompatible implicit declaration of built-in function ‘strncpy’
check_http.c:1130: warning: incompatible implicit declaration of built-in function ‘bcopy’
check_http.c:1139: warning: incompatible implicit declaration of built-in function ‘strstr’
check_http.c:1140: warning: incompatible implicit declaration of built-in function ‘strncpy’
check_http.c:1142: warning: incompatible implicit declaration of built-in function ‘bcopy’
check_http.c:1215: error: ‘thlds’ undeclared (first use in this function)
check_http.c:1219: error: ‘STATE_UNKNOWN’ undeclared (first use in this function)
check_http.c: In function ‘redir’:
check_http.c:1245: warning: incompatible implicit declaration of built-in function ‘malloc’
check_http.c:1247: error: ‘STATE_UNKNOWN’ undeclared (first use in this function)
check_http.c:1249: warning: incompatible implicit declaration of built-in function ‘strcspn’
check_http.c:1254: warning: incompatible implicit declaration of built-in function ‘sscanf’
check_http.c:1257: warning: incompatible implicit declaration of built-in function ‘strspn’
check_http.c:1258: warning: incompatible implicit declaration of built-in function ‘strlen’
check_http.c:1266: warning: incompatible implicit declaration of built-in function ‘strspn’
check_http.c:1280: warning: incompatible implicit declaration of built-in function ‘realloc’
check_http.c:1299: warning: incompatible implicit declaration of built-in function ‘strcpy’
check_http.c:1305: warning: incompatible implicit declaration of built-in function ‘strcpy’
check_http.c:1314: warning: incompatible implicit declaration of built-in function ‘strrchr’
check_http.c:1319: warning: incompatible implicit declaration of built-in function ‘strcpy’
check_http.c:1334: error: ‘STATE_WARNING’ undeclared (first use in this function)
check_http.c:1346: warning: incompatible implicit declaration of built-in function ‘strcpy’
check_http.c:1348: warning: incompatible implicit declaration of built-in function ‘free’
check_http.c:1349: warning: incompatible implicit declaration of built-in function ‘strdup’
check_http.c:1369: warning: incompatible implicit declaration of built-in function ‘printf’
check_http.c:1370: warning: passing argument 1 of ‘printf’ makes pointer from integer without a cast
check_http.c:1370: note: expected ‘const char *’ but argument is of type ‘int’
check_http.c: In function ‘server_type_check’:
check_http.c:1382: error: ‘TRUE’ undeclared (first use in this function)
check_http.c: In function ‘perfd_time’:
check_http.c:1397: error: ‘thlds’ undeclared (first use in this function)
check_http.c:1397: error: ‘TRUE’ undeclared (first use in this function)
check_http.c: In function ‘perfd_size’:
check_http.c:1430: error: ‘TRUE’ undeclared (first use in this function)
check_http.c: In function ‘print_help’:
check_http.c:1438: error: ‘NP_VERSION’ undeclared (first use in this function)
check_http.c:1440: warning: incompatible implicit declaration of built-in function ‘printf’
check_http.c:1441: error: ‘COPYRIGHT’ undeclared (first use in this function)
check_http.c:1452: warning: passing argument 1 of ‘printf’ makes pointer from integer without a cast
check_http.c:1452: note: expected ‘const char *’ but argument is of type ‘int’
check_http.c:1456: error: ‘UT_HELP_VRSN’ undeclared (first use in this function)
check_http.c:1457: error: ‘UT_EXTRA_OPTS’ undeclared (first use in this function)
check_http.c:1468: error: ‘UT_IPv46’ undeclared (first use in this function)
check_http.c:1538: error: ‘UT_WARN_CRIT’ undeclared (first use in this function)
check_http.c:1540: error: ‘UT_CONN_TIMEOUT’ undeclared (first use in this function)
check_http.c:1540: error: ‘DEFAULT_SOCKET_TIMEOUT’ undeclared (first use in this function)
check_http.c:1542: error: ‘UT_VERBOSE’ undeclared (first use in this function)
check_http.c:1584: error: ‘UT_SUPPORT’ undeclared (first use in this function)
check_http.c: In function ‘print_usage’:
check_http.c:1593: warning: incompatible implicit declaration of built-in function ‘printf’
I opened this raw file in my windows host:
https://raw.githubusercontent.com/nagio ... eck_http.c

and copy/pasted it directly into my CentOS host via Putty.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: check_http perl script not working with SSL ?

Post by tmcdonald »

Yea, that's why. Our plugins have some common shared functions that are included in header files. By just downloading the check_http.c you are not including any of the necessary headers. I would suggest compiling the whole plugins project and hand-picking the check_http and any other plugins you may need.
Former Nagios employee
reinaldo.gomes
Posts: 59
Joined: Wed Apr 02, 2014 9:29 am

Re: check_http perl script not working with SSL ?

Post by reinaldo.gomes »

Is this the whole plugins package? Does it differ from GitHub's files?
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: check_http perl script not working with SSL ?

Post by tmcdonald »

Assuming they had their coffee both of those links should be for the 2.0.3 release.
Former Nagios employee
reinaldo.gomes
Posts: 59
Joined: Wed Apr 02, 2014 9:29 am

Re: check_http perl script not working with SSL ?

Post by reinaldo.gomes »

So, I've downloaded nagios-plugins-2.0.3 to my /tmp/ folder, unpacked, then I did (from inside the unpacked folder):

./configure
make all
make install

But how do I know if my plugins were really updated?

Also, when I do: "yum install nagios-plugins-all"
I get a list of 'version 1.4.16-10.el6' plugins.
Does it mean my repository is outdated, since the latest package's version is 2.0.3?
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: check_http perl script not working with SSL ?

Post by abrist »

reinaldo.gomes wrote:But how do I know if my plugins were really updated?
Well, unless you specified an install folder in configure, they would have installed to the default path of: /usr/local/nagios/libexec
You can check the version by running "-V" with any of the plugins:

Code: Select all

/usr/local/nagios/libexec/check_http -V
reinaldo.gomes wrote:Does it mean my repository is outdated, since the latest package's version is 2.0.3?
Yes, the cent/rhel repos are out of date.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
reinaldo.gomes
Posts: 59
Joined: Wed Apr 02, 2014 9:29 am

Re: check_http perl script not working with SSL ?

Post by reinaldo.gomes »

abrist wrote:You can check the version by running "-V" with any of the plugins:
Indeed. I can see it's updated (2.0.3). But the '-t: unknown' option doesn't seem to work. Maybe because I got the plugins from nagios-plugins.org, not GitHub.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: check_http perl script not working with SSL ?

Post by tmcdonald »

Does it give any errors for the -t option or does it just not work as expected? Please post the output of running the command from the CLI.
Former Nagios employee
reinaldo.gomes
Posts: 59
Joined: Wed Apr 02, 2014 9:29 am

Re: check_http perl script not working with SSL ?

Post by reinaldo.gomes »

Code: Select all

[root@localhost libexec]# ./check_http localhost -t :unknown
check_http: Timeout interval must be a positive integer - :unknown
Usage:
 check_http -H <vhost> | -I <IP-address> [-u <uri>] [-p <port>]
       [-J <client certificate file>] [-K <private key>]
       [-w <warn time>] [-c <critical time>] [-t <timeout>] [-L] [-E] [-a auth]
       [-b proxy_auth] [-f <ok|warning|critcal|follow|sticky|stickyport>]
       [-e <expect>] [-d string] [-s string] [-l] [-r <regex> | -R <case-insensitive regex>]
       [-P string] [-m <min_pg_size>:<max_pg_size>] [-4|-6] [-N] [-M <age>]
       [-A string] [-k string] [-S <version>] [--sni] [-C <warn_age>[,<crit_age>]]
       [-T <content-type>] [-j method]
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: check_http perl script not working with SSL ?

Post by abrist »

You need to download the "timeout_state" branch from github as this code is not yet into trunk. Follow the steps below:

Code: Select all

cd /tmp
wget https://github.com/nagios-plugins/nagios-plugins/archive/timeout_state.zip
unzip timeout_state
cd nagios-plugins-timeout_state
./tools/setup
./configure
make
Now test the plugin:

Code: Select all

./check_http localhost -t :unknown
If it works, install the plugins:

Code: Select all

make install
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Locked