Check_http pattern not working

Hi,

Having errors on all check_http with an pattern check on them.

My version:

Component Version
LibreNMS 1.44-370-g97b33bf
DB Schema 269
PHP 7.0.32-0ubuntu0.16.04.1
MySQL 10.0.36-MariaDB-0ubuntu0.16.04.1
RRDTool 1.5.5
SNMP NET-SNMP 5.7.3
====================================

[OK] Composer Version: 1.7.2
[OK] Dependencies up-to-date.
[OK] Database connection successful
[OK] Database schema correct

I have tried to run the check_http with no error and the service code:
The service:
image

librenms@LNMS:~$ ./check-services.php -h 165 -d
DEBUG!
Starting service polling run:

SQL[SELECT D.*,S.*,attrib_value  FROM `devices` AS D INNER JOIN `services` AS S ON S.device_id = D.device_id AND D.disabled = 0 AND `S`.`device_id` = 165 LEFT JOIN `devices_attribs` as A ON D.device_id = A.device_id AND A.attrib_type = "override_icmp_disable" ORDER by D.device_id DESC; [] 0.51ms]

Nagios Service - 57
Request:  '/usr/lib/nagios/plugins/check_http' '-H' 'us.domain.com' '-u' '/IW_Login.m4p.pvx?;login' '-S' '--eregi="This is a restricted site. If you have forgotten your User ID or Password,"' '-w' '5' '-c' '10'
Perf Data - DS: time, Value: 0.593944, UOM: s
Perf Data - DS: size, Value: 3314, UOM: B
Response: HTTP CRITICAL: HTTP/1.0 200 OK - pattern not found - 3314 bytes in 0.594 second response time
Service DS: {
    "time": "s",
    "size": "B"
}
RRD[last ssl1/services-57.rrd  --daemon unix:/var/run/rrdcached.sock]
RRD[update ssl1/services-57.rrd N:0.593944:3314 --daemon unix:/var/run/rrdcached.sock]
SQL[UPDATE `services` set `service_message`=? WHERE `service_id`=? ["HTTP CRITICAL: HTTP\/1.0 200 OK - **pattern not found** - 3314 bytes in 0.594 second response time ",57] 2.8ms]
./check-services.php 2018-10-19 12:54:19 - 1 services polled in 0.605 secs
librenms@LNMS:~$

But the request line seems funny:
Request: ‘/usr/lib/nagios/plugins/check_http’ ‘-H’ ‘us.domain.com’ ‘-u’ ‘/IW_Login.m4p.pvx?;login’ ‘-S’ ‘–eregi=“This is a restricted site. If you have forgotten your User ID or Password,”’ ‘-w’ ‘5’ ‘-c’ ‘10’
Could this be the problem ?

The request normal no error:

librenms@LNMS:~$ /usr/lib/nagios/plugins/check_http -H us.domain.com -u "/IW_Login.m4p.pvx?;login" -S --eregi="This is a restricted site. If you have forgotten your User ID or Password," -w 5 -c 10 -v
GET /IW_Login.m4p.pvx?;login HTTP/1.1
User-Agent: check_http/v2.1.2 (monitoring-plugins 2.1.2)
Connection: close
Host: us.domain.com


https://us.domain.com:443/IW_Login.m4p.pvx?;login is 3314 characters
STATUS: HTTP/1.0 200 OK
**** HEADER ****
<--- Removed content for shorter code -->
        <tr><td class="Error" colspan="2" align="center"></td></tr></table>
        <p><input type="submit" name="B1" tabindex="4" value="Log On"></p>
        <p class="Notes">This is a restricted site. If you have forgotten your User ID or Password,<br> you may <a href="IW_Login.m4p.pvx?;UID_REQUEST" title="Click to request your User ID and Password">request</a> they be mailed to you.</p>
        <!-- Due to security issues with cookies ... Remove option to use session cookies. Instead we will always use the RememberMe option. -->
        <p class="Notes">Access to these pages requires the ability to use cookies in your browser.</p>
</td></tr></table></form>
</body>
</html>

**HTTP OK: HTTP/1.0 200 OK - 3314 bytes in 0.593 second response time** |time=0.593036s;5.000000;10.000000;0.000000 size=3314B;;;0
librenms@LNMS:~$

Not sure where to troubleshoot from here. someone that can help ?

Thanks :slight_smile:

The double quotes are added literally to your command input. I’m not sure how you could remove them though. Maybe come up with a string to check that doesn’t have spaces for now.

It had been working like this.
It stopped working about 4 days ago:

But what about all this single quotes, I never seen this before, when I have done debugging.
image

I have multiple parameters, I need the spaces here. Or how can I get around that ?

Okay, the --eregi= & the --regex are not being used anymore as I see it.

 -r, --regex, --ereg=STRING
    Search page for regex STRING
 -R, --eregi=STRING
    Search page for case-insensitive regex STRING

https://www.monitoring-plugins.org/doc/man/check_http.html
Use
-R "AND ALL THE SPACES ARE WORKING"
and pattern are now working