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

ODBC Logging to SQL Server

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    KS-Soft Forum Index -> HostMonitor
View previous topic :: View next topic  
Author Message
cbraatz



Joined: 03 Apr 2002
Posts: 4
Location: Buena Park, CA

PostPosted: Thu Apr 04, 2002 11:05 am    Post subject: Reply with quote

What are the details of the database needed to log all activity to sql. Do you have a db for us to load. How about the specs so I can create my own. Thanks Alex!
Back to top
View user's profile Send private message Send e-mail Visit poster's website
KS-Soft



Joined: 03 Apr 2002
Posts: 12791
Location: USA

PostPosted: Thu Apr 04, 2002 12:49 pm    Post subject: Reply with quote

cbraatz,

Format of database table is entirely up to you. You can specify SQL query to insert record to the log. So, format of table must be corresponding to your SQL query.

Just for example you can create table (hmlog) with 1 date field (named date1), and 4 string fields (named: date1, time1, testname, status, reply). To insert records use SQL query like:
Insert into hmlog (date1, time1, testname, status, reply) VALUES (%Date%, '%Time%', '%TestName%', '%Status%', '%Reply%')

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



Joined: 03 Apr 2002
Posts: 49

PostPosted: Thu Apr 04, 2002 3:05 pm    Post subject: Reply with quote

Hi Alex, I try to specify more fields to my sql query, but it only except that field which you provide on example. I want to save in table all field from log. It's possible or not?.
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
KS-Soft



Joined: 03 Apr 2002
Posts: 12791
Location: USA

PostPosted: Thu Apr 04, 2002 3:48 pm    Post subject: Reply with quote

Yes, its possible, but its depend on your database, table, query.
You can try to use "Test" button on "Advanced Logs" page in the Options dialog. When some error occurs, HostMonitor will display error message from your ODBC driver. So, you will know where is mistake.

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



Joined: 03 Apr 2002
Posts: 4
Location: Buena Park, CA

PostPosted: Thu Apr 04, 2002 4:06 pm    Post subject: Reply with quote

When logging to sql server the date amd time field show up with the date as 1900-01-01. The time however is correct.
Thanks for your fast responses.
Craig
Back to top
View user's profile Send private message Send e-mail Visit poster's website
KS-Soft



Joined: 03 Apr 2002
Posts: 12791
Location: USA

PostPosted: Fri Apr 05, 2002 2:35 pm    Post subject: Reply with quote

As I understand you have one field in database which represented date&time?
What macro variable for this field do you use in SQL query?
%DateTime%? Or %Time%? Must be %DateTime%

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



Joined: 03 Apr 2002
Posts: 4
Location: Buena Park, CA

PostPosted: Fri Apr 05, 2002 3:44 pm    Post subject: Reply with quote

Thanks Alex. I used the following for the sql query:
Insert into hmlog (time, testname, status, reply) VALUES ('%DateTime%', '%TestName%', '%Status%', '%Reply%')
Back to top
View user's profile Send private message Send e-mail Visit poster's website
KS-Soft



Joined: 03 Apr 2002
Posts: 12791
Location: USA

PostPosted: Fri Apr 05, 2002 4:53 pm    Post subject: Reply with quote

By default HostMonitor uses your system date format. Perhaps your SQL server (or ODBC driver) doesn't like this format?
I see two ways to test this:
- change type of "time" field to string.
- set "Use fixed date&time formats" option (on Miscellaneous page in the Options dialog) and specify date format supported by your SQL server.

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



Joined: 03 Apr 2002
Posts: 49

PostPosted: Tue Apr 09, 2002 8:28 am    Post subject: Reply with quote

Alex

I understand that output from Host Monitor to odbc database connections depend of which table structure I specify in query, but I have to know how I can specify field name from Host Monitor log for example: %date%, %testname%, %status%, %reply% are working find but when I use %lasttesttime% or %comment% or all other columns from log file I got zero output to the my table. Please, provide the right syntax for all columns name from Host Monitor log file.
Thank you. I
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
KS-Soft



Joined: 03 Apr 2002
Posts: 12791
Location: USA

PostPosted: Tue Apr 09, 2002 1:37 pm    Post subject: Reply with quote

Old macro variables (supported by HostMonitor 1.xx and 3xx): http://www.ks-soft.net/hostmon.eng/actions.htm#macro
New macro variables (version 3.xx only): http://www.ks-soft.net/hostmon.eng/news.htm#NewCol

But if the program does not insert any records into your table, it means you SQL server doesn't like SQL query. Use "Test" button (beside SQL query field in the Options dialog) to see answer from SQL server.
Also make sure you use ('') for text fields like '%TaskComment%', '%Status%'.

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



Joined: 03 Apr 2002
Posts: 49

PostPosted: Wed Apr 10, 2002 7:33 am    Post subject: Reply with quote

Alex,
Thank you very much.
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
KS-Soft



Joined: 03 Apr 2002
Posts: 12791
Location: USA

PostPosted: Wed Apr 10, 2002 11:42 am    Post subject: Reply with quote

You are welcome
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    KS-Soft Forum Index -> HostMonitor 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