Need to check for a specific output of a webpage

Hi all,

I am looking for a help to create a health monitor. We would like to use one specific URL which will allow automatic login. If this page fail to load then we will consider that servers are down. Application is BMC remedy

Can you elaborate? What is the request URL and what are you looking for in the response?

Thankyou so much for your reply… INPUT: http://XYZLM01:8080/arsys/servlet/LoginServlet?goto=http://XYZLM01:8080/arsys /forms/remXYZapp/SHR%3ALandingConsole/Default+Administrator+View/?format=html&server=remXYZapp&username=XUSER&pwd=XUSER

and getting Output: https://XYZLM01:8443/arsys/forms/remXYZapp/SHR:LandingConsole/Default%20Administrator%20View/?format=html&cacheid=b9c8ebc7

Thanks Abhishek

How does that output present itself? Redirect header? Payload?

To start, let’s test from the command line with cURL:

curl -v http://XYZLM01:8080/arsys/servlet/LoginServlet?goto=http://XYZLM01:8080/arsys/forms/remXYZapp/SHR%3ALandingConsole/Default+Administrator+View/?format=html&server=remXYZapp&username=XUSER&pwd=XUSER

You may need to either modify the host name to use the IP address of the pool member, or add a local Hosts entry. If the above produces a response, you should see all of it at the command line. From that response, look for where (and if) your required output string exists.

K:>curl -v http://XYZLM01:8080/arsys/servlet/LoginServlet?goto=http://XYZLM01:8080/arsys/forms/remXYZapp/SHR%3ALandingConsole/Default+Administrator+View/?format=html&server=remXYZapp&username=XUSER&pwd=XUSER * Hostname was NOT found in DNS cache * Trying 1.1.1.1… * Connected to XYZLM01 (1.1.1.1) port 8080 (0)

GET /arsys/servlet/LoginServlet?goto=http://XYZLM01:8080/arsys/forms/remXYZapp/SHR%3ALandingConsole/Default+Administrator+View/?format=html HTTP/1.1 User-Agent: curl/7.36.0 Host: XYZLM01:8080 Accept: /

< HTTP/1.1 302 Moved Temporarily * Server Apache-Coyote/1.1 is not blacklisted < Server: Apache-Coyote/1.1 < Pragma: No-cache < Cache-Control: no-cache < Expires: Wed, 31 Dec 1969 18:00:00 CST < Location: https://XYZLM01:8443/arsys/servlet/LoginServlet?goto=http://XYZLM01:8080/arsys/forms/remXYZapp/SHR%3ALandingConsole/Default+Administrator+View/?format=html < Content-Length: 0 < Date: Mon, 05 May 2014 15:20:15 GMT < * Connection 0 to host XYZLM01 left intact ‘server’ is not recognized as an internal or external command, operable program or batch file. ‘username’ is not recognized as an internal or external command, operable program or batch file. ‘pwd’ is not recognized as an internal or external command, operable program or batch file.

Ahh, you’re doing this from Windows. You’ll need to encapsulate the entire URL in double quotes so the ampersands aren’t evaluated as ‘and’ commands.

curl -v "http://XYZLM01:8080/arsys/servlet/LoginServlet?goto=http://XYZLM01:8080/arsys/forms/remXYZapp/SHR%3ALandingConsole/Default+Administrator+View/?format=html&server=remXYZapp&username=XUSER&pwd=XUSER"

Once again, Thankyou so much for helping me…

K:>curl -v “http://XYZLM01:8080/arsys/servlet/LoginServlet?goto=http://XYZLM01:8080/arsys/forms/remXYZapp/SHR%3ALandingConsole/Default+Administrator+View/?format=html&server=remXYZapp&username=XUSER&pwd=XUSER” * Hostname was NOT found in DNS cache * Trying 1.1.1.1… * Connected to XYZLM01 (1.1.1.1) port 8080 (0)

GET /arsys/servlet/LoginServlet?goto=http://XYZLM01:8080/arsys/forms/remXYZapp/SHR%3ALandingConsole/Default+Administrator+View/?format=html&server=remXYZapp&username=XUSER&pwd=xUSER HTTP/1.1 User-Agent: curl/7.36.0 Host: XYZLM01:8080 Accept: /

< HTTP/1.1 302 Moved Temporarily * Server Apache-Coyote/1.1 is not blacklisted < Server: Apache-Coyote/1.1 < Pragma: No-cache < Cache-Control: no-cache < Expires: Wed, 31 Dec 1969 18:00:00 CST < Location: https://XYZLM01:8443/arsys/servlet/LoginServlet?goto=http://XYZLM01:8080/arsys/forms/remXYZapp/SHR%3ALandingConsole/Default+Administrator+View/?format=html&server=remXYZapp&username=XUSER&pwd=XUSER < Content-Length: 0 < Date: Mon, 05 May 2014 16:14:01 GMT < * Connection 0 to host XYZLM01 left intact

