can't monitor a web page which need to authorize

All questions related to installations, configurations and maintenance of Advanced Host Monitor (including additional tools such as RMA for Windows, RMA Manager, Web Servie, RCC).
leo1631
Posts: 55
Joined: Thu Apr 27, 2006 8:51 pm

can't monitor a web page which need to authorize

Post by leo1631 »

Hi Alex,
I feel HM works not very well when monitor a web page which need to authorize.
For Example, I want to monitor the web service page of HM, log in first,then if http-contents not include " unknown : 0" then alarm.
I have tried lots of times, it seems I can not make HM work well.
I hope the reason is that I set the wrong parameters, can you try that and help me?

Thanks.
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

What exactly authorization method do you use?
Just yesterday we spoke about similar problem, please read this topic: http://www.ks-soft.net/cgi-bin/phpBB/vi ... php?t=2870

Regards
Alex
leo1631
Posts: 55
Joined: Thu Apr 27, 2006 8:51 pm

Post by leo1631 »

KS-Soft wrote:please read this topic: http://www.ks-soft.net/cgi-bin/phpBB/vi ... php?t=2870
I have read that , it's helpful. Now I can test the web service of HM, it works well.
KS-Soft wrote:What exactly authorization method do you use?
The most of applications I need to monitor is the web page which wrote by asp.net, the login information is with _viewstate. I have not made this kind of test worked until now. Can HM do that ?

Thanks ALEX.
leo1631
Posts: 55
Joined: Thu Apr 27, 2006 8:51 pm

Post by leo1631 »

BTW,another question please:
two bad status actions in a action profile,how can I let the second action start after the first action has finished,or after 1 minute the first action started? The test is a NT event test, bad status only occurs one time normally, can't use "start when 2 consecutive bad occurs".
Yoorix
Posts: 177
Joined: Wed Dec 14, 2005 8:28 am

Post by Yoorix »

leo1631 wrote:The most of applications I need to monitor is the web page which wrote by asp.net, the login information is with _viewstate. I have not made this kind of test worked until now. Can HM do that ?
As I understand, you have some pages, protected by password. Thus, you have web page with HTML form to input username/password.
Obviously, HM can not submit HTML form but you could do it as described in foregoing mentioned topic.

- use URL string to send parameters if your web form and script uses GET method
- use HTTP test method and "Post data" option if your web form uses POST method

E.g. after you submit login form, it leads you to some srv page, that checks your credentials and fills _viewstate variable (or something like that) and redirects you to page, that could be available only for logged in users. You may use mentioned above method to make HM connect directly to this srv page with parameters username/password/etc. In case Get method it should be looking like that: http://www.somesite.com/check_credentia ... sword=test

Regards,
Yoorix
Yoorix
Posts: 177
Joined: Wed Dec 14, 2005 8:28 am

Post by Yoorix »

leo1631 wrote:two bad status actions in a action profile,how can I let the second action start after the first action has finished,or after 1 minute the first action started? The test is a NT event test, bad status only occurs one time normally, can't use "start when 2 consecutive bad occurs".
If 2 actions have the same value of the "Start when XX consecutive Bad/Good results occur" option, actions will be started in creation order.

Could you explain what actions you want to start? There are some restrictions: if you create text file using some external program and "Execute external program" action, HostMonitor will start external program but it will not wait until program terminates. In this case you can use "Run HMScript" action (instead of "Execute external program" action) with single command "ExecuteProgram <time_to_wait> <command_line>"

Regards,
Yoorix
leo1631
Posts: 55
Joined: Thu Apr 27, 2006 8:51 pm

Post by leo1631 »

Yoorix wrote:As I understand, you have some pages, protected by password. Thus, you have web page with HTML form to input username/password.
E.g. after you submit login form, it leads you to some srv page, that checks your credentials and fills _viewstate variable (or something like that) and redirects you to page, that could be available only for logged in users.
Yes,perfectly right.
Yoorix wrote:Obviously, HM can not submit HTML form but you could do it as described in foregoing mentioned topic.

