OBDC logging in multiple specific table

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
mlimtl
Posts: 41
Joined: Wed Apr 05, 2006 2:11 pm

OBDC logging in multiple specific table

Post by mlimtl »

HI,

I try to log test result on a SQL Server in different table with detail depending on the test. I have found how to switch in different table with %FolderComment% but I want to log different column for different test

I try the following INSERT but it's not working ..

INSERT INTO hostmonitor.dbo.%FCommentLine01% (%FCommentLine02%) VALUES (%FCommentLine03%)

Any idea ?

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

Post by KS-Soft »

I want to log different column for different test
Then you should use test comment and %CommentLine1%...%CommentLine55% macro variables.
But.. it might be difficult to analyze such log :roll:

Regards
Alex
mlimtl
Posts: 41
Joined: Wed Apr 05, 2006 2:11 pm

Post by mlimtl »

I have make folders for each kind of test that I use and I was hoping to use the comment of the folders ....

If I try Insert into %FolderComment% ( blablabla I get error near ( like if the %FolderComment% is not working ...
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

So you need folder specific query, not test specific query?
Then use variable %FCommentLine1% (..1, not ..01)

Regards
Alex
mlimtl
Posts: 41
Joined: Wed Apr 05, 2006 2:11 pm

Post by mlimtl »

Thanks, I have just find that too :oops:

Now, the only part not working is replacing the expression after the VALUES with my %FCommentLine3% ....

The cmment line 3 is :
('%TestName%','%Agent%','%TestMethod%','%Interval%','%ScheduleName%','%AlertProfile%','%AlertThreshold%','%MasterTest%','%TaskComment%','%Folder%','%ModifiedTime%','%DateTime%','%LastTestTime%','%Reply%','%Status%','%AcknowledgedAt%','%AcknowledgedBy%','%AckComment%','%LastStatus%','%LastReply%','%PreviousStatus%','%Recurrences%','%StatusChangedTime%','%StatusChangesCnt%','%TotalTests%','%TotalTime%','%FailedCnt%','%PassedCnt%','%UnknownCnt%','%AliveTime%','%DeadTime%','%UnknownTime%','%AliveRatio%','%DeadRatio%','%UnknownRatio%','%AverageReply%','%MinReply%','%MaxReply%','%HostAddr%','%ServiceComp%','%ServiceName%','%httppage%','%NTEventSource%','%NTEventComp%','%NTEventTime%','%NTEventType%','%NTEventID%','%NTEventText%','%NTEventUser%','%TrapHost%','%TrapType%','%Enterprise%','%EnterpriseName%','%MibOid%','%MibName%','%MibType%','%MibValue%')

ML
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Post by KS-Soft Europe »

Hm. Quite long sentence. Please, note: Maximum length of the query: 4096 symbols. http://www.ks-soft.net/hostmon.eng/mfra ... dvancedLog

Could you specifythe full query into SQL Query field (Options > Advanced Logs tab) and press Test button. What exact error do you retrieve?

Regards,
Max
mlimtl
Posts: 41
Joined: Wed Apr 05, 2006 2:11 pm

Post by mlimtl »

Ok, I have simplified my setup a little bit :-) I have a new DB and only one folder and one test ...

If I test :
Insert into %FCommentLine1% %FCommentLine2% VALUES %FCommentLine3%
I get the message : Return code: 4294967295
[Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near 'OK'

FCommentLine1 : hostmonitor.dbo.hmlog2
FCommentLine2 : ( Status, Reply, Intervale, ScheduleName)
FCommentLine3 : ( '%Status%', '%Reply%', '%Interval%', '%ScheduleName%')


ML
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Post by KS-Soft Europe »

I think, for investigation purposes, you should specify full query, like:

Code: Select all

Insert into  hostmonitor.dbo.hmlog2 ( Status, Reply, Intervale, ScheduleName) Values ( '%Status%', '%Reply%', '%Interval%', '%ScheduleName%')

When you figure the problem out, you may specify variables, like:

Code: Select all

Insert into %FCommentLine1% %FCommentLine2% VALUES %FCommentLine3% 
Please, be aware: each folder must have FCommentLine1,FCommentLine2,FCommentLine3 values specified.

Regards,
Max
mlimtl
Posts: 41
Joined: Wed Apr 05, 2006 2:11 pm

Post by mlimtl »

It's work fine without the %FCommentLineNN%, work also when I replace the DB with %FcommentLine1%, work also when I replace the column with %FcommentLine2% but stop when I replace the values with %FcommentLine3% l ...

Insert into %FCommentLine1% %FCommentLine2% VALUES %FCommentLine3%
I get the message : Return code: 4294967295
[Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near 'OK'

FCommentLine1 : hostmonitor.dbo.hmlog2
FCommentLine2 : ( Status, Reply, Intervale, ScheduleName)
FCommentLine3 : ( '%Status%', '%Reply%', '%Interval%', '%ScheduleName%')
mlimtl
Posts: 41
Joined: Wed Apr 05, 2006 2:11 pm

Post by mlimtl »

Hummm ... I get the same error message if I put nothing in the comment line 3 of the folder ... %FCommentLine3% = ''
mlimtl
Posts: 41
Joined: Wed Apr 05, 2006 2:11 pm

Post by mlimtl »

Ok, Can't be simplified more :-)

Insert into %FCommentLine1% %FCommentLine2% VALUES %FCommentLine3%

FCommentLine1 : hostmonitor.dbo.hmlog2
FCommentLine2 : ( Status)
FCommentLine3 : ( '%Status%')

The DB have oly one column, Status which is a varchar 50

I still get the message : Return code: 4294967295
[Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near 'OK'
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

near 'OK'
Looks like all variables were resolved correctly. Status = Ok, right?

Regards
Alex
mlimtl
Posts: 41
Joined: Wed Apr 05, 2006 2:11 pm

Post by mlimtl »

yes , the real Status is OK and it's change to Bad if I revert the test and refresh it ...

It's reallyr look like we can use a variable in sql for the values ... I even try to include the Key work Values in the comment and it's still the same error ...

When I try only %FolderComment% as SQL Query and put Insert into hostmonitor.dbo.hmlog2 (Status) Values ('Status') In the folder comment, I get the error Incorrect syntax near 'Status'
mlimtl
Posts: 41
Joined: Wed Apr 05, 2006 2:11 pm

Post by mlimtl »

new test ...

It's work when I put in SQL Query : Insert into hostmonitor.dbo.hmlog2 (Status) Values ('Status')

It's not working when I put in SQL Query %FolderComment% and Insert into hostmonitor.dbo.hmlog2 (Status) Values ('Status') in the FolderComment ... Incorrect syntax near 'Status'

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

Post by KS-Soft »

I see what's wrong. Some folder/test specific variables (e.g. Reply value) may contain ' (quotation mark), so HostMonitor must replace ' with ''. This option really useful for most of the customers. Unfortunately its not useful for you.
Solution? H'm.. :roll: may be you should use single query for common logging. If you need additional information for some tests, you may use "SQL Query" action.

Regards
Alex
Post Reply