How To

This section is designed to provide answers to common questions or scenarios you might have or encounter with MonitorWang. It's split up by functional area and over time I might migrate a section to it's own page. I'll add to this page based on question I field about MonitorWang and my own experience in using it.

General

I have written a custom HealthCheck or other MonitorWang plugin that uses a non .Net dll - I get an error (BadImage) when MonitorWang starts because it is trying to scan this dll for MonitorWang plugins
Add the name of your assembly to an <item> in the TypeDiscoveryConfiguration component config in config\role.castle.config file. This will exclude that dll from being scanned by MonitorWang.

Publishing

I use the Growl Publisher but want to modify the message text and the priority as I don't like the default values.
Use a Growl Notification Finaliser - either the built-in Success Finaliser if you want to modify the Growl Notification properties based on the success/failure of a HealthCheck result or the Count Finaliser if you want to modify the notification based on the ResultCount value. You can also combine these Finalisers although the order they will run is undefined.

Alternatively you can create your own Growl Notification Finaliser. This will allow you inject custom logic to inspect the HealthCheck result and then set any property on the Growl Notification that will be passed to the Growl Api.
  1. Add a reference to MonitorWang.Core.dll
  2. Create a new class and make it inherit from GrowlNotificationInterceptorBase and implement the "Finalise" method. This method has two parameters, the HealthCheck result and the Growl Notification Api object - this will have the message text and priority already set by the Growl HealthCheck Result Pulisher but you can modify these as you see fit.
  3. Add a component configuration to the finaliser.castle.config file...
    1. The "id" attribute needs to be descriptive and unique.
    2. The "type" attribute is the fully class name including the namespace in this format; "full classname, assembly name". So if your custom finaliser is called "CustomFinaliser" in the namespace "MyMonitorWang.Finalisers" within "MyMonitorWang.dll" then the "type" value is "MyMonitorWang.Finalisers.CustomFinaliser, MyMonitorWang"
    3. If you need to provide configuration values to your custom Notification Finaliser then add public properties (getter & setter) then add the corresponding item within the <parameters> section in the component configuration.
    4. The <Check> parameter must be supplied. Use this to associate your Notification Finaliser with a specific HealthCheck (in which case enter the Friendly Id of the HealthCheck, this is found in the check.castle.config file) or use * to associate it with all HealthChecks.

I use the Growl Publisher with Prowl to get HealthCheck results on my iPhone but I only want to receive Prowl/iPhone notifications if my HealthCheck returns a value higher/lower than a specific number - eg: free disk space is too low or there is too many messages in a MSMQ Queue.
When you register your iPhone with Growl to receive notifications you can set a minimum priority level to forward - eg: only forward the notification to your iPhone if the priority is the same or above the level you specify. With this in mind you can use the builtin MonitorWang GrowlCountNotificationFinaliser to set a "Threshold" level (eg: too many messages in an MSMQ Queue) and then set the HigherPriority to "High" (the LowerPriority will default to "Normal"). In Growl - configure your iPhone notifications to only forward if the level is "High (or above)". When you publish to Growl a MSMQ Info HealthCheck result that contains a ResultCount value above or equal to the "Threshold" it will be sent to Growl with priority "High" and "Normal" if it is lower. To configure iPhone notifications when a value goes below the "Threshold" then set the "LowerPriority" to "High" and leave the "HigherPriority" as "Normal" or omit it altogether. Growl itself will receive and display all notifications but your iPhone will only have the notification forwarded to it when the priority is set appropriately by the Finaliser.

Last edited Dec 30, 2010 at 6:32 AM by jimbobdog, version 9

Comments

No comments yet.