Comparing results from SQL Queries

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
patsus19
Posts: 2
Joined: Thu Jun 12, 2008 4:48 am

Comparing results from SQL Queries

Post by patsus19 »

Using Hostmon 8.06 I am trying to compare the line count of a SQL table on two different servers alerting me if they aren’t the same. When the tests are run the results show the numbers in the reply field match but the test still shows bad

Here are the two tests I’m using

; ------- Test #01 -------

Method = ODBC
;--- Common properties ---
;DestFolder = Root\DP1\Active\
Title = DP1 - Test: ODBC: Etracs-HM
Comment = select count(*) from weeklytimecardhours
NamePattern = DP1 - Test: ODBC: %object%
CmntPattern = %path%
ScheduleMode= Regular
Schedule = 7 X 24 Except BU
Interval = 3600
Alerts = Email Admin
ReverseAlert= No
UnknownIsBad= No
WarningIsBad= Yes
UseCommonLog= Yes
PrivLogMode = Default
CommLogMode = Default
;--- Test specific properties ---
Datasource = Etracs-HM
Timeout = 10
SQLQuery = select count(*) from weeklytimecardhours
CheckField = LessThan
FieldRow = 1
FieldCol = 1
Value = 0
EmptyStatus = 0

; ------- Test #02 -------

Method = ODBC
;--- Common properties ---
;DestFolder = Root\DP1\Active\
Title = DP1 - Test: ODBC: Etracs-WP2
Comment = select count(*) from weeklytimecardhours
NamePattern = DP1 - Test: ODBC: %object%
CmntPattern = %path%
ScheduleMode= Regular
Schedule = 7 X 24 Except BU
Interval = 3600
Alerts = Email Admin
ReverseAlert= No
UnknownIsBad= No
WarningIsBad= No
UseNormal = No
UseCommonLog= Yes
PrivLogMode = Full
CommLogMode = Default
SyncCounters= Yes
SyncAlerts = No
DependsOn = list
MasterTest-Alive = DP1 - Test: ODBC: Etracs-HM
;--- Test specific properties ---
Datasource = Etracs-WP2
Timeout = 10
SQLQuery = select count(*) from weeklytimecardhours
CheckField = DifferentFrom
FieldRow = 1
FieldCol = 1
Value = %::DP1 - Test: ODBC: Etracs-HM::Reply_Number%
EmptyStatus = 0
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

Are you trying to use variable (that refers to another test item) as parameter of the test?? This will not work.
I would sugest to create stored procedure and compare values there then just return result to HostMonitor.
Another posible solution: use "Optional status processing" options
http://www.ks-soft.net/hostmon.eng/mfra ... processing

E.g. you may set Use Warning status if '%::DP1 - Test: ODBC: Etracs-HM::Reply%' <> '%SuggestedReply%' option

Regards
Alex
patsus19
Posts: 2
Joined: Thu Jun 12, 2008 4:48 am

Post by patsus19 »

Thanks for the reply, I used "Optional status processing" and it worked great.
Thanks again
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

You are welcome

Regards
Alex
Post Reply