Hi everyone! I need to check the html content of a site, I inserted the service in librenms but I can’t understand what the correct command is to read part of the html code. Can you help me ? I’m already checking the certificate and the site uptime. Thanks for your help .
I suggest a script developed in Python.
You send a request and then analyze the code returned by the server.
A colleague developed something similar a while ago.
The idea seems great to me, and great things can be done.
If I find it, I’ll send it to you.
I was watching…
https://docs.python.org/es/3.10/library/html.parser.html
Good luck with that!
The Nagios check_http plugin, in your case, is of no use to you, since what it does is verify the response of the HTTP service, service and certificate.
Using this library, you can look up the values of html tags and get specific data like the page title and the page header list.
This can be the basis for your verification .py script.
Use the nagios service checks, specifically the check_http
.
Specifically the
-s, --string=STRING
String to expect in the content
Part, that will check the output from the page and if it’s not there then it will show as down and enable you to alert.
So I’m running into a similar issue… But it’s odd…
basically the site I’m trying to monitor is standard http on port 8080.
I have configured it as a service but get this error:
connect to address qwxxx.xxx.local and port 8080: Connection refused
HTTP CRITICAL - Unable to open TCP socket
but from the command line I can run it and it works fine. If I run it via the command line with the “-S” I get that same error but I’m running it without it. And it’s not in my paramters for the service either.
So it appears/seems like the service PHP is automatically adding the “-S”?
If I try a site that I know is SSL in the console without the “-S” command line it says it’s been moved… but if I do it from librenms it says it’s all good
For check_http we don’t add anything other than -H to the command that’s being run.
Run ./check-services.php -d
to get more debug info on what’s going on