Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


SQL Agent Stopped


SQL Agent Stopped

Author
Message
Sushant Yadav
Sushant Yadav
Right there with Babe
Right there with Babe (743 reputation)Right there with Babe (743 reputation)Right there with Babe (743 reputation)Right there with Babe (743 reputation)Right there with Babe (743 reputation)Right there with Babe (743 reputation)Right there with Babe (743 reputation)Right there with Babe (743 reputation)

Group: General Forum Members
Points: 743 Visits: 871
if not exists (select * from [master].dbo.sysprocesses where left(program_name,8)='SQLAgent')
Begin
EXEC msdb.dbo.sp_send_dbmail
@profile_name ='Database Mail',
@recipients ='email@id.com',
@body ='Please look into the issue; Scheduled Jobs will not run if the SQL Server Agent Service remains stopped.',
@subject ='SQL Agent Stopped,Please Check' ;
End

I am using above script to find out whether SQL Agent Stopped is stoped or Running , I want to add IP address and Server name in subject line.

And I also want to monitor it for 40+ servers please help me for how above script can be used for monitoring the same .
SQLSACT
SQLSACT
UDP Broadcaster
UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)

Group: General Forum Members
Points: 1456 Visits: 2931
Something like this to get server name and IP

declare @subject nvarchar (100)
declare @v nvarchar(50)
set @v = convert (nvarchar (50),case when CONNECTIONPROPERTY('local_net_address') is null then '' else CONNECTIONPROPERTY('local_net_address') end)
print @v

set @subject = 'SQL Agent Stopped, Please Check ' + @@SERVERNAME

print @subject



Probably a better way of doing it, this just just off the top of my head
Sushant Yadav
Sushant Yadav
Right there with Babe
Right there with Babe (743 reputation)Right there with Babe (743 reputation)Right there with Babe (743 reputation)Right there with Babe (743 reputation)Right there with Babe (743 reputation)Right there with Babe (743 reputation)Right there with Babe (743 reputation)Right there with Babe (743 reputation)

Group: General Forum Members
Points: 743 Visits: 871
Thanks for your reply it worked on sql server 2008, but
on sql server 2005 it is giving me following error

Msg 195, Level 15, State 10, Line 4
'CONNECTIONPROPERTY' is not a recognized built-in function name.
SQLSACT
SQLSACT
UDP Broadcaster
UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)

Group: General Forum Members
Points: 1456 Visits: 2931
Use the local_net_address column of sys.dm_exec_connections
Sushant Yadav
Sushant Yadav
Right there with Babe
Right there with Babe (743 reputation)Right there with Babe (743 reputation)Right there with Babe (743 reputation)Right there with Babe (743 reputation)Right there with Babe (743 reputation)Right there with Babe (743 reputation)Right there with Babe (743 reputation)Right there with Babe (743 reputation)

Group: General Forum Members
Points: 743 Visits: 871
Thanks for your reply ,:-)
maheshdeore5386
maheshdeore5386
Forum Newbie
Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)

Group: General Forum Members
Points: 1 Visits: 1
While I am executing below query on machine which is accessing from sql agent from out of LAN:

SELECT
CONNECTIONPROPERTY('net_transport') AS net_transport,
CONNECTIONPROPERTY('protocol_type') AS protocol_type,
CONNECTIONPROPERTY('auth_scheme') AS auth_scheme,
CONNECTIONPROPERTY('local_net_address') AS local_net_address,
CONNECTIONPROPERTY('local_tcp_port') AS local_tcp_port,
CONNECTIONPROPERTY('client_net_address') AS client_net_address



Mahesh D. Deore
Nasik
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search