I have some troubles to log my events to an MSSQL (2000) database.
When checks changed to bad or good nothing wil written in the database.
My situation is as follow:
1 Databaseserver (W2k3 R2 and MSSQL 2000 std)
1 Hostmonitor machine (Windows XP Professional + Hostmonitor 5.34)
1 Client to test for monitoring (Windows 2003 SBS R2)
On the database server i created the following:
Code: Select all
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Graphic]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Graphic]
GO
CREATE TABLE [dbo].[Graphic] (
[DT] [datetime] NULL ,
[TestID] [nvarchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Rpl] [numeric](18, 0) NULL ,
[CommentLine1] [nvarchar] (5) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[CommentLine2] [nvarchar] (5) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[CommentLine3] [nvarchar] (5) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[CommentLine4] [nvarchar] (5) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[CommentLine5] [nvarchar] (5) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[CommentLine6] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO
After this i create an Stored Procedure with the following script:
Code: Select all
CREATE PROCEDURE sp_AddGraphic
@DT datetime = NULL,
@TstID nvarchar (10) = NULL ,
@Rpl numeric(18, 0) = NULL ,
@CL1 nvarchar(5)= NULL ,
@CL2 nvarchar(5) = NULL ,
@CL3 nvarchar(5) = NULL ,
@CL4 nvarchar(5) = NULL ,
@CL5 nvarchar(5) = NULL ,
@CL6 nvarchar(100) = NULL
AS
INSERT INTO GRAPHIC
(DT, TestID, Rpl, Commentline1, Commentline2, CommentLine3, Commentline4, Commentline5, Commentline6)
VALUES
(@DT, @TstID, @Rpl, @CL1, @CL2, @CL3, @CL4, @CL5, @CL6)
GO
On the client server i created the following:
ODBC connection to the database server via SYSTEM DSN. I selected the right database and give the HmLog SQL credentials. When testing the connection i says Succesfull.
On the hostmonitor machine i create the following test:
Internal Memory Check, When < then 100Mb status is Bad Else Good.
I create an action profile for it with an SQL Query what will do the following when Bad:
Action type: SQl Query
Action name: SQl Query
Execute by HostMonitor (Local Machine)
Condition to start action (Advanced) ('%SimpleStatus%'=='DOWN')
ODBC data Source HM_HBK(DatabaseName)
Login: HmLog
Password: Password
SQL Query: EXEC AddGraphic '%DateTime%', '%TestID%', '%Reply_Integer%', '%CommentLine1%', '%CommentLine2%', '%CommentLine3%', '%CommentLine4%', '%CommentLine5%', '%CommentLine6%'
Timeout: 10 sec
It is very strange when the test is bad nothing wil written to the database. Can someone advise me wat i'm doing wrong at the moment?