Solved

Monitoring cluster SQL Server

Posted on 2010-11-19
3
335 Views
Last Modified: 2012-05-10
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
0
Comment
Question by:la-tempestad
  • 2
3 Comments
 
LVL 1

Author Comment

by:la-tempestad
ID: 34179213
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
0
 
LVL 1

Author Comment

by:la-tempestad
ID: 34187033
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
0
 

Accepted Solution

by:
EE_AutoDeleter earned 0 total points
ID: 37141436
Because you have presented a solution to your own problem which may be helpful to future searches, this question is now PAQed and your points have been refunded.

EE_AutoDeleter
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

by Mark Wills Attending one of Rob Farley's seminars the other day, I heard the phrase "The Accidental DBA" and fell in love with it. It got me thinking about the plight of the newcomer to SQL Server...  So if you are the accidental DBA, or, simp…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now