1

I have this URL where content strings are separated on the webpage. I need to check where on the same line those two strings are present or not.

Say, on this page I have "API Operational" strings present. I am not sure about how many spaces are present in between these two. Also, this Operation string is "component-status" in span class of that HTML page which I don't know how we can handle from shell.

  • It is impossible to help unless you post samples of the string(s). – maulinglawns Oct 14 '16 at 9:18
  • Say, on this page I have "API Operational" strings present. I am not sure about how many spaces are present in between these two. Also, this Operation string is "component-status" in span class of that html page which I dunno how we can handle from shell. – tashinfrus Oct 14 '16 at 12:45
  • Did the answer below help at all? If so, please consider accepting it with the checkmark; otherwise, let us know what the result was. – Jeff Schaller Nov 14 '16 at 17:07
0

If you are using the stock check_http plugin, then you can use the -r (aka --regex) flag:

-r, --regex, --ereg=STRING

Search page for regex STRING

with a regular expression of: API +Operational, which matches those characters, with a special meaning in the + that says "match one or more spaces". The regular expression matching is case-sensitive by default; see the -R flag to make it case-insensitive (or use [Aa][Pp][Ii], for example, to indicate which letter casing is acceptable).

The -s string-matching option looks for an exact match of that string, using the strstr function

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.