Okay, so curiously you’re requesting this:

http://XYZLM01:8080/arsys/forms/remXYZapp/SHR%3ALandingConsole/Default+Administrator+View/?format=html&server=remXYZapp&username=XUSER&pwd=xUSER

You’re receiving a 302 redirect to:

https://XYZLM01:8443/arsys/servlet/LoginServlet?goto=http://XYZLM01:8080/arsys/forms/remXYZapp/SHR%3ALandingConsole/Default+Administrator+View/?format=html&server=remXYZapp&username=XUSER&pwd=XUSER

And you’re looking for this value:

https://XYZLM01:8443/arsys/forms/remXYZapp/SHR:LandingConsole/Default%20Administrator%20View/?format=html&cacheid=b9c8ebc7

Without knowing more about the application, I’d say your request isn’t in line with what you’re expecting to receive. What would happen if you requested the second HTTPS URL instead?

curl -v -k "https://XYZLM01:8443/arsys/servlet/LoginServlet?goto=http://XYZLM01:8080/arsys/forms/remXYZapp/SHR%3ALandingConsole/Default+Administrator+View/?format=html&server=remXYZapp&username=XUSER&pwd=XUSER"

Output:

:>curl -v -k “https://XYZLM01:8443/arsys/servlet/LoginServlet?goto=http://XYZLM01:8080/arsys/forms/remXYZapp/SHR%3ALandingConsole/Default+Administrator+View/?format=html&server=remXYZapp&username=XUSER&pwd=XUSER” * Hostname was NOT found in DNS cache * Trying 1.1.1.1… * Connected to XYZLM01 (1.1.1.1) port 8443 (0) * SSLv3, TLS handshake, Client hello (1): * SSLv3, TLS handshake, Server hello (2): * SSLv3, TLS handshake, CERT (11): * SSLv3, TLS handshake, Server key exchange (12): * SSLv3, TLS handshake, Server finished (14): * SSLv3, TLS handshake, Client key exchange (16): * SSLv3, TLS change cipher, Client hello (1): * SSLv3, TLS handshake, Finished (20): * SSLv3, TLS change cipher, Client hello (1): * SSLv3, TLS handshake, Finished (20): * SSL connection using TLSv1.2 / ECDHE-RSA-DES-CBC3-SHA * Server certificate: * subject: C=US; ST=XX; L=XXXX; O=XXXX; OU=XXXX; CN=XYZLM01.XXXX.dns.com * start date: 2014-02-20 14:31:44 GMT * expire date: 2018-02-19 14:31:44 GMT * issuer: DC=COM; DC=dns; CN=XXXX-EntSubCA-Private * SSL certificate verify result: self signed certificate in certificate chain (19), continuing anyway.

GET /arsys/servlet/LoginServlet?goto=http://XYZLM01:8080/arsys/forms/remXYZapp/SHR%3ALandingConsole/Default+Administrator+View/?format=html&server=remXYZapp&username=XUSER&pwd=XUSER HTTP/1.1 User-Agent: curl/7.36.0 Host: XYZLM01:8443 Accept: /

< HTTP/1.1 200 OK * Server Apache-Coyote/1.1 is not blacklisted < Server: Apache-Coyote/1.1 < Pragma: No-cache < Cache-Control: no-cache < Expires: Wed, 31 Dec 1969 18:00:00 CST < Set-Cookie: JSESSIONID=7B548C534D01148494F3A68410FA0D5A; Path=/arsys; Secure < Content-Type: text/html;charset=UTF-8 < Transfer-Encoding: chunked < Date: Mon, 05 May 2014 16:55:45 GMT <

Okay, well you’re only showing the headers of the response, but you can still work with this. If you were to use an HTTPS monitor, the Send String might look like this:

GET /arsys/servlet/LoginServlet?goto=http://XYZLM01:8080/arsys/forms/remXYZapp/SHR%3ALandingConsole/Default+Administrator+View/?format=html&server=remXYZapp&username=XUSER&pwd=XUSER HTTP/1.1\r\nHost: localhost\r\n\r\n

The Receive String could then perhaps look like this:

Set-Cookie: JSESSIONID=

This assumes 1) that the pool members that this monitor is applied to are listening on an HTTPS port (8443?), and 2) that the JSESSIONID cookie is only set if the request is good. Try a few variations to observe any differences in the response (ie. remove or make the credentials wrong). You can of course get a lot more specific than this, but I’d start here to just make sure it works.

Thanks for your reply. I tried this… however Host is always live, if i change the username and password.

Can we track “Cache ID”? as its specific to this username and password.

https://XYZLM01:8443/arsys/forms/remXYZapp/SHR:LandingConsole/Default%20Administrator%20View/?format=html&**cacheid=b9c8ebc7**

Or if you need more info to resolve this, Kindly let me know.

The thing is, none of the cURL tests you’ve provided have this string in the response. If you can provide a request that reliably returns a cacheid value in the response, then you could certainly use in the monitor.