- use URL string to send parameters if your web form and script uses GET method
- use HTTP test method and "Post data" option if your web form uses POST method

You may use mentioned above method to make HM connect directly to this srv page with parameters username/password/etc. In case Get method it should be looking like that: http://www.somesite.com/check_credentia ... sword=test
I known little about asp.net, the page uses POST method, I have sniffered the data between client and web server when login, using the iris tool. But whatever I fill the "Post data" field, HM can not pass through the login form.
Can you help me if I mail the sniffered data to you?
Yoorix wrote:Could you explain what actions you want to start? There are some restrictions: if you create text file using some external program and "Execute external program" action, HostMonitor will start external program but it will not wait until program terminates. In this case you can use "Run HMScript" action (instead of "Execute external program" action) with single command "ExecuteProgram <time_to_wait> <command_line>"
The actions I want to start (by rma): AT first,stop a service;after that service has been stopped or after about 1 minute,stop another service.The first service depends on the second, it seems that the second service can't be stopped untile the first has finished stopping.

Thanks Yoorix and sorry for my poor English.
Yoorix
Posts: 177
Joined: Wed Dec 14, 2005 8:28 am

Post by Yoorix »

leo1631 wrote:The actions I want to start (by rma): AT first,stop a service;after that service has been stopped or after about 1 minute,stop another service.The first service depends on the second, it seems that the second service can't be stopped untile the first has finished stopping.
As I've mentioned above, if 2 actions have the same value of the "Start when XX consecutive Bad/Good results occur" option, actions will be started in creation order. So, you should create profile with two actions:
1. Stop first service
2. Stop second service
According to documentation they should be started consecutively (not simultaneously).

If you do not like such method, you are able do following things:

You should create .bat file, i.e. D:\temp\stop_services.bat, and write there two lines:
net stop "Service1Name"
net stop "Service2Name"

Then you should specify such .bat file to execute on "Run external command" Action. Or you may use "Run HMScript" action. To do that you should create .hms file contains one line "ExecuteProgram 5000 D:\TEMP\test.bat"

Regards,
Yoorix
Yoorix
Posts: 177
Joined: Wed Dec 14, 2005 8:28 am

Post by Yoorix »

leo1631 wrote:I known little about asp.net, the page uses POST method, I have sniffered the data between client and web server when login, using the iris tool.
I do not think you should use sniffer, all what you need, is lying in front of you, in HTML source of login page.
leo1631 wrote:But whatever I fill the "Post data" field, HM can not pass through the login form. Can you help me if I mail the sniffered data to you?
Actually, HM can not pass thru login form, but it must not do it. In URL field of URL or HTTP test you should specify NOT login page url, but url of page, where login page leads you after submit. You should in your browser invoke view source for login page, and find tag <Form>. "Action" attribute of tag <Form> provides url page we are looking for. So, in URL field of appropriate test you shoud provide this url. Understand? Lets continue.
You should find all tags <input> and concatenate attribute name of each one into one string, i.e.: username=your_username&password=your_password etc. Where your_username/your_password means your really credentials.
Such string you should provide in "Post data" field of HTTP test, or concatenate with URL field using '?' if you will use URL test. Do not forget mark "Follow redirect" option. It might be important.

Regards,
Yoorix
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

1. Stop first service
2. Stop second service
According to documentation they should be started consecutively (not simultaneously).
If you do not like such method, you are able do following things:
You should create .bat file, i.e. D:\temp\stop_services.bat, and write there two lines:
net stop "Service1Name"
net stop "Service2Name"
Yes, HostMonitor starts actions in creation order (if both actions have the same "Condition to start" settings). However in case of "stop service" action, HostMonitor will start second action without waiting for 1st action completion.
So, in this case you should use .BAT file. To start BAT file you may use "Execute external program" actions, its more simple than HMScript action.

Regards
Alex
leo1631
Posts: 55
Joined: Thu Apr 27, 2006 8:51 pm

