How is a relay agent selected in Notification Server for Wake on Lan?

book

Article ID: 179735

calendar_today

Updated On:

Products

Management Platform (Formerly known as Notification Server)

Issue/Introduction

 

Resolution

Question
What is the criteria or process that is used in consideration for choosing a Wake on Lan 'relay agent' using the Notification Server?

Answer
The criteria for selecting a relay agent are as follows:

First is to check and see if a computer has a role of NS, PS or simply the Altiris Agent is installed. Notification Server is given a higher priority and then Package Servers and then down to just having the Altiris Agent installed.
Then is a check for the ownernsguid of the agent to see if it matches the Notification Server guid in VthisNS
The computer also needs to be managed locally  'IsManaged = 1'
An IP address needs to be retrieved from Inv_AeX_AC_TCPIP it cannot be Null, '0.0.0.0.0', or '127.0.0.1'
There also needs to be a valid subnet.  Not Null or '0.0.0.0'
The MAC Address is checked as well and cannot be Null or '00-00-00-00-00-00'
The Default Gateway cannot be '0.0.0.0' and the Subnet cannot be '255.255.255.255' 
The tables Evt_NS_Client_Config_Request and Evt_NS_Event_History are checked for the most recent agent communication

Below is the actual Query that is used for the process of selecting a Relay Agent.


sELECT DISTINCT vc.Guid, tcp.*,
CASE
WHEN r.Role = 'Notification Server' THEN 3
WHEN ca.[Agent Name] = 'Package Server' THEN 2
WHEN ca.[Agent Name] = 'Altiris Agent' THEN 1
END [priority]
INTO #potentialTmpTable
FROM vComputerResource vc
INNER JOIN Inv_AeX_AC_Roles r ON r._ResourceGuid = vc.Guid
INNER JOIN Inv_AeX_AC_Client_Agent ca ON ca._ResourceGuid = vc.Guid
INNER JOIN Inv_AeX_AC_TCPIP tcp ON tcp._ResourceGuid = vc.Guid
INNER JOIN Item i on i.Guid = vc.Guid
WHERE (r.Role = 'Notification Server' OR ca.[Agent Name] = 'Package Server' OR ca.[Agent Name] = 'Altiris Agent')
AND i.OwnerNSGuid = (SELECT Guid FROM vThisNS)
AND vc.[IsManaged] = 1
AND tcp.[Subnet] IN (SELECT [Subnet] FROM #pmtmp)
AND
( tcp.[IP Address] IS NOT NULL and tcp.[IP Address] <> '' and tcp.[IP Address] <> '0.0.0.0' and tcp.[IP Address] <> '127.0.0.1' ) and
( tcp.[Subnet] IS NOT NULL and tcp.[Subnet] <> '' and tcp.[Subnet] <> '0.0.0.0' ) and
( tcp.[MAC Address] IS NOT NULL and tcp.[MAC Address] <> '' and tcp.[MAC Address] <> '00-00-00-00-00-00' ) and
( tcp.[Default Gateway] <> '0.0.0.0' ) and ( tcp.[Subnet Mask] <> '255.255.255.255' )
order by priority desc
SELECT a.*, evt.[_eventTime] from #potentialTmpTable a
LEFT OUTER JOIN
(
SELECT et.[ResourceGuid], MAX( et.[_eventTime] ) AS [_eventTime]
FROM (
SELECT [ResourceGuid], MAX( [_eventTime] ) AS [_eventTime] FROM
Evt_NS_Client_Config_Request
GROUP BY [ResourceGuid]
UNION ALL
SELECT [ResourceGuid], MAX( [_eventTime] ) AS [_eventTime] FROM
Evt_NS_Event_History
GROUP BY [ResourceGuid] ) et
GROUP BY et.[ResourceGuid]
) evt ON evt.[ResourceGuid] = a.[Guid]
WHERE a.[priority] = ( SELECT MAX( b.[priority] ) FROM #potentialTmpTable b WHERE a.[Guid] = b.[Guid] )
ORDER BY a.[Subnet] DESC, a.[priority] DESC, evt.[_eventTime] DESC
DROP TABLE #pmtmp
DROP TABLE #potentialTmpTable