Page 1 of 2
[SOLVED] Trying to use -u and -s in check_http command
Posted: Tue Oct 16, 2012 6:19 am
by tay9000
Hello all, I am trying to use -u and -s with the default check_http set up and it results in "Return code of 127 is out of bounds - plugin may be missing."
Here is my command definition:
Code: Select all
define command{
command_name check_http
command_line $USER1$/check_http -I $HOSTADDRESS$ $ARG1$
}
Here is my service check definition:
Code: Select all
define service{
host_name HVACs
service_description Unit01 Comp 1 Hot Gas Temperature
check_command check_http!-u /hvac_temp/index.php?mode=fetch\&hvac=1\&probe=1 -s "Unit01 Hot Gas Bypass (Compressor 1) = OK"
max_check_attempts 3
}
I know I can just add a custom http command like
$USER1$/check_http -I $HOSTADDRESS$ -u $ARG1$ -s $ARG2$ but I'd rather not create a new custom command every time I need to do something like this. Is what I am trying to do possible? Thanks!
Re: Trying to use -u and -s in check_http command with 1 $AR
Posted: Tue Oct 16, 2012 5:05 pm
by jsmurphy
Have you tried running the command from the command line? That will go a long way to helping diagnose what and where the problem is... it should also give you a more informative error message.
Code: Select all
/usr/local/nagios/libexec/check_http -I hostname -u "/hvac_temp/index.php?mode=fetch\&hvac=1\&probe=1" -s "Unit01 Hot Gas Bypass (Compressor 1) = OK"
Re: Trying to use -u and -s in check_http command with 1 $AR
Posted: Fri Oct 19, 2012 4:19 am
by tay9000
I tried that before even attempting to write anything to the config files and it runs fine but does not seem to work the way I have it in the config.
Code: Select all
[user@server ~]$ check_http -I 192.168.10.10 -u /hvac_temp/index.php?mode=fetch\&hvac=1\&probe=1 -s "Unit01 Hot Gas Bypass (Compressor 1) = OK"
HTTP OK: HTTP/1.1 200 OK - 1773 bytes in 0.007 second response time |time=0.006537s;;;0.000000 size=1773B;;;0
Re: Trying to use -u and -s in check_http command with 1 $AR
Posted: Fri Oct 19, 2012 5:51 am
by tay9000
I tried creating a custom command and service and I get the same error message.
Code: Select all
define command{
command_name check_hvac
command_line $USER1$/check_http -I $HOSTADDRESS$ -u $ARG1$ -s $ARG2$
}
Code: Select all
define service{
host_name HVACs
service_description Unit01 Comp 1 Hot Gas Temperature
check_command check_hvac!/hvac_temp/index.php?mode=fetch\&hvac=1\&probe=1!"Unit01 Hot Gas Bypass (Compressor 1) = OK"
max_check_attempts 3
}
However, if I just use
$USER1$/check_http -I $HOSTADDRESS$ -u $ARG1$ and
check_hvac!/hvac_temp/index.php?mode=fetch\&hvac=1\&probe=1 it works fine hmm....
Re: Trying to use -u and -s in check_http command with 1 $AR
Posted: Fri Oct 19, 2012 7:58 am
by g.turri
have you installed the main plugin for nagios?
Look at /usr/local/nagios/libexec
is it empty?
If it is you have to install the main plugin: look at this thread if you need to install it... I've posted an howto guide to install them with nagios core.
Re: Trying to use -u and -s in check_http command with 1 $AR
Posted: Fri Oct 19, 2012 9:27 am
by tay9000
Yes, everything is installed. I have many probes set up for ping, basic http, smtp, etc. I am just having issues in this specific situation.
Here is my ls output of the folder. However, I use FreeBSD so the lib folder is in a different location. My $USER1$ macro is also correctly set to $USER1$=/usr/local/libexec/nagios.
Code: Select all
[user@server ~]$ ls -lh /usr/local/libexec/nagios/
total 2432
-r-xr-xr-x 1 root wheel 108k Sep 6 23:23 check_apt
-r-xr-xr-x 1 root wheel 2.2k Sep 6 23:23 check_breeze
-r-xr-xr-x 1 root wheel 48k Sep 6 23:23 check_by_ssh
lrwxr-xr-x 1 root wheel 9B Sep 6 23:23 check_clamd -> check_tcp
-r-xr-xr-x 1 root wheel 36k Sep 6 23:23 check_cluster
-r-sr-xr-x 1 root wheel 48k Sep 6 23:23 check_dhcp
-r-xr-xr-x 1 root wheel 44k Sep 6 23:23 check_dig
-r-xr-xr-x 1 root wheel 121k Sep 6 23:23 check_disk
-r-xr-xr-x 1 root wheel 8.5k Sep 6 23:23 check_disk_smb
-r-xr-xr-x 1 root wheel 49k Sep 6 23:23 check_dns
-r-xr-xr-x 1 root wheel 27k Sep 6 23:23 check_dummy
-r-xr-xr-x 1 root wheel 3k Sep 6 23:23 check_file_age
-r-xr-xr-x 1 root wheel 6.2k Sep 6 23:23 check_flexlm
lrwxr-xr-x 1 root wheel 9B Sep 6 23:23 check_ftp -> check_tcp
-r-xr-xr-x 1 root wheel 44k Sep 6 23:23 check_hpjd
-r-xr-xr-x 1 root wheel 169k Sep 6 23:23 check_http
-r-sr-xr-x 1 root wheel 51k Sep 6 23:23 check_icmp
-r-xr-xr-x 1 root wheel 14k Sep 6 23:23 check_ifoperstatus
-r-xr-xr-x 1 root wheel 12k Sep 6 23:23 check_ifstatus
lrwxr-xr-x 1 root wheel 9B Sep 6 23:23 check_imap -> check_tcp
-r-xr-xr-x 1 root wheel 6.8k Sep 6 23:23 check_ircd
lrwxr-xr-x 1 root wheel 9B Sep 6 23:23 check_jabber -> check_tcp
-r-xr-xr-x 1 root wheel 40k Sep 6 23:23 check_load
-r-xr-xr-x 1 root wheel 5.9k Sep 6 23:23 check_log
-r-xr-xr-x 1 root wheel 19k Sep 6 23:23 check_mailq
-r-xr-xr-x 1 root wheel 38k Sep 6 23:23 check_mrtg
-r-xr-xr-x 1 root wheel 37k Sep 6 23:23 check_mrtgtraf
-r-xr-xr-x 1 root wheel 10k Sep 29 06:42 check_multi
-r-xr-xr-x 1 root wheel 44k Sep 6 23:23 check_mysql
-r-xr-xr-x 1 root wheel 41k Sep 6 23:23 check_mysql_query
-r-xr-xr-x 1 root wheel 40k Sep 6 23:23 check_nagios
lrwxr-xr-x 1 root wheel 9B Sep 6 23:23 check_nntp -> check_tcp
lrwxr-xr-x 1 root wheel 9B Sep 6 23:23 check_nntps -> check_tcp
-r-xr-xr-x 1 root wheel 21k Sep 7 01:47 check_nrpe2
-r-xr-xr-x 1 root wheel 49k Sep 6 23:23 check_nt
-r-xr-xr-x 1 root wheel 48k Sep 6 23:23 check_ntp
-r-xr-xr-x 1 root wheel 48k Sep 6 23:23 check_ntp_peer
-r-xr-xr-x 1 root wheel 44k Sep 6 23:23 check_ntp_time
-r-xr-xr-x 1 root wheel 60k Sep 6 23:23 check_nwstat
-r-xr-xr-x 1 root wheel 8.1k Sep 6 23:23 check_oracle
-r-xr-xr-x 1 root wheel 44k Sep 6 23:23 check_overcr
-r-xr-xr-x 1 root wheel 50k Sep 6 23:23 check_ping
lrwxr-xr-x 1 root wheel 9B Sep 6 23:23 check_pop -> check_tcp
-r-xr-xr-x 1 root wheel 116k Sep 6 23:23 check_procs
-r-xr-xr-x 1 root wheel 41k Sep 6 23:23 check_radius
-r-xr-xr-x 1 root wheel 41k Sep 6 23:23 check_real
-r-xr-xr-x 1 root wheel 9.4k Sep 6 23:23 check_rpc
-r-xr-xr-x 1 root wheel 1.1k Sep 6 23:23 check_sensors
lrwxr-xr-x 1 root wheel 9B Sep 6 23:23 check_simap -> check_tcp
-r-xr-xr-x 1 root wheel 129k Sep 6 23:23 check_smtp
-r-xr-xr-x 1 root wheel 153k Sep 6 23:23 check_snmp
lrwxr-xr-x 1 root wheel 9B Sep 6 23:23 check_spop -> check_tcp
-r-xr-xr-x 1 root wheel 40k Sep 6 23:23 check_ssh
lrwxr-xr-x 1 root wheel 9B Sep 6 23:23 check_ssmtp -> check_tcp
-r-xr-xr-x 1 root wheel 41k Sep 6 23:23 check_swap
-r-xr-xr-x 1 root wheel 53k Sep 6 23:23 check_tcp
-r-xr-xr-x 1 root wheel 40k Sep 6 23:23 check_time
lrwxr-xr-x 1 root wheel 9B Sep 6 23:23 check_udp -> check_tcp
-r-xr-xr-x 1 root wheel 45k Sep 6 23:23 check_ups
-r-xr-xr-x 1 root wheel 38k Sep 6 23:23 check_users
-r-xr-xr-x 1 root wheel 2.9k Sep 6 23:23 check_wave
-r-xr-xr-x 1 root wheel 40k Sep 6 23:23 negate
-r-xr-xr-x 1 root wheel 38k Sep 6 23:23 urlize
-r-xr-xr-x 1 root wheel 1.9k Sep 6 23:23 utils.pm
-r-xr-xr-x 1 root wheel 880B Sep 6 23:23 utils.sh
Re: Trying to use -u and -s in check_http command with 1 $AR
Posted: Sun Oct 21, 2012 5:46 pm
by jsmurphy
Hmmmm what an interesting problem, just out of curiousity if you were to create the command definition entirely hard coded (excluding hostaddress) do you have the same issue?
check_http is prone to having little issues. It also might be worth while putting the string to match in single quotes instead of double quotes, in case it's interpreting those brackets or something weird (I don't see why it would... but it won't make things worse to try it).
Re: Trying to use -u and -s in check_http command with 1 $AR
Posted: Thu Oct 25, 2012 2:54 am
by tay9000
I thought it was pretty interesting too. And annoying. Single or double quotes do not make any difference. The problem is actually worse than I thought. I basically cannot use more than 1 argument with the check_http command. I think I've tried all the combinations I can. I could try installing a new check_http plugin but I am just going to set up Nagios on a CentOS server and see if I fair better with that.
It works if I do this:
Code: Select all
define command{
command_name check_hvac
command_line /usr/local/libexec/nagios/check_http -I 192.168.10.10 -u /hvac_temp/index.php?mode=fetch\&hvac=1\&probe=1 -s "Unit01 Hot Gas Bypass (Compressor 1) = OK"
}
define service{
host_name HVACs
service_description Unit01 Comp 1 Hot Gas Temperature
check_command check_hvac
max_check_attempts 3
}
This also works:
Code: Select all
define command{
command_name check_hvac
command_line /usr/local/libexec/nagios/check_http -I $HOSTADDRESS$ -u /hvac_temp/index.php?mode=fetch\&hvac=1\&probe=1 -s "Unit01 Hot Gas Bypass (Compressor 1) = OK"
}
# Hot Gas Bypass Temperature
define service{
host_name HVACs
service_description Unit01 Comp 1 Hot Gas Temperature
check_command check_hvac
max_check_attempts 3
}
This works:
Code: Select all
define command{
command_name check_hvac
command_line /usr/local/libexec/nagios/check_http -I $HOSTADDRESS$ -u /hvac_temp/index.php?mode=fetch\&hvac=1\&probe=1 $ARG1$
}
# Hot Gas Bypass Temperature
define service{
host_name HVACs
service_description Unit01 Comp 1 Hot Gas Temperature
check_command check_hvac!-s "Unit01 Hot Gas Bypass (Compressor 1) = OK"
max_check_attempts 3
}
Doesn't work:
Code: Select all
define command{
command_name check_hvac
command_line /usr/local/libexec/nagios/check_http -I 192.168.10.10 $ARG1$
}
define service{
host_name HVACs
service_description Unit01 Comp 1 Hot Gas Temperature
check_command check_hvac!-u /hvac_temp/index.php?mode=fetch\&hvac=1\&probe=1 -s "Unit01 Hot Gas Bypass (Compressor 1) = OK"
max_check_attempts 3
}
Doesn't work:
Code: Select all
define command{
command_name check_hvac
command_line /usr/local/libexec/nagios/check_http -I $HOSTADDRESS$ $ARG1$ -s "Unit01 Hot Gas Bypass (Compressor 1) = OK"
}
# Hot Gas Bypass Temperature
define service{
host_name HVACs
service_description Unit01 Comp 1 Hot Gas Temperature
check_command check_hvac!-u /hvac_temp/index.php?mode=fetch\&hvac=1\&probe=1
max_check_attempts 3
}
Doesn't work:
Code: Select all
define command{
command_name check_hvac
command_line $USER1$/check_http -I $HOSTADDRESS$ $ARG1$ $ARG2$
}
# Hot Gas Bypass Temperature
define service{
host_name HVACs
service_description Unit01 Comp 1 Hot Gas Temperature
check_command check_hvac!-u /hvac_temp/index.php?mode=fetch\&hvac=1\&probe=1!-s "Unit01 Hot Gas Bypass (Compressor 1) = OK"
max_check_attempts 3
}
Doesn't work:
Code: Select all
define command{
command_name check_hvac
command_line $USER1$/check_http -I $HOSTADDRESS$ -u $ARG1$ -s $ARG2$
}
# Hot Gas Bypass Temperature
define service{
host_name HVACs
service_description Unit01 Comp 1 Hot Gas Temperature
check_command check_hvac!/hvac_temp/index.php?mode=fetch\&hvac=1\&probe=1!Unit01 Hot Gas
Bypass (Compressor 1) = OK"
max_check_attempts 3
}
Doesn't work:
Code: Select all
define command{
command_name check_hvac
command_line /usr/local/libexec/nagios/check_http -I 192.168.10.10 -u $ARG1$ -s $ARG2$
}
# Hot Gas Bypass Temperature
define service{
host_name HVACs
service_description Unit01 Comp 1 Hot Gas Temperature
check_command check_hvac!/hvac_temp/index.php?mode=fetch\&hvac=1\&probe=1!"Unit01 Hot Gas Bypass (Compressor 1) = OK"
max_check_attempts 3
}
Doesn't work:
Code: Select all
define command{
command_name check_hvac
command_line /usr/local/libexec/nagios/check_http -I 192.168.10.10 $ARG1$ $ARG2$
}
# Hot Gas Bypass Temperature
define service{
host_name HVACs
service_description Unit01 Comp 1 Hot Gas Temperature
check_command check_hvac!-u /hvac_temp/index.php?mode=fetch\&hvac=1\&probe=1!-s "Unit01 Hot Gas Bypass (Compressor 1) = OK"
max_check_attempts 3
}
Re: Trying to use -u and -s in check_http command with 1 $AR
Posted: Fri Oct 26, 2012 4:37 pm
by jsmurphy
Hmmm... yeah that is pretty broken. I would probably also let the nagios-plugins development team know so they can investigate and fix it:
http://sourceforge.net/tracker/?group_i ... tid=397597
Re: Trying to use -u and -s in check_http command with 1 $AR
Posted: Thu Nov 22, 2012 5:22 am
by tay9000
This has been resolved. It turns out the ampersands need to be double escaped when used in the configuration like in the example below. Now I feel kind of silly because I have a FreeBSD and CentOS Nagios server now....
Code: Select all
check_hvac!/hvac_temp/index.php?mode=fetch\\&hvac=1\\&probe=1!"Unit01 Hot Gas Bypass (Compressor 1) = OK"