KS-Soft. Network Management Solutions
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister    ProfileProfile    Log inLog in 

HTTP Content test

 
Post new topic   Reply to topic    KS-Soft Forum Index -> Configuration, Maintenance, Troubleshooting
View previous topic :: View next topic  
Author Message
Gluk



Joined: 05 Nov 2006
Posts: 19
Location: Israel

PostPosted: Mon May 14, 2007 7:20 am    Post subject: HTTP Content test Reply with quote

Hi,

I had set up a JSP to monitor status and memory usage of JVM process (JAVA VIRTUAL MACHINE) which output looks like following:

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

Health Check: PASSED
Memory Utilization: 4,366,312 bytes out of 201,326,592 bytes (2.17%).
Max Allowed Memory Utilization: 50.00%.

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

In case memory utilization percentage will grow over "Max Allowed Memory Utilization", Health Check will show "FAILED"

Using HTTP Content test I am planning to fire alert on testing for PASSED/FAILED result and it works well.
But I am also interested to collect "Memory Utilization" percentage value for history/reports use.

1. I can setup another JSP to return those 2.17% as http request reply value, but HTTP Content test shows response time as reply.
Is it possible to setup HTTP Content test in a way it will return response value/string?

2. Is there better/simplier way to catch Memory Utilization percentage number?
It would be nice to be able to catch both Health Check and Memory Utilization percentage values using single test.
May be its possible using some expression or macro variable in the test?

Any other suggestion? I can redesign the JSP if it will help...

Thanks,
Gluk.
Back to top
View user's profile Send private message
KS-Soft Europe



Joined: 16 May 2006
Posts: 2832

PostPosted: Mon May 14, 2007 8:23 am    Post subject: Re: HTTP Content test Reply with quote

Gluk wrote:
1. I can setup another JSP to return those 2.17% as http request reply value, but HTTP Content test shows response time as reply.
Is it possible to setup HTTP Content test in a way it will return response value/string?
You may use %HttpPage% macro variable. Quote from the manual:
http://www.ks-soft.net/hostmon.eng/mframe.htm#actions.htm#macro
============================
%HttpPage% - Represents contents of the monitored web page (first 32768 (32K) characters of the web page if test was performed by HostMonitor; first 2048 (2K) characters of the page if test was performed by RMA).
============================

Gluk wrote:
2. Is there better/simplier way to catch Memory Utilization percentage number?
Actually, you may check memory utilization per process using "WMI" or "Performance Counter" test methods, but there is no simple way to calculate percentage values.

Gluk wrote:
It would be nice to be able to catch both Health Check and Memory Utilization percentage values using single test.
I do not think it is possible to compose it in one test. I think, you should use two test. First test should check Health Check by verifying PASSED/FAILED words and second test should check memory utilization status OK/BAD or something like that. For the second test, you should rewrite JSP page to fit the following rules:
Code:
Memory Utilization Status: OK
Memory Utilization: 4,366,312 bytes out of 201,326,592 bytes (2.17%).
Max Allowed Memory Utilization: 50.00%.

or
Code:
Memory Utilization Status: BAD
Memory Utilization: 128,366,312 bytes out of 201,326,592 bytes (60.17%).
Max Allowed Memory Utilization: 50.00%.

For both test you should setup an action, e.g. "Send Email" action with %HttpPage%" variable in mail profile.

Regards,
Max

Regards,
Max
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Gluk



Joined: 05 Nov 2006
Posts: 19
Location: Israel

PostPosted: Mon May 14, 2007 8:45 am    Post subject: Reply with quote

Quote:
For both test you should setup an action, e.g. "Send Email" action with %HttpPage%" variable in mail profile


But I do not look for a way to send this info somewhere, I need it to be stored as a monitored "reply" value of the test in order to be able make a host monitor report of it for some period.

Thanks,
Gluk.
Back to top
View user's profile Send private message
Yoorix



Joined: 14 Dec 2005
Posts: 177

PostPosted: Mon May 14, 2007 9:01 am    Post subject: Reply with quote

Gluk wrote:
But I do not look for a way to send this info somewhere, I need it to be stored as a monitored "reply" value of the test in order to be able make a host monitor report of it for some period.
Hm. It's not easy to implement. You may try to use "Shell script" test method. You should use free open source utility "wget.exe" to get HTTP content of JSP page and store it to text file. Then you should parse that text file using system commands "find", "for", "ERRORLEVEL", etc. Your script should look like that:
Code:
"C:\Program Files\Wget\wget.exe" -q  -O http_content.txt -T 30 --cache=off http://your_server/your_jsp_page.jsp
type http_content.txt | FIND "PASSED" >NUL
IF ERRORLEVEL 1 (
   echo ScriptRes:Bad:FAILED
) ELSE (
  echo ScriptRes:Ok:PASSED
)


You just have to add several lines of code to parse memory utilization.

---
Yoorix
Back to top
View user's profile Send private message
KS-Soft



Joined: 03 Apr 2002
Posts: 12791
Location: USA

PostPosted: Mon May 14, 2007 2:11 pm    Post subject: Reply with quote

Quote:
I need it to be stored as a monitored "reply" value of the test in order to be able make a host monitor report of it for some period.
...
Health Check: PASSED
Memory Utilization: 4,366,312 bytes out of 201,326,592 bytes (2.17%).
Max Allowed Memory Utilization: 50.00%.

