Link to home
Start Free TrialLog in
Avatar of la-tempestad
la-tempestadFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Monitoring cluster SQL Server

Hi,

I have 2 SQL Servers in a cluster.
I need to monitor both the servers in a cluter to find which is up and which is down.
so whenever I do a failover it has to show the first server SQL01 is down-View1 SQL query
I have to do the same thing when the second server down,  has to show SQL02 is down-view2 SQL query.

we have got our own inhouse monitor application running on asp.net which can pass the SQL view as a parameter with relevant columns
for monitoring purposes.

I need to crate 2 views like this(at least this is the logic)
CREATE VIEW dbo.SQL01
declare @var1 as varchar(30)
set @var1 = cast(serverproperty('ComputerNamePhysicalNetBIOS') as varchar)
if
@var1<>'SQL01'(when it is not SQL01,I know that it has been failed over to SQL02)


thanks
la
Avatar of la-tempestad
la-tempestad
Flag of United Kingdom of Great Britain and Northern Ireland image

ASKER

We wanted to use our monitoring.aspx program.
It is not a problem for us to get the alerts using our own system.
But in this case the first time I have to use serverproperty function to get some results.
I don't know how to create conditional VIEW's for system functions like this "SERVERPROPERTY"

I have created another VIEW only for finding the cluster server name using,

CREATE VIEW dbo.ClusterName
(ServerName) as select serverproperty('ComputerNamePhysicalNetBIOS')

and when I pass "ServerName" as the field input-I get the active cluster name.

But my problem is how I will write conditions in a view especially for "SERVERPROPERTY" function to find out

New View1 SQL01- condition if Servername <> SQL01 -----(so whenever we fail over, this monitor should goes down as it is not SQL01)
output as SQL02.

New View2 SQL02- condition if ServerName <>SQL02---(same here.)
output as SQL01.

thanks
la
I just found out the solution myself.


CREATE VIEW [dbo].[Server1]
 (Server1)as SELECT cast(serverproperty('ComputerNamePhysicalNetBIOS') as varchar(50))
                   where cast(serverproperty('ComputerNamePhysicalNetBIOS') as varchar(50)) !='SQL01'


Now I can call this view to trigger the monitor page to stay up or down.
if the value is not 'SQL01' in the Server1(field) the monitor goes down.

thanks
la
ASKER CERTIFIED SOLUTION
Avatar of EE_AutoDeleter
EE_AutoDeleter

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial