Home Forums SQL Server 7,2000 SQL Server Agent Script For Monitoring State of other servers and alerting !!! RE: Script For Monitoring State of other servers and alerting !!!

  • I'm sure there is a better way. This was just fast to throw together.

    This assumes you have dbmail setup and a valid operator.

    Run this on the server you want to monitor:

    create database dbadmin

    go

    use dbadmin

    go

    create table serverstatus (

    isawake char(1))

    GO

    insert into serverstatus

    values(1)

    create a least privelidged login and a link server connection from your monitor to the monitoree with that account.

    Then throw this in a job step

    Declare @isawake char(1)

    set @isawake = (select isawake

    from [SERVERIWANTTOMONITOR].dbadmin.dbo.serverstatus)

    if @isawake <> '1'

    begin

    raiserror('Test Notify Server Failure', 16, 1, 1)

    end

    Set the notifications on the job to email the operator on failure. Also have a second server that points back to the monitor server to validate that is awake as well.