Page 2 of 3
Re: Install Check_HTTP_Content
Posted: Mon May 08, 2017 2:01 pm
by t3dus
I added these 3 commands to commands.cfg
Code: Select all
define command {
command_name SG_URL
command_line check_http -H snapgeek.com -S -u https://snapgeek.com/meet-matt/
}
define command {
command_name SG_SSL
command_line check_http -H 198.54.116.191 -S
}
define command {
command_name SG_SSL_CERT
command_line check_http -H snapgeek.com -C 365
}
and added this to the host file..
Code: Select all
define service{
use generic-service ; Name of service template to use
host_name snapgeek.com
service_description URL
check_command SG_URL
notifications_enabled 1
}
define service{
use generic-service ; Name of service template to use
host_name snapgeek.com
service_description SSL
check_command SG_SSL
notifications_enabled 1
}
define service{
use generic-service ; Name of service template to use
host_name snapgeek.com
service_description Cert Age
check_command SG_SSL_CERT
notifications_enabled 1
}
but all 3 result in the error
Code: Select all
(No output on stdout) stderr: execvp(check_http, ...) failed. errno is 2: No such file or directory
Re: Install Check_HTTP_Content
Posted: Mon May 08, 2017 2:13 pm
by dwhitfield
Try the following:
/usr/local/nagios/libexec/check_http -H snapgeek.com -u https://snapgeek.com/meet-matt/
Assuming that works, use that pattern for the others.
I'm assuming libexec because you compiled, but if your plugins are in a different directory you'll need to use whatever directory you used.
Re: Install Check_HTTP_Content
Posted: Mon May 08, 2017 2:26 pm
by t3dus
dwhitfield wrote:Try the following:
/usr/local/nagios/libexec/check_http -H snapgeek.com -u https://snapgeek.com/meet-matt/
Assuming that works, use that pattern for the others.
I'm assuming libexec because you compiled, but if your plugins are in a different directory you'll need to use whatever directory you used.
Returned the following
Code: Select all
# /usr/local/nagios/etc/objects# /usr/local/nagios/libexec/check_http -H snapgeek.com -u https://snapgeek.com/meet-matt/
HTTP OK: HTTP/1.1 301 Moved Permanently - 344 bytes in 0.776 second response time |time=0.775873s;;;0.000000 size=344B;;;0
Re: Install Check_HTTP_Content
Posted: Mon May 08, 2017 2:28 pm
by dwhitfield
Looks like it worked. Did you have any other questions?
Re: Install Check_HTTP_Content
Posted: Mon May 08, 2017 2:32 pm
by t3dus
dwhitfield wrote:Looks like it worked. Did you have any other questions?
Yeah worked by that command but still shows critical error in Nagios
Re: Install Check_HTTP_Content
Posted: Mon May 08, 2017 2:35 pm
by dwhitfield
Did you change the command definitions to make what worked from the command line?
For example:
Code: Select all
define command {
command_name SG_URL
command_line /usr/local/nagios/libexec/check_http -H snapgeek.com -u https://snapgeek.com/meet-matt//
}
Re: Install Check_HTTP_Content
Posted: Mon May 08, 2017 2:52 pm
by t3dus
dwhitfield wrote:Did you change the command definitions to make what worked from the command line?
For example:
Code: Select all
define command {
command_name SG_URL
command_line /usr/local/nagios/libexec/check_http -H snapgeek.com -u https://snapgeek.com/meet-matt//
}
Clearly I missed that part. lol. That works for the URL thing.
Though I still have two issues..
- I want nagios to visit the site and search for a "keyword" on the site and if it doesn't exist give an error.
- The SSL Cert checker doesn't work. When I run the same test command it results in the error "check_http: Invalid option - SSL is not available"
Re: Install Check_HTTP_Content
Posted: Mon May 08, 2017 3:03 pm
by dwhitfield
I'm not sure what you are trying to do with the ssl and the string, but it works for me.
Code: Select all
[root@centos6x64 libexec]# ./check_http -H snapgeek.com -s 'yourstring' -S
HTTP CRITICAL: HTTP/1.1 200 OK - string 'yourstring' not found on 'https://snapgeek.com:443/' - 36614 bytes in 1.030 second response time |time=1.030108s;;;0.000000 size=36614B;;;0
[root@centos6x64 libexec]# ./check_http -H snapgeek.com -S
HTTP OK: HTTP/1.1 200 OK - 36614 bytes in 1.027 second response time |time=1.026507s;;;0.000000 size=36614B;;;0
[root@centos6x64 libexec]# ./check_http -H snapgeek.com -s 'Take' -S
HTTP OK: HTTP/1.1 200 OK - 36614 bytes in 2.059 second response time |time=2.059498s;;;0.000000 size=36614B;;;0
[root@centos6x64 libexec]# ./check_http -V
check_http v2.0.3 (nagios-plugins 2.0.3)
Re: Install Check_HTTP_Content
Posted: Mon May 08, 2017 3:15 pm
by t3dus
This is what I just tried and reproduced the error. part of it I stole from your line above just for fun.
Code: Select all
root@raspberrypi:/usr/local/nagios/etc/objects# /usr/local/nagios/libexec/check_http -V
check_http v2.1.1 (nagios-plugins 2.1.1)
You have a newer version than I have for starters..
Code: Select all
root@raspberrypi:/usr/local/nagios/etc/objects# /usr/local/nagios/libexec/check_http -H snapgeek.com -S
check_http: Invalid option - SSL is not available
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]
Re: Install Check_HTTP_Content
Posted: Mon May 08, 2017 3:36 pm
by dwhitfield
Did you also compile the plugins? If so, looks like you may have missed the first step in our instructions
apt-get install -y autoconf gcc libc6 libmcrypt-dev make libssl-dev wget bc gawk dc build-essential snmp libnet-snmp-perl gettext (which would include not using our instructions)
The instructions at
https://support.nagios.com/kb/article.php?id=515 are for 2.2.0, but you might as well use those if you are going to recompile. You could just recompile check_http, but I don't believe we have pre-written instructions for that. Just ignore the NRPE instructions. The plugin instructions are after those.
If you didn't compile the plugins, I'm not sure if the repos have a way to tell it to use ssl. Probably there's not a way to just uninstall check_http from the repos, so compiling might be the way to go with those too.