Get ODBC Query result in email message body

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).
Post Reply
vidyagana
Posts: 106
Joined: Fri Mar 25, 2005 10:35 am

Get ODBC Query result in email message body

Post by vidyagana »

Hi Alex,

I have defined two tests like the following. The purpose of this test is to run an Oracle query and email me the result of the query.

1. I have defined one test which will calculate a count from my Oracle database and insert it into a table.
2. The second test is dependent on the above test and after the first test is executed this will run a ODBC query (Test method = ODBC Query) as follows:

select count(*) from <tablename> where ........

This test is defined with an action profile which will send an email with the message body = %Reply%.

When I tried to run these tests, I got the email but the message body is saying 78 ms (which I am thinking is the time it took for the count to come back) whereas I am expecting the message body to say something like 100000 which is the resultant count from the ODBC query. How will I be able to achieve this ?

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

Post by KS-Soft »

You do not see the value because you have not specified what field should be cheked ("Alert when field .." option of the test).

Regards
Alex
vidyagana
Posts: 106
Joined: Fri Mar 25, 2005 10:35 am

Post by vidyagana »

Ok, now that worked fine.

My initial query was

select demcnt from demcounts;

and when I checked the option of "Alert when ...." I was able to get the count value in %Reply%.

My question now is

I want to update my query like

select demcnt, timestamp from demcounts;

Now how can I achieve receiving both the values in %Reply%.

Thanks for all your help.
Yoorix
Posts: 177
Joined: Wed Dec 14, 2005 8:28 am

Post by Yoorix »

vidyagana wrote:I want to update my query like

select demcnt, timestamp from demcounts;

Now how can I achieve receiving both the values in %Reply%.
You may use concatenation for these fields, e.g
select Str(demcnt)+' '+Convert(varchar,timestamp) from demcounts

What exactly Database server do you use? You should use appropriate function instead of Str and Convert, if your database server does not support them.

Regards,
Yoorix
vidyagana
Posts: 106
Joined: Fri Mar 25, 2005 10:35 am

Post by vidyagana »

Yoorix,

We are using Oracle database and I did something similar to what you mentioned for the concatenation and it worked fine.

Thanks,
Vidya.
Post Reply