Honestly I do not see the reason to use 3 lines of text for Reply value. HostMonitor and Log Analyzer will not be able to process such Reply value to calculate statistical counters.
I would recommend to use special file for such data. E.g. you may use "Execute external program" action and some simple BAT file to store test results. Also you may use "SQL Query" action to store results in database.
On the other hand, I think there must be some other way to request JVM status. What about WMI or Performance Counter test? This JVM is running on Windows system?

Regards
Alex
Back to top
View user's profile Send private message Visit poster's website
Gluk



Joined: 05 Nov 2006
Posts: 19
Location: Israel

PostPosted: Tue May 15, 2007 1:15 am    Post subject: Reply with quote

Guys, seems that you are cocentrating too much on getting the status of JVM about which I am happy already - it works.
Quote:
Using HTTP Content test I am planning to fire alert on testing for PASSED/FAILED result and it works well.


My real problem is that I am also interested to collect "Memory Utilization" percentage value for history/reports use and if it possible, I would be glad to get them both monitored by single test.
Quote:
Honestly I do not see the reason to use 3 lines of text for Reply value. HostMonitor and Log Analyzer will not be able to process such Reply value to calculate statistical counters

I only need that numeric value before % sign inside parenthesis at the end of the second line (2.17 on the example) as Reply value to be processed by HostMonitor and Log Analyzer.

JVM running on Windows but WMI can't give me percentage of memory used by JAVA process within memory space already allocated to that JVM while I may have several JVM running in parallel on the same physical server, each one within its own allocated memory space so finally using JSP to get status and percentage of memory utilization for each one of them is the most suitable for me.

I have two JSP's, one of which provides me with Memory Utilization percentage number within the page as part of string and another one which gives me only that number in reply.
All that I need is to find the most simplier and easier way to collect it by Host Monitor for use with Reporter and Log Analizer.

Quote:
For both test you should setup an action, e.g. "Send Email" action with %HttpPage%" variable in mail profile.

If instead of "Send Email" action I could use some action which takes %Memory Utilization percentage number% from those 3 lines and stores it as reply for test or in some other suitable way, I could set this action as an additional action within first test which checks for PASSED/FALED state.

If it impossible, I can use second test with second JSP which returns me the clear value in order to collect it using %HttpPage% but the question is - how to set it as a "monitored value" of the second test?

Or, may be there are another suitable for my needs way to get this value monitored by Host Monitor for which I need to change one of JSP's (may be by providing that value as a parameter if Host Monitor can monitor some parameter value in HTTP test) or ...?[/quote]

Thanks,
Gluk.
Back to top
View user's profile Send private message
KS-Soft Europe



Joined: 16 May 2006
Posts: 2832

PostPosted: Tue May 15, 2007 2:29 am    Post subject: Reply with quote

Gluk wrote:
the question is - how to set it as a "monitored value" of the second test?
You may use method, suggested by Yoorix. "Shell script" test method allows you specify exact value, that should be stored in "Reply" field. You just should change the script, suggested by Yoorix to parse "Memory utilization" string, retrieve "Memory utilization" value and store it into "Reply" variable using "Shell script" syntax. Quote from the manual:
http://www.ks-soft.net/hostmon.eng/mframe.htm#tests.htm#createshell_cmd
=====================
Requirements to the script:

The following rules must be obeyed when creating a script:

The script or external program must write to stdout (standard output stream) single result string. This string should contain 3 parts separated by colon (.

1. First obligatory part - marker "scriptres" tells to HostMonitor or RMA that this string is the result string.

2. Second obligatory part represents the test status, it can take one of the following values (case insensitive):
Status string Comment
Host is alive status means " script executed successfully, target system correctly responds"
No answer script executed successfully, target system does not respond
Unknown status means "test cannot be performed for some reason"
Unknown host use this status when script cannot resolve target host name into IP address
Ok script executed, result satisfies (some) requirements
Bad script executed, result does not satisfy (some) requirements
Bad contents use this status if script found some error in monitored file, web page, etc

3. Third optional part contains Reply value, HostMonitor displays this value in Reply field, writes to log files, uses to displays charts (Log Analyzer), etc. If you want Log Analyzer to process Reply values correctly and display charts, use one of the following formats for Reply value:
* decimal_number (like "123", "0", "6456.45". as decimal separator use symbol that is specified on your system, usually a dot (.) or a comma (,))
* decimal_number + space + "Kb" (like "512 Kb", "64 Kb")
* decimal_number + space + "Mb" (like "1024 Mb", "5 Mb")
* decimal_number + space + "Gb" (like "12 Gb", "4 Gb")
* decimal_number + space + "%" (like "50 %", "99 %")
* decimal_number + space + "ms" (like "100 ms", "5400 ms")

Several examples:
String printed by script "Status" of the test "Reply" field of the test
scriptres:Host is alive:1000 ms Host is alive 1000 ms
scriptres:Unknown host: Unknown host
scriptres:Ok:300 Kb Ok 300 Kb
scriptres:Bad:90 % Bad 90 %

That's it. Everything else is entirely up to you
=====================

Are you familiar with .bat files writing? Than you easy will write that script.
If you need help, please, do not hesitate to contact us.

Regards,
Max
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Gluk



Joined: 05 Nov 2006
Posts: 19
Location: Israel

PostPosted: Tue May 15, 2007 8:25 am    Post subject: Reply with quote

Many thanks, Yoorix, Max and Alex.
This should give me all I need.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    KS-Soft Forum Index -> Configuration, Maintenance, Troubleshooting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

KS-Soft Forum Index