Page 1 of 2

How to monitor URL webpage content.

Posted: Wed Mar 24, 2021 8:40 am
by informatica
Hi Team,

we would like to monitor the webpage url content. the attached is the webpage and we need to monitor the health status of URL.
In the attachment "SERVICE HEALTH" is our we would like to monitor.
In the attachment All services is have list of services names.
If any service is have any issue we should get the alert.

We have logins for the URLs. We need to authenticate and get the status of all service health. Could you please help how we can achieve this.

Re: How to monitor URL webpage content.

Posted: Wed Mar 24, 2021 3:41 pm
by benjaminsmith
Hi,
We have logins for the URLs. We need to authenticate and get the status of all service health. Could you please help how we can achieve this.
We have a Web Transaction Wizard in Nagios XI, but it's limited to basic authentication. Do you know what type of authentication is required for this site?

Reference: Monitoring Websites With Nagios XI

Regards,
Benjamin

Re: How to monitor URL webpage content.

Posted: Thu May 13, 2021 12:28 am
by informatica
Hi Team,

We have dynamic webpages which are implemented on Javascript.
We have tried with same but we are not able to monitor the webpage content.

[nagios@qy-nagios-a root]$ /usr/local/nagios/libexec/check_http -H XXXX -S --onredirect=follow -s "HISTORY" -u /alias/infa --sni
HTTP CRITICAL: HTTP/1.1 200 OK - string 'HISTORY' not found on 'https://status.salesforce.com:443/alias/infa' - 3352 bytes in 0.135 second response time |time=0.135266s

Re: How to monitor URL webpage content.

Posted: Thu May 13, 2021 4:53 pm
by ssax
What is the full output of this command?

Code: Select all

/usr/local/nagios/libexec/check_http -H the.fqdn.com -S --onredirect=follow -s "HISTORY" -u /alias/infa --sni -vvv

Re: How to monitor URL webpage content.

Posted: Fri May 14, 2021 4:39 am
by informatica
Please find the below output