About the question of actions, it works at last.

Post by leo1631 »

Yoorix wrote:You should create .bat file, i.e. D:\temp\stop_services.bat, and write there two lines:
net stop "Service1Name"
net stop "Service2Name"
Good idea, it works very well. Thank Yoorix and Alex.
KS-Soft wrote:However in case of "stop service" action, HostMonitor will start second action without waiting for 1st action completion.
That is the point, so the second service can't be stopped because the first one hasn't finished stopping.
KS-Soft wrote:HostMonitor starts actions in creation order (if both actions have the same "Condition to start" settings).
Sometimes maybe not. I found another strange thing when I try to stop more than one service.
I created 3 actions at this order:action_name1-stop a service named "reforward";action_name2-stop a service named "xms";action_name3-stop a service named "message".
The strange thing is that when the action profile is trigged, the executed order is action_name3,action_name1,action_name2, NOT the creation order. I guess maybe HM work at the ASCII order of service name.
Please check that if necessary, executed by rma.
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

The strange thing is that when the action profile is trigged, the executed order is action_name3,action_name1,action_name2, NOT the creation order.
Why do you think so?
I guess maybe HM work at the ASCII order of service name.
No.

Regards
Alex
leo1631
Posts: 55
Joined: Thu Apr 27, 2006 8:51 pm

Post by leo1631 »

in system log of hm, I find the action starting log
leo1631
Posts: 55
Joined: Thu Apr 27, 2006 8:51 pm

Post by leo1631 »

Yoorix wrote:You should in your browser invoke view source for login page, and find tag <Form>. "Action" attribute of tag <Form> provides url page we are looking for. So, in URL field of appropriate test you shoud provide this url. Understand? Lets continue.
You should find all tags <input> and concatenate attribute name of each one into one string, i.e.: username=your_username&password=your_password etc. Where your_username/your_password means your really credentials.
Such string you should provide in "Post data" field of HTTP test, or concatenate with URL field using '?' if you will use URL test. Do not forget mark "Follow redirect" option. It might be important.
Thank Yoorix for explaining the detail. I have tried many times according to the above, It still doesn't work.

Following is from source code of my login page, include <form> tag and all of <input> tags:
------------------------------------------------------------------------
<form name="serverForm" method="post" action="SignInPage.aspx?ru=http%3a%2f%2f10.77.8.205%2fwett%2fDefault.aspx&to=-2&aid=TestSignInPage&ip=10.77.13.38&lou=http%3a%2f%2f10.77.8.205%2fHBWebApp%2fHBPassportService%2fTestPage%2fTestLogOff.aspx" id="serverForm">

<input type="hidden" name="__VIEWSTATE" value="......" />
<input name="SignInControl:_ctl0:clientEnv" id="SignInControl__ctl0_clientEnv" type="hidden" />
<input name="SignInControl:_ctl0:signInName" type="text" value="leo1631" id="SignInControl__ctl0_signInName" class="flatInput" size="32" />
<input name="SignInControl:_ctl0:password" id="SignInControl__ctl0_password" type="password" size="32" class="flatInput" />
<input type="submit" name="SignInControl:_ctl0:SignInButton" value="login" id="SignInControl__ctl0_SignInButton" class="flatButton" style="width:64px;" />
<input id="SignInControl__ctl0_dontSaveUserName" type="checkbox" name="SignInControl:_ctl0:dontSaveUserName" />
-------------------------------------------------------------

As Yoorix told me ,I provide in "Post data" field of HTTP test with this string :
--------------------------------------------------------------------
SignInControl:_ctl0:signInName=leo1631&SignInControl:_ctl0:password=123456
------------------------------------------------------------------------------------
But it does not work, it seems just like do not post the string at all.
this kind of test is very important to me.
Help me and thanks a lot.
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

in system log of hm, I find the action starting log
Log does not say when action was started. Log says when service was stopped. Different services may need different amount of time to stop.

Regards
Alex
Post Reply