How do I post Macros in URL or HTTP tests?

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).
Robert_in_MTL
Posts: 229
Joined: Tue Jun 20, 2006 1:20 pm
Location: Montreal, Quebec

How do I post Macros in URL or HTTP tests?

Post by Robert_in_MTL »

Hi,
I created an URL test to post test data and everything works fine but...

Macros are sent as the macro name instead of their value!!!
(translate date macro variables checkbox doesn't change the result)

My URLtest is this:

Code: Select all

http://[My Server]:80/test/test.ASP?TEST=MonitoringServerURL
advance settings/ http post Data:

Code: Select all

Reply_Number=%LastReply%

I tried these with no success:
  • Reply_Number=%LastReply%
    Reply_Number="%Reply%"
    Reply_Number=%DATE%
What I get is this: (log displays TEST value + Reply_Number form data)
  • Fri Dec 21 09:13:25 EST 2007 MonitoringServerURL,LastReply
    Fri Dec 21 09:20:55 EST 2007 MonitoringServerURL,"Reply"
    Fri Dec 21 09:21:16 EST 2007 MonitoringServerURL,ÚTE
What AM I doing wrong???

Thanks for your help.
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Re: How do I post Macros in URL or HTTP tests?

Post by KS-Soft Europe »

Robert_in_MTL wrote:Macros are sent as the macro name instead of their value!!!
Sorry, "HTTP Post request" option has not supported macro variables yet. Probably, we should improve it in next version.
Robert_in_MTL wrote:(translate date macro variables checkbox doesn't change the result)
"Translate date macro variables" checkbox affects the "Path/File" input box only.

Regards,
Max
Robert_in_MTL
Posts: 229
Joined: Tue Jun 20, 2006 1:20 pm
Location: Montreal, Quebec

Post by Robert_in_MTL »

What!!! :o :o :o :o :o :o :o :o
What is the point of the post test then???
Arrrrgn. I was so, so certain that this test was interpreting macros!!!!

Any chance a fix could be done to make this appen?

I really need a solution, BIG TIME...
Can I generate a txt report end send it to the tested URL?
We could create a coldfusion page (or webservice) to parse that file and insert values in the database over there.

Please, show me the light! lol :roll:

Ultimately, I need to post many test results (macro values) to many sites we host... (Don't ask, it's a President request :wink:)

Please help, I need this to work before December 27 preprod, and December 28 for prod.

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

Post by KS-Soft »

What!!!
Actually macro variables (most of them) were designed for actions, not for the tests. I think its pretty clear described in the manual.
Quote from the manual
When defining some of the alert action's parameters you can use special macro variables. There are 6 groups of macro variables: ....
http://www.ks-soft.net/hostmon.eng/mfra ... .htm#macro
What is the point of the post test then???
You may post data to server to check web site data processing. If some script does not work correctly it can be detected, status of the test will be changed, actions will be triggered...
Can I generate a txt report end send it to the tested URL?
We could create a coldfusion page (or webservice) to parse that file and insert values in the database over there.
Are you sure you need a test? not an action?
It sound like you do not want to test/monitor anything using this URL test.

There is "HTTP request" action that support macros just like any other action
http://www.ks-soft.net/hostmon.eng/mfra ... tm#actHTTP
If you can modify script on your server to support GET requests instead of POST, problem will be solved.
Otherwise you may post request using "Whish list" forum. Probably we can implement POST method for "HTTP request" action. But not this week, sorry.
On the other hand you may try to find 3rd party utility for this purpose and use "Execute external program" action to launch utility.

Regards
Alex
Robert_in_MTL
Posts: 229
Joined: Tue Jun 20, 2006 1:20 pm
Location: Montreal, Quebec

Post by Robert_in_MTL »

AHHHHHHHHHH!

Thanks for the quick reply, I will try and test HTTP test to do the macro posting!

If this works, I am in business!

For your question regarding my need to use a test instead of an action: Yes I need a test because I want to send this test values to the webservice and i don't need a report or anything else.

Anyway, I'll try this right away.
Robert_in_MTL
Posts: 229
Joined: Tue Jun 20, 2006 1:20 pm
Location: Montreal, Quebec

Post by Robert_in_MTL »

:evil: :evil: :evil:

HTTP Request action does not support these needed macros:

%HostAddr%
%HostURL%
%RelatedURL%

I have to type the Host name and the request with hard typed URLs to make it work :( :(

I need the test to be generic

Ideally, I would like to use %HostAddr% for host and %RelatedURL% for request, I would then add parameters to the Request.

Like this:

Code: Select all

Host field: %HostAddr%

Code: Select all

Request Field: GET %RelatedURL%&Reply_Number=%Reply_Number%&AliveRatio=%AliveRatio% HTTP/1.0
This would make the action profile generic for all my related tests...

Did I go wrong somewhere?

Thanks
Robert_in_MTL
Posts: 229
Joined: Tue Jun 20, 2006 1:20 pm
Location: Montreal, Quebec

Post by Robert_in_MTL »

Strangely,

this works:

Code: Select all

RelatedURL is set to this: http://itdev/test/test.ASP?TEST=MonitoringServerAction

Host set to itdev

Code: Select all

Request : GET http://itdev/test/test.ASP?TEST=MonitoringServerAction&Reply_Number=%Reply_Number%&AliveRatio=%RelatedURL% HTTP/1.0
this gives me this result:

Code: Select all

Fri Dec 21 11:52:18 EST 2007	MonitoringServerAction,94.00,http://itdev/test/test.ASP?TEST=MonitoringServerAction
How come HM resolves the %RelatedURL% at the end of the request but not at the beginning?
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

HTTP Request action does not support these needed macros:
%HostAddr%
%HostURL%
%RelatedURL%
1) It does support these variables (if you are talking about "request" property of the action). If action support SOME variables, it support ALL variables
2) Please note: some variables are test specific. E.g. %HostURL% variable can be used in action that has been triggered by URL or HTTP test method.
%HostAddr% variable ...
Quote from the manual
==============
Represents the host name (or IP address) of the target system for the following tests: Ping, TCP, URL, HTTP, Oracle, Interbase, MS SQL, MySQL, Sybase, Postgre, Process, Service, NT Log, CPU Usage, SNMP, SMTP, POP, IMAP, DNS, LDAP, UNC, UDP, NTP, RADIUS, Temperature Monitor, Traffic Monitor
==============

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

Post by KS-Soft »

this gives me this result:
Fri Dec 21 11:52:18 EST 2007 MonitoringServerAction,94.00,http://itdev/test/test.ASP?TEST=MonitoringServerAction
What exactly means "result"? Where do you see this line? Web Server log files? Result of some script? May be script processes just 1st parameter?
How come HM resolves the %RelatedURL% at the end of the request but not at the beginning?
According to your previous message it does not resolve variable at all. Could you please explain and show example of that "end of the request"?

Regards
Alex
Robert_in_MTL
Posts: 229
Joined: Tue Jun 20, 2006 1:20 pm
Location: Montreal, Quebec

Post by Robert_in_MTL »

Ok, Sorry if I am unclear...

As stated in my first post, my asp page writes a log that displays what has been sent (parameters in URL, or form data). I modified my page to handle parameters: Param1 (TEST), Param2(Reply_Number), Param3(AliveRatio), but it is irrelevant, I assign values and log them, that's it.
This been said,

If I type this:

Code: Select all

http://itdev/test/test.ASP?TEST=MonitoringServerAction&Reply_Number=1234&AliveRatio=whateverText
I get this in the log:

Code: Select all

Fri Dec 21 13:12:59 EST 2007	MonitoringServerAction,1234,whateverText
My test is a HTTP test, URL = http://itdev/test/test.ASP?TEST=MonitoringServerTest
Related URL = http://itdev/test/test.ASP?TEST=MonitoringServerAction

Now in the action properties, If I enter itdev in the Host field, it works but if I enter %HostAddr%, it does not work.

If I enter this for the request:

Code: Select all

GET http://itdev/test/test.ASP?TEST=MonitoringServerAction&Reply_Number=%Reply_Number%&AliveRatio=%RelatedURL% HTTP/1.0
I get this in the generated log:

Code: Select all

Fri Dec 21 13:16:39 EST 2007	MonitoringServerAction,125.00,http://itdev/test/test.ASP?TEST=MonitoringServerAction
But If I enter this:

Code: Select all

GET %RelatedURL%&Reply_Number=%Reply_Number%&AliveRatio=%RelatedURL% HTTP/1.0
it does not work!

Thus my question wy does HM resolve %RelatedURL% at the end but not at the beginning of my request???

Hope this clarifies...

I want to use Macros in "HTTP request" action parameters.
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

Now in the action properties, If I enter itdev in the Host field, it works but if I enter %HostAddr%, it does not work
Correct. Variables can be used for "request" but not "host" field
But If I enter this: Code:
GET %RelatedURL%&Reply_Number=%Reply_Number%&AliveRatio=%RelatedURL% HTTP/1.0
it does not work!
H'm :roll: strange. We will try to reproduce this problem...

Regards
Alex
Robert_in_MTL
Posts: 229
Joined: Tue Jun 20, 2006 1:20 pm
Location: Montreal, Quebec

Post by Robert_in_MTL »

Ok.

Now, this may be a dumb question but why do you need the host field? Couldn't you just calculate it from the URL in the request ?
If there's no way around, when you take a look at the problem, can you enable Host to use %HostAddr%?

Until then, I will hardcode an action specifically for my test, but I need use an action like this for 100 or more URLs in January so I really need these fields to work with macros.

Again, thank you for your quick replies, I really appreciate it, your support is examplary.
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

How come HM resolves the %RelatedURL% at the end of the request but not at the beginning?
Sorry, cannot reproduce this problem. What version of HostMonitor do you use?
If there's no way around, when you take a look at the problem, can you enable Host to use %HostAddr%?
Yes, I think we can do that

Regards
Alex
JuergenF
Posts: 331
Joined: Sun Jan 26, 2003 6:00 pm
Location: Germany, North Rhine-Westphalia

Post by JuergenF »

Hi Robert
Robert_in_MTL wrote:Until then, I will hardcode an action specifically for my test, but I need use an action like this for 100 or more URLs in January so I really need these fields to work with macros.
I see that you have to get that running in a very short time.
Therefore I just want to give you a possible idea how to create many similar tests with a script.
http://www.ks-soft.net/cgi-bin/phpBB/vi ... port#15292

If that is an option for you and you need help, just let me know.

Regards and a merry christmas to the community

Juergen
Robert_in_MTL
Posts: 229
Joined: Tue Jun 20, 2006 1:20 pm
Location: Montreal, Quebec

Post by Robert_in_MTL »

Thanks JuergenF for your script...

Alex, I am using HM 7.00, RCC 2.30 Beta.

It is strange that you could not reproduce the problem... I am doing this via RCC, maybe this could be the problem?

I even tried entering a simple URL like this

Code: Select all

http://itdev/test/test.ASP
in the test's related URL field to remove all parameters and entering all parameters in the action properties:

Code: Select all

GET %RelatedURL%?Reply_Number=%Reply_Number%&AliveRatio=%AliveRatio% HTTP/1.0
It does not work... :(

So if I understand correctly, you can enter a request starting with %RelatedURL%, add some parameters, and it works? Strange that we have different behaviors...

Can you post the exact relatedURL in your test and what you entered in the request field in the HTTP Request action profile please?
Post Reply