Dear All,
I am using subjected script to monitor URLs with specific content/Expression.
Recently, One of the URL was being monitored properly with an Expression. But as of now, it is giving error "Expr not found".
Can anyone please confirm if this script searches the Expression within the source code or how this script works?
Thanks in advance!
check_http_content query
-
- Posts: 44
- Joined: Thu Feb 27, 2020 9:45 am
check_http_content query
Thanks & Regards,
Diwakar Sharma
Diwakar Sharma
Re: check_http_content query
From the documentation on exchange:
"check_http_content is a web content monitor written in perl. Checks a URL for specific text.
It retrieves an URL through http or https and looks in its output for a given text. If the text is found returns OK, if not found returns CRITICAL plus the last line of text received (and the full text as additional output data), and UNKNOWN otherwise (connection error,...) plus a brief error description."
So it fetches a URL and looks for the expression in the returned text.
https://exchange.nagios.org/directory/P ... nt/details
"check_http_content is a web content monitor written in perl. Checks a URL for specific text.
It retrieves an URL through http or https and looks in its output for a given text. If the text is found returns OK, if not found returns CRITICAL plus the last line of text received (and the full text as additional output data), and UNKNOWN otherwise (connection error,...) plus a brief error description."
So it fetches a URL and looks for the expression in the returned text.
https://exchange.nagios.org/directory/P ... nt/details
-
- Posts: 44
- Joined: Thu Feb 27, 2020 9:45 am
Re: check_http_content query
Hi @gormank,
Thanks for your detailed clarification.
But my query is still not resolved. I am monitoring some of my URLs to check specific text. Few days back, I was getting correct output. But now I am getting error, "Expr not found" with the complete source code of that URL as additional output data.
I want to know, Do this script check the text within the source code itself?
Sometimes what happened is, a URL has one or more links available or some variable within the source code from which it gets the data also. So, do this script check those links as well?
What I understood from the output is, it checks the specific text within the source code of that URL itself and if the specific text which I am trying to search is coming from another link or through a variable from the database, it is not searching there, because that specific text is not available in the source code of that URL.
Thanks for your detailed clarification.
But my query is still not resolved. I am monitoring some of my URLs to check specific text. Few days back, I was getting correct output. But now I am getting error, "Expr not found" with the complete source code of that URL as additional output data.
I want to know, Do this script check the text within the source code itself?
Sometimes what happened is, a URL has one or more links available or some variable within the source code from which it gets the data also. So, do this script check those links as well?
What I understood from the output is, it checks the specific text within the source code of that URL itself and if the specific text which I am trying to search is coming from another link or through a variable from the database, it is not searching there, because that specific text is not available in the source code of that URL.
Thanks & Regards,
Diwakar Sharma
Diwakar Sharma
Re: check_http_content query
That is exactly how it works. By parsing the raw HTML returned by the HTTP request.s.diwakar1 wrote:I want to know, Do this script check the text within the source code itself?
I suppose that would be a question of how LWP::UserAgent works, but I can't imagine it's doing things like fully rendering iframes or allowing Javascript to fully execute. curl doesn't do that.s.diwakar1 wrote:Sometimes what happened is, a URL has one or more links available or some variable within the source code from which it gets the data also. So, do this script check those links as well?
You'd probably need a custom plugin, or something like Selenium or PhantomJS or some other full-fat browser driver, to get dynamic content that doesn't exist in the DOM until after the initial page load.s.diwakar1 wrote:the specific text which I am trying to search is coming from another link or through a variable from the database
Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/
-
- Posts: 44
- Joined: Thu Feb 27, 2020 9:45 am
Re: check_http_content query
Thank you so much @mcapra! for detailed clarification. I got my answer. Thank you again!
Thanks & Regards,
Diwakar Sharma
Diwakar Sharma
-
- Posts: 5324
- Joined: Wed Aug 22, 2018 4:39 pm
- Location: saint paul
Re: check_http_content query
Excellent! And thanks, Matt.Thank you so much @mcapra! for detailed clarification. I got my answer. Thank you again!
We'll go ahead and close this.
Thank you for using the Nagios Community Forum
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!
Be sure to check out our Knowledgebase for helpful articles and solutions!