Results 1 to 10 of 10
  1. #1
    Join Date
    Jan 2004
    Posts
    5

    Question Unanswered: Monitoring failovers on clustered servers

    I've been asked to write a script to monitor whether a clustered server is up and alive and if so which node it's actually running on. Apparently there's been some problems of failover to the passive server without anyone knowing that it happened and they want to know. Any suggestions?

  2. #2
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    The script below will result in capturing the currently active node:

    begin tran
    create table #tmp (hostname varchar(128) null)
    commit tran
    insert #tmp exec master.dbo.xp_cmdshell 'hostname' , no_infomsgs
    select * from #tmp where hostname is not null
    go
    drop table #tmp
    go

  3. #3
    Join Date
    Jan 2004
    Posts
    5
    We're in an active/passive environment, so when I run this script I just get the virtual servername back.

    Originally posted by rdjabarov
    The script below will result in capturing the currently active node:

    begin tran
    create table #tmp (hostname varchar(128) null)
    commit tran
    insert #tmp exec master.dbo.xp_cmdshell 'hostname' , no_infomsgs
    select * from #tmp where hostname is not null
    go
    drop table #tmp
    go

  4. #4
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    And what do you get when you run HOSTNAME from command line? I am getting the active node name. In fact, I went to our lab environment and ran it, then I forced a failover and got the other node's name - which proves that it workes as expected in identifying the active node.

  5. #5
    Join Date
    Jan 2004
    Posts
    5
    From the command line I do get the active server name, but when I run that script I get the virtual server name.

    Originally posted by rdjabarov
    And what do you get when you run HOSTNAME from command line? I am getting the active node name. In fact, I went to our lab environment and ran it, then I forced a failover and got the other node's name - which proves that it workes as expected in identifying the active node.

  6. #6
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    SQL Service account should belong to local administrators group on the box.

  7. #7
    Join Date
    Jan 2004
    Posts
    5
    Yes, it does.

    Originally posted by rdjabarov
    SQL Service account should belong to local administrators group on the box.

  8. #8
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    When you were testing the script, did you run it from QA or scheduled it as a job? As I said, I ran this script in both prod and lab environments, and even did a failover on the lab cluster, and hostname reported the correct active node. Anyone else sees something I missed?

  9. #9
    Join Date
    Jan 2004
    Posts
    5
    I've done it both ways - both through QA then through a ksh script and I'm still getting the virtual server name back. How odd!

    Originally posted by rdjabarov
    When you were testing the script, did you run it from QA or scheduled it as a job? As I said, I ran this script in both prod and lab environments, and even did a failover on the lab cluster, and hostname reported the correct active node. Anyone else sees something I missed?

  10. #10
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    Yup, it sure is.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •