[SOLVED] check_http failing to compile regex

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.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: check_http failing to compile regex

Post by tgriep »

Try changing the command and service check like the following and see if it works for you.

Code: Select all

define command{
        command_name    check_https_uri_regex
        command_line    $USER1$/check_http -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ -t 4 -u $ARG3$ -r $ARG4$ --ssl
        }
      
      
define service {
        use                     generic-service
        host_name               $HOSTNAME$
        servicegroups           SomeServiceaGroup
        service_description     Some Description
        check_command           check_https_uri_regex!3!5!'/api/assort/failed'!'\[\]'!
}
Be sure to check out our Knowledgebase for helpful articles and solutions!
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: check_http failing to compile regex

Post by ssax »

I had to set it up this way for it to work on mine:

Code: Select all

define command{
        command_name    check_https_uri_regex
        command_line    $USER1$/check_http -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ -t 4 -u $ARG3$ -r '$ARG4$' --ssl
        }

define service {
        use                     generic-service
        host_name               $HOSTNAME$
        servicegroups           SomeServiceaGroup
        service_description     Some Description
        check_command           check_https_uri_regex!3!5!/api/assort/failed!'\\[\\]'!
}
northwood128
Posts: 9
Joined: Mon Jun 15, 2015 12:43 pm

Re: check_http failing to compile regex

Post by northwood128 »

I've tried all these options. None of them seem to work. I either get a critical for no matches when the service certainly responds [], or the same compilation error. :cry:
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: check_http failing to compile regex

Post by tmcdonald »

What version of check_http are you using?

Code: Select all

/usr/local/nagios/libexec/check_http --version
I ask because that is our normal plugin path, but you seem to also use ~/development/nagios-plugins/check_http and /usr/local/nagios/production/libexec/check_http. Have you been modifying the code at all?
Former Nagios employee
northwood128
Posts: 9
Joined: Mon Jun 15, 2015 12:43 pm

Re: check_http failing to compile regex

Post by northwood128 »

That's just the path our our Nagios installation and my personal workplace. It haven't been messing up with the check.

Code: Select all

$ ../nagios-plugins/check_http --version
check_http v1.4.15 (nagios-plugins 1.4.15)
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: check_http failing to compile regex

Post by tmcdonald »

Could you try the latest version of the Plugins?

https://github.com/nagios-plugins/nagios-plugins/

The bug might still exist but I want to make sure we're fixing the latest code if we do have to make a patch.
Former Nagios employee
jolson
Attack Rabbit
Posts: 2560
Joined: Thu Feb 12, 2015 12:40 pm

Re: check_http failing to compile regex

Post by jolson »

Please update your plugins as indicated by tmcdonald.

I got this working on a test Nagios XI box of my own, with the following configurations in place:

command:

Code: Select all

define command {
       command_name                             check_xi_host_http
       command_line                             $USER1$/check_http -H $HOSTADDRESS$ $ARG1$
}
service:

Code: Select all

define service {
        host_name                       insightfulcowthoughts.com
        service_description             check HTTP for []
        use                             generic-service
        check_command                   check_xi_service_http!-r "\[\]"!!!!!!!
        notifications_enabled           1
        register                        1
        }
After upgrading your plugins, give the above a shot. If you need define a URL, I can verify that ssax's solution worked properly for me as well.
Twits Blog
Show me a man who lives alone and has a perpetually clean kitchen, and 8 times out of 9 I'll show you a man with detestable spiritual qualities.
northwood128
Posts: 9
Joined: Mon Jun 15, 2015 12:43 pm

Re: check_http failing to compile regex

Post by northwood128 »

thanks guys! I have an outdated version. I'll evaluate the compatibility of the new plugin with our monitoring server and release a new rpm that includes the new version of the plugin.

$ ./check_http --version
check_http v2.0.3.2.g472e (nagios-plugins 2.0.3)
jolson
Attack Rabbit
Posts: 2560
Joined: Thu Feb 12, 2015 12:40 pm

Re: check_http failing to compile regex

Post by jolson »

Sounds good, let us know how it works out.
Twits Blog
Show me a man who lives alone and has a perpetually clean kitchen, and 8 times out of 9 I'll show you a man with detestable spiritual qualities.
northwood128
Posts: 9
Joined: Mon Jun 15, 2015 12:43 pm

Re: [SOLVED] check_http failing to compile regex

Post by northwood128 »

Updating the plugin worked! Sorry for the delay!
Locked