Video Screencast Help

Monitor Tasks - Email the correct party

Created: 30 Jan 2013 | 4 comments

Right now we have a standard set of monitor policies that run on all servers that emails just about everyone on the server team like when a server is down. Is it possible to right a conditional task rule that would only email our DBA's when the server is a SQL server and not email them when it's a differnt type of server? I already have a nother table that stores assigned server roles and even IT owners of those servers. Could I use that info in a token or something in a Monitor policy and conditional task?

Comments 4 CommentsJump to latest comment

mclemson's picture

Yes, the e-mail task should send To: the e-mail token.  I created a test table that used computer name and joined to vComputer, so my token query looked like this: SELECT sot.OwnerEmail FROM vComputer vc JOIN ServerOwnerTable sot ON sot.ServerName=vc.Name WHERE vc.[Guid] = %COMPUTERID%

When the task fires for the monitor policy it will send to the e-mail address pulled from the token.  Create an exception report that e-mails you weekly for any computers with Monitor Plug-in Installed whose names are not in your custom table (e.g. ServerOwnerTable), so that you always have owners defined for the monitor e-mails.

So if your custom token is %ServerOwnerEmail%, as mine was, then you would put this in the task in the To: field.

Mike Clemson, Senior Systems Engineer, ASC
Intuitive Technology Group -- Symantec Platinum Partner

noodleNT's picture

So I tried the following but the Token generator doesn't seem to like + being used. Any ideas around that?

  WHEN pu.Email IS NULL THEN ''
  WHEN su.Email IS NULL THEN pu.Email
  ELSE + '; ' + su.Email
From vComputer cmp
  ON CMP.Guid = rl._ResourceGuid
 LEFT JOIN [dbo].[Inv_Naming_Convention_Details] AS NC
  ON rl.Symbol = NC.Symbol AND NC._ResourceGuid = 'A9F7D44E-0E40-4D0C-8077-E2F5569CD77D'
 LEFT JOIN vUser AS PU ON PU.Guid = NC.[Primary Owner]
 LEFT JOIN vUser AS SU ON SU.Guid = NC.[Secondary Owner]
Where cmp.Guid = '%COMPUTERID%' 

noodleNT's picture

Figured out a way around it using STUFF and REPLACE.

STUFF(Replace(,'.com','.com; ;'), LEN(Replace(,'.com','.com; ;')),1,

noodleNT's picture

Problem... ComputerID is the GUID of the TASK server. Not the server that has the problem. Can you use %!MONITOR_RESOURCE_GUID!% for the computer ID in the token?