Skip to content

PetersonDave/Andover

Repository files navigation

Andover

Andover is a .NET framework for monitoring and examining Sitecore implementations against documented best practices.

Andover consists of Categories from which statistics are gathered and summarized. Categories contain one or more components, each mapping to a measurable configuration setting within Sitecore.

How To Use

Follow the steps below to integrate into a Sitecore installation:
  1. Install NuGet Package: https://www.nuget.org/packages/Andover/
  2. Modify any config settings specific to your Sitecore install withi App_Config\Include\Andover.config
  3. Browse \tools\analysis.aspx

Architecture

Solution Structure

Andover consists of the following projects:

  • Andover.Controller - Ties everything together through references to both Andover.Domain and Andover.Data.
  • Andover.Domain - Rules from which analysis is conducted.
  • Andover.Data - Data providers used by Andover.Domain to run analysis against.

Project Structure

Andover Architecture

Andover.Controller

Andover.Controller is the glue for the solution. Its main responsibilities are:

  • Gathers settings from the main Analyzer page and distributes across projects.
  • Instantiates Providers and injects them into Components within Andover.Domain.
  • Categories are instantiated and linked to Components, also within Andover.Domain

Andover.Domain: Isolating Dependencies

Andover.Domain contains all the rules from which analysis is conducted. The Domain Model design pattern is used here to eliminate any and all dependencies. Looking at the project references, notice how it's lightweight for library dependencies:

Andover.Domain Dependencies

Interfaces provide shells to code against, while at run time, Andover.Controller injects dependencies into the framework. Looking at the overall solution structure, notice how dependencies exist for all projects except for Andover.Domain (highlighted in yellow):

Andover Dependencies

How to Contribute

The example below outlines how to add a component, component result, and data provider.

Step 1: Create a Provider

In Andover.Domain, Create an interface for your provider

namespace Andover.Domain.Components.Cache.Provider
{
	public interface ICacheProvider
	{
		// Returns data analysis results
		IEnumerable<CacheDelta> GetAllSitecoreCaches(int deltaThresholdPercentage);
	}
}

In Andover.Data, create your provider, implementing your interface above and deriving from ProviderBase. Your class will resemble the following:

namespace Andover.Data.Cache.Provider
{
    public class CacheProvider : ProviderBase, ICacheProvider
    {
        public override void DisposeProvider()
        {
            // dispose provider logic
        }

        public IEnumerable<CacheDelta> GetAllSitecoreCaches(int deltaThresholdPercentage)
        {
            // pull source of component analysis here
        }
    }
}

Step 2: Create a Component

Create your component class, implementing IComponent and deriving from ComponentBase.

namespace Andover.Domain.Components.Cache
{
    public class CacheComponent : ComponentBase, IComponent
    {
        private ICacheProvider _provider;

        public CacheComponent(ICacheProvider provider)
        {
            _provider = provider;
        }

        public override IEnumerable<IComponentResult> Analyze()
        {
            // perform analysis on data in provider
        }

        public bool IsCompliant
        {
            get
            {
                // logic to determine if component is compliant
            }
        }
    }
}

Step 3: Create Component Result

Create your results, deriving from ComponentResultBase. Providing both member attributes ComponentResultName and ComponentResultDescription ensures results are properly labeled within the report.

namespace Andover.Domain.Components.Cache.Results
{
	public class CacheDelta : ComponentResultBase
	{
		[ComponentResultName("Size"),
		ComponentResultDescription("Cache delta size")]
		public long Size { get; set; }

		[ComponentResultName("Maximum Size"),
		ComponentResultDescription("Maximum size of cache delta")]
		public long MaxSize { get; set; }

		[ComponentResultName("Remaining Space"),
		ComponentResultDescription("Remaining space before reaching threshold")]
		public long RemainingSpace { get; set; }

		[ComponentResultName("Beyond Threshold"),
		 ComponentResultDescription("Determines if cache delta is beyond threshold")]
		public bool IsDeltaPastThreshold { get; set; }

        [ComponentResultName("Cache Name"),
         ComponentResultDescription("Cache Setting Name")]
	    public string CacheName { get; set; }
	}
}

Step 4: Create Configuration Settings

Update Andover.Config within Andover.Domain for any settings required:

<category name="Cache Settings" description="Cache setting analysis" >
	<components>
		<component type="Andover.Domain.Components.Cache.CacheDeltasComponent" name="Cache Deltas" description="Cache delta analysis" />
	</components>
</category>

Step 5: Wire Up The Provider

In Andover.Controller, update ProviderModule.cs to bind and map your new provider

namespace Andover.Controller
{
	public class ProviderModule : NinjectModule
	{
		// append provider wire-up here
		public override void Load()
		{
			Bind<ICacheProvider>()
				.To<CacheProvider>();
		
		...

When complete, your folder structure should match the following:

Andover Architecture

Example Compliance Report Output

Andover Architecture

Sitecore Settings To Monitor

  • Sitecore cache thresholds & deltas
  • Sitecore logs
    • Application start-up frequency
      • Soft crashes
      • Hard crashes
    • Application Error counts
    • Long running requests frequency
  • Configuration settings
  • Content tree structure
    • Number of versions per item
    • Number of items per parent
  • Sitecore database health
    • Artifacts Cleanup
      • History table
      • PublishQueue table
      • EventQueue table
    • Database index fragmentation
    • Database consistency errors
  • Sitecore DMS configuration
    • Database index fragmentation
    • Robot traffic
    • Max Queue Size

Terminology

  • Andover - Reporting and analysis of Sitecore vital statistics.
  • Category - Collection of common Sitecore settings or components.
  • Component - A single Sitecore setting to monitor.
  • Andover Compliance Score - Best Practice Compliance Score.

About

Sitecore Health Monitor and Best Practice Configuration Compliance Score Generator

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published