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.
s.diwakar1
Posts: 44 Joined: Thu Feb 27, 2020 9:45 am
Post
by s.diwakar1 » Thu Jun 24, 2021 9:51 am
Hi All,
I am using check_http_content script to monitor my URL Content.
Getting below output while executing below command manually:
Command:
Code: Select all
./check_http_content -U https://xxx -m {"version":"1.0","status":"SUCCESS"}
Output:
Code: Select all
CONTENT ERROR: EXPR NOT FOUND (last: {"version":"1.0","status":"SUCCESS"})
full output was:
{"version":"1.0","status":"SUCCESS"}
I am passing same content as shown in URL. But still it is giving error.
Can anyone help me in this please?
Thanks in advance!
Thanks & Regards,
Diwakar Sharma
benjaminsmith
Posts: 5324 Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul
Post
by benjaminsmith » Thu Jun 24, 2021 5:26 pm
Hi
@s.diwakar1 ,
Looking over the plugin it does a simple Perl regex match against the URL vs the matching argument. Since this is a complex string, try wrapping the matching string in single quotes and escape any special characters.
For example, the plugin page on the Nagios Exchange contains this following string.
my @output_lines = split(/
This does not work.
Code: Select all
[root@localhost libexec]# ./check_http_content -U https://exchange.nagios.org/directory/Plugins/Websites,-Forms-and-Transactions/check_http_content/details -m 'my @output_lines = split(/'
Unmatched ( in regex; marked by <-- HERE in m/my @output_lines = split( <-- HERE // at ./check_http_content line 66.
[root@localhost libexec]#
However, escaping the forward slash corrects the issue.
Code: Select all
[root@localhost libexec]# ./check_http_content -U https://exchange.nagios.org/directory/Plugins/Websites,-Forms-and-Transactions/check_http_content/details -m 'my @output_lines = split\(/'
CONTENT OK: EXPR FOUND[root@localhost libexec]#
Let us know if you get it working and post the full check command if it's failing.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new
Privacy Policy .
Be sure to check out our
Knowledgebase for helpful articles and solutions!
s.diwakar1
Posts: 44 Joined: Thu Feb 27, 2020 9:45 am
Post
by s.diwakar1 » Fri Jun 25, 2021 4:15 am
Hi @benjaminsmith,
I am getting expected output after wrapping the string in single quotes.
I have tried below commands and they are working as expected:
Code: Select all
./check_http_content -U https://xxx -m '{"version":"1.0","status":"SUCCESS"}'
Code: Select all
./check_http_content -U https://xxx -m SUCCESS
Code: Select all
./check_http_content -U https://xxx -m 'SUCCESS'
Thank you for your support as always and giving me the clarification in detail with example.
Thank you so much once again.
Thanks & Regards,
Diwakar Sharma
benjaminsmith
Posts: 5324 Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul
Post
by benjaminsmith » Fri Jun 25, 2021 9:04 am
Hi
@s.diwakar1 ,
Your welcome! Glad to see that's working now and we'll go ahead and mark this as resolved. Feel free to open another if you have any new questions.
Thank you for using the Nagios Community Forum!
Benjamin
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new
Privacy Policy .
Be sure to check out our
Knowledgebase for helpful articles and solutions!