check_http succeeds on command line but fails in nagios


I execute this command in the terminal and it succeeds:
[[email protected] libexec]# ./check_http -I -u /storage_check.php -t 300
HTTP OK HTTP/1.1 200 OK - 61438 bytes in 86.078 seconds |time=86.078401s;;;0.000000 size=61438B;;;0

But when Nagios executes the command it fails with timeout.
Current Status: CRITICAL
Status Information: (Service Check Timed Out)
Performance Data:
Current Attempt: 9/16
State Type: SOFT
Last Check Type: ACTIVE
Last Check Time: 09-16-2005 12:48:46
Status Data Age: 0d 0h 3m 42s
Next Scheduled Active Check: 09-16-2005 13:00:46
Latency: 0.147 seconds
Check Duration: 60.004 seconds
Last State Change: 04-12-2005 10:38:43
Current State Duration: 157d 2h 13m 45s
Last Service Notification: 09-16-2005 12:03:31
Current Notification Number: 213
Is This Service Flapping? N/A
Percent State Change: N/A
In Scheduled Downtime? NO
Last Update: 09-16-2005 12:52:24

Any ideas why???


Yes, you have a typo or something in your configs. Double/tripple check all your definitions, $USER1$ definition, etc again.


I cannot find anything wrong. This is the only check_http that times out.

From resourse.cfg

Sets $USER1$ to be the path to the plugins


From checkcommands.cfg

‘check_phase_2’ command definition

define command{
command_name check_phase_2
command_line $USER1$/check_http -I -t 300 -u “/storage_check.php” -s “No errors.”

From services.cfg

Service definition

define service{
use test-phases
host_name stream7
service_description Phase 02 - Storage Pings
is_volatile 0
check_period 24x7
max_check_attempts 6
normal_check_interval 4
retry_check_interval 2
contact_groups admins
notification_interval 240
notification_period 24x7
notification_options c,r
check_command check_phase_2


Aha… service check timeout value in nagios.cfg needed to be upped to about 120. All good now.


strange fix. That’s 2 minutes. How long does the check take to execute when done by command line?