PostEvent.asp and the AeXNSEventRouter

book

Article ID: 178452

calendar_today

Updated On:

Products

Management Platform (Formerly known as Notification Server)

Issue/Introduction

 

Resolution

Question
What is the AeXNSEventRouter (also know as the Event Router and previously the CEEventRouter)?

Answer
The AeXNSEventRouter, which we will refer to as the Event Router in this article is the component responsible for the reception and routing of client messages (aka Notification Server Events - NSEs) from the PostEvent.asp page onto the Event Queues.

When the altiris agent needs to send information back to the Notification server (posting inventory, event status messages etc) the NS Client uses the PostEvent.asp page available on the NS (on the web folder 'http://<altiris_ns>/altiris/ns/agent' ).

The PostEvent.asp contains a single VBScript (added at the end of this document) that handles the creation of the EventRouter and thus the routing of the posted event.

Upon message reception the  EventRouter task is to uncompress the posted event (if necessary) and save it in the relevant message queue. Message queues are located in the NSCap (URL = 'http://<altiris_ns>/Altiris/NS/NSCap' or UNC = '\\<altiris_ns>\NSCap' ). Client Messages are routed to the EventQ, EvtQFast, EvtQSlow or EvtQLarge based on the message size and different queues threshold. Message queues threshold are defined in the registry in the following keys:


'HKLM\Altiris\eXpress\Notification Server\FastQueueThreshold' Value = 15000 (approx. 14kB)

'HKLM\Altiris\eXpress\Notification Server\LargeQueueThreshold' Value = 20971520 (20MB)

'HKLM\Altiris\eXpress\Notification Server\ SlowQueueThreshold' Value = 1048576 (1MB)

This in practice means that NSE will be routed to the various queue based on this table:

Message size  Queue
      NSE  14  KB     EvtQFast
14  KB NSE  1 MB     EvtQueue
 1 MB < NSE 20  MB      EvtQSlow
 20 MB  < NSE        EvtQLarge



PostEvent.asp source code:

<%@ Language=VBScript %>
<%

Dim objRouter, strErr

On Error Resume Next

if Request.TotalBytes = 0 Then
     Response.Write "No data"
     Response.End
end if

'Server.CreateObject("Altiris.Log").ReportNTEventLogInformation "PostEvent.asp: Event received "
Set objRouter = Server.CreateObject("Altiris.AeXNSEventRouter")
If (Err.number <> 0) Then
     Response.Write "Event not processed. Failed to create Event Router. Error number: " & Hex(Err.number) & ". Error description: " & Err.Description
Else
     'objRouter.Deliver Request.BinaryRead(Request.TotalBytes)
     objRouter.DeliverPostedData 
     If (Err.number <> 0) Then
          If (Err.number = &H8004200C ) then  ' The event queue is full 
              Response.Status = "503 Service overloaded"
              Response.End
          ElseIf (Err.number = &H80056007 ) then 'the event queue is full AND the FlushAgentQueues is set
              strErr = "<error number=""" & Hex(Err.number) & """><![CDATA[Event not processed. The Server is busy and will not process any agent requests. Flush agent local event queue]]></error>"
              Response.Status = "503 Service overloaded"
              Response.Write strErr
              Response.End
          Else
              strErr = "Event not processed. Error number: " & Hex(Err.number) & ". Error description: " & Err.Description
              Server.CreateObject("Altiris.Log").ReportNTEventLogError "PostEvent.asp: Error " & hex(err.number) & ", " & strErr
              Response.Write strErr
          End If  

      Else
            Response.Write "Event successfully processed."  
      End If
End If

Set objRouter = Nothing

%>