[nagios@in-nagios-a root]$ /usr/local/nagios/libexec/check_http -H XXXXX -S --onredirect=follow -s "HISTORY" -u /alias/infa --sni -vvv
SSL initialized
GET /alias/infa HTTP/1.1
User-Agent: check_http/v2.2.1 (nagios-plugins 2.2.1)
Connection: close
Host: status.salesforce.com
Accept: */*


https://XXXXXX :443/alias/infa is 3352 characters
STATUS: HTTP/1.1 200 OK
**** HEADER ****
Accept-Ranges: bytes
Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Authorization, X-Send-Notification
Access-Control-Allow-Methods: GET, POST, PATCH, DELETE, OPTIONS
Access-Control-Allow-Origin: *
Cache-Control: public,max-age=3600
Content-Length: 2615
Content-Security-Policy: upgrade-insecure-requests
Content-Type: text/html; charset=UTF-8
Date: Fri, 14 May 2021 09:38:42 GMT
Etag: W/"a37-1781ce21590"
Last-Modified: Wed, 10 Mar 2021 16:04:42 GMT
Strict-Transport-Security: max-age=31536000, includeSubDomains
Vary: User-Agent
Via: 1.1 spaces-router (fc27938738da-dirty)
X-Frame-Options: DENY
X-Powered-By: Express
X-Xss-Protection: 1; mode=block
Connection: close
**** CONTENT ****
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><link rel="stylesheet" href="/salesforce-lightning-design-system.min.css"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><link rel="stylesheet" href="/assets/oneTrust/onetrust-styles.css"/><script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js ... ript><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>Trust Status</title><link href="/static/css/main.f7c0571b.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(t){function e(e){for(var n,l,a=e[0],f=e[1],i=e[2],c=0,s=[];c<a.length;c++)l=a[c],Object.prototype.hasOwnProperty.call(o,l)&&o[l]&&s.push(o[l][0]),o[l]=0;for(n in f)Object.prototype.hasOwnProperty.call(f,n)&&(t[n]=f[n]);for(p&&p(e);s.length;)s.shift()();return u.push.apply(u,i||[]),r()}function r(){for(var t,e=0;e<u.length;e++){for(var r=u[e],n=!0,a=1;a<r.length;a++){var f=r[a];0!==o[f]&&(n=!1)}n&&(u.splice(e--,1),t=l(l.s=r[0]))}return t}var n={},o={1:0},u=[];function l(e){if(n[e])return n[e].exports;var r=n[e]={i:e,l:!1,exports:{}};return t[e].call(r.exports,r,r.exports,l),r.l=!0,r.exports}l.m=t,l.c=n,l.d=function(t,e,r){l.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},l.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},l.t=function(t,e){if(1&e&&(t=l(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(l.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)l.d(r,n,function(e){return t[e]}.bind(null,n));return r},l.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return l.d(e,"a",e),e},l.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},l.p="/";var a=this["webpackJsonptrust1-status"]=this["webpackJsonptrust1-status"]||[],f=a.push.bind(a);a.push=e,a=a.slice();for(var i=0;i<a.length;i++)e(a);var p=f;r()}([])</script><script src="/static/js/2.dbf5baa2.chunk.js"></script><script src="/static/js/main.134e8ef4.chunk.js"></script></body></html>
HTTP CRITICAL: HTTP/1.1 200 OK - string 'HISTORY' not found on 'https://status.salesforce.com:443/alias/infa' - 3352 bytes in 0.990 second response time |time=0.990037s;;;0.000000 size=3352B;;;0

Re: How to monitor URL webpage content.

Posted: Fri May 14, 2021 4:04 pm
by ssax
Okay, yeah, you'll need to use the webinject plugin to do this, you can try this with the Web Transaction Wizard:

Code: Select all

<testcases repeat="1">

<case
    id="1"
    url="https://XXXXXXXXX/alias/infa/"
    verifyresponsecode="200"
    verifypositive="HISTORY"
    errormessage="HISTORY string not found"
    logrequest="no"
    logresponse="no"
/>

</testcases>
See here for additional information:

https://support.nagios.com/kb/article/w ... s-897.html

Re: How to monitor URL webpage content.

Posted: Wed May 19, 2021 2:07 am
by informatica
Hi Team,

we have try to modify the service but still we are getting the same error. PFA

we added the test case too.
<testcases repeat="1">

<case
id="1"
url="https://XXXXXXXXX/alias/infa/"
verifyresponsecode="200"
verifypositive="HISTORY"
errormessage="HISTORY string not found"
logrequest="no"
logresponse="no"
/>

Re: How to monitor URL webpage content.

Posted: Thu May 20, 2021 10:57 am
by gsmith
Hi,

Please try this:

Save the following as test.xml in /tmp:

Code: Select all

<testcases repeat="1">

<case
    id="1"
    url="https://XXXXXXXXX/alias/infa/"
    verifyresponsecode="200"
    verifypositive="HISTORY"
    errormessage="HISTORY string not found"
    logrequest="no"
    logresponse="no"
/>

</testcases>
then run:
<path>/Webinject-1.94/bin/webinject.pl test.xml
where path is the location of the Webinject install

Please post the results.

Thanks

Re: How to monitor URL webpage content.

Posted: Fri May 21, 2021 8:37 am
by informatica
Hi Team,

Please find the below update.

[root@ittestnagiosxi tmp]# ll test.xml
-rw-r--r-- 1 root root 253 May 21 19:03 test.xml
[root@ittestnagiosxi tmp]# cat test.xml
<testcases repeat="1">

<case
id="1"
url="https://XXXXXXX/alias/infa/"
verifyresponsecode="200"
verifypositive="HISTORY"
errormessage="HISTORY string not found"
logrequest="no"
logresponse="no"
/>

</testcases>
[root@ittestnagiosxi tmp]# locate
locate: no pattern to search for specified
[root@ittestnagiosxi tmp]# locate webinject.pl
/usr/local/nagiosxi/etc/components/webinject/webinject.pl
[root@ittestnagiosxi tmp]# /usr/local/nagiosxi/etc/components/webinject/webinject.pl test.xml

Starting WebInject Engine...

-------------------------------------------------------

Error: Failed to open test case file

[root@ittestnagiosxi tmp]#


Please let me know if we did some thing mistake.

Once again these are not static web pages /these are dynamic java webpages

Re: How to monitor URL webpage content.

Posted: Fri May 21, 2021 10:51 am
by gsmith
Hi,

That is strange, but here's how I got it to work:

Code: Select all

cd /usr/local/nagiosxi/etc/components/webinject/
cp /tmp/test.xml .
./webinject.pl test.xml
The webinject.pl script acts like a browser so it can interpret
a dynamic web page.

Thanks