Mirroring - Monitoring

Product version:

EPiServer CMS 6.0 / R2

Document version:

1.0

Document last saved:

 

The Monitoring Server monitors mirroring jobs. As soon as a Mirroring job is started then the Mirroring Source Server sends an event (MirroringStatusEventArgs) for the state changing of the mirroring job to the monitoring Server. A subscriber can follow mirroring states from start to end.

 

Monitoring State

There are 9 different states of a mirroring job which are as follows:

  • MirroringJobInitialized - sent after a Mirroring job is initialized.
  • MirroringPackageInitialized - sent after a Mirroring package is initialized (info about the package is also send).
  • Transfering - sent during transferring of a mirroring package.
  • Transferred - sent when the mirroring package is transferred.
  • MirroringPackageCompleted - sent when the package has been imported.
  • MirroringJobCompleted - sent when the last package is imported and the entire mirroring job is finished.
  • ExportingError - sent if an error occurs during exporting.
  • TransferingError - sent if an error occurs during transfer.
  • ImportingError - sent if an error occurs during importing.

MirroringStatusEventArgs

The MirroringStatusEventArgs contains a Guid which is the mirroring job id and a MirroringTransferData. The MirroringTransferData contains MirroringInitializeData, MirroringPackageBody, MirroringPackageHeader and MirroringStatus.
The MirroringInitializeData contains Name, DestinationPageGuid, DestinationPath, DestinationRoot, LastExecution, NrOfFilesinPackage, NrOfPagesInPackages and etc.
The MirroringPackageHeader contains FileSize, TargetFilePath, SizeOfSentData, SizeOfReceiveData.
The MirroringStatus contains MirroringState and StatusLog (contains information about Processing, Warning and Error etc). 

Monitoring Mode

There are two monitoring modes, Offline and Online.

Offline Monitoring

The Mirroring Server by default logs all states of a mirroring job as an xml file under “C:\MirroringMonitoringData\”. The filename starts with a unique id and timestamp. In the CTP version this mode is always on, it cannot be configured. The xml file contains a list of MirroringStatusEventArgs.

Online Monitoring

The Monitoring server sends events to subscribers online.

Monitoring Configuration

The Monitoring Server is based on Windows Communication Foundation (WCF) Duplex Communication channel and as with all WCF this can be configured in the config file. By default the Monitoring Server is tightly integrated with the Mirroring Server 2.0 and the installation program configures it by default to use port 80.

Monitoring Server Configuration

By default, the Mirroring installer takes care of the Monitoring Server configuration which is as the blow.

<service 
name="EPiServer.MirroringService.MirroringMonitoringService.
                                 MirroringMonitoringServer"
behaviorConfiguration="DebugServiceBehaviour">
<endpoint 
address="~/SitePath/MirroringMonitoringServer.svc" 
name="" 
binding="wsDualHttpBinding" 
bindingConfiguration=
      "wsDualHttpBinding_MirroringMonitoringBinding"      
contract="EPiServer.MirroringService.MirroringMonitoring.
                       IMirroringMonitoringEventSystem" />
</service>


Monitoring Client Configuration

 <client>
         <endpoint
         name=""
         address="~/SitePath/MirroringMonitoringServer.svc"
         binding="wsDualHttpBinding"
         contract="EPiServer.MirroringService.MirroringMonitoring.
                               IMirroringMonitoringEventSystem" />
</client>

Monitoring utility

A custom subscriber can use the MirroringMonitoringClient helper class. The subscriber can receive events via the MirroringTransferStatusEventHandler. There is also possibility to subscribe on a specific mirroring job via the Subscribe (Guid contextId) method or for all mirroring jobs via the Subscribe () method.

Helper Class Code Example

To make a subscription against the monitoring server, you need only to create an instance of MirroringMonitoringClient endpointName which is defined in app.config.

MirroringMonitoringClient mom = new MirroringMonitoringClient(endPointName); //Client endPointName

To receive Mirroring events or to be notified from the Monitoring Server, the application has to add a handler to the MirroringTransferStatusEventHandler event.

mom.MirroringTransferStatusEventHandler += new MirroringStatusEventHandler(TransferEventCatcher);


Application Example

The Mirroring 2.0 CTP ships with a simple example Monitoring WinForms application which the user can use to view both online and offline logs.