Thursday, May 06, 2010

Adding SCOM Class Properties to the DGML

Updated transform for SCOM/OpsMgr management pack diagramming with DGML. This time I added in the SCOM class attributes as properties on DGML nodes – perhaps I should’ve used categories?? The legend in the visual studio viewer then lets you highlight parts of the class model based upon properties.

scr1

Next thing would be to include attributes about relationships as properties on the links. Also, what about referencing other system center management packs?

<?xmlversion="1.0" encoding="utf-8"?>
<
xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://schemas.microsoft.com/vs/2009/dgml" version="1.0">
    <
xsl:outputmethod="xml" indent="yes"/>
    <
xsl:templatematch="/">
        <
DirectedGraph>
            <
Nodes>
                <
xsl:apply-templatesselect="ManagementPack/TypeDefinitions/EntityTypes/ClassTypes/ClassType" />
            </
Nodes>
            <
Links>
                <
xsl:apply-templatesselect="ManagementPack/TypeDefinitions/EntityTypes/RelationshipTypes/RelationshipType" />
            </
Links>
            <
Categories>
            </
Categories>
            <
Properties>
                <
PropertyId="Accessibility" Label="Accessibility" Description="Accessibility" DataType="System.String" />
                <
PropertyId="Abstract" Label="Abstract" Description="Whether this is an abstract class" DataType="System.Boolean" />
                <
PropertyId="Base" Label="Base" Description="Whether this is a base class" DataType="System.String"/>
                <
PropertyId="Hosted" Label="Hosted" Description="Whether this is hosted" DataType="System.Boolean"/>
                <
PropertyId="Singleton" Label="Singleton" Description="Whether this is singleton" DataType="System.Boolean"/>
            </
Properties>
        </
DirectedGraph>
    </
xsl:template>
    <
xsl:templatematch="ManagementPack/TypeDefinitions/EntityTypes/ClassTypes/ClassType">
        <
xsl:elementname="Node">
            <
xsl:attributename="Id">
                <
xsl:value-ofselect="@ID"/>
            </
xsl:attribute>
            <
xsl:attributename="Accessibility">
                <
xsl:value-ofselect="@Accessibility"/>
            </
xsl:attribute>
            <
xsl:attributename="Abstract">
                <
xsl:value-ofselect="@Abstract"/>
            </
xsl:attribute>
            <
xsl:attributename="Base">
                <
xsl:value-ofselect="@Base"/>
            </
xsl:attribute>
            <
xsl:attributename="Hosted">
                <
xsl:value-ofselect="@Hosted"/>
            </
xsl:attribute>
            <
xsl:attributename="Singleton">
                <
xsl:value-ofselect="@Singleton"/>
            </
xsl:attribute>
        </
xsl:element>
    </
xsl:template>

    <
xsl:templatematch="ManagementPack/TypeDefinitions/EntityTypes/RelationshipTypes/RelationshipType">
        <
Link>
            <
xsl:attributename="Source">
                <
xsl:value-ofselect="Source"/>
            </
xsl:attribute>
            <
xsl:attributename="Target">
                <
xsl:value-ofselect="Target"/>
            </
xsl:attribute>
        </
Link>
    </
xsl:template>
</
xsl:stylesheet>

Monday, May 03, 2010

WMI Web Site Discovery with System Center Operations Manager

Learning how to perform a discovery with WMI under SCOM/OpsMgr isn’t easy – documentation is appalling and there’s few examples on the net. Here’s my, eventually, successful attempt with some lessons learned along the way.

First off a quick description of the original problem – I want to discover multiple instances of web services running on servers.

After much, much time spent building a single server SCOM/OpsMgr development environment (just exactly what do people call this product anyway?) and figuring my way tentatively through SCOM and the SCOM Authoring Console I defined a class based on Microsoft.Windows.LocalApplication. If you ever have any issues with this stuff a good place to go is the Operations Manager Authoring discussion board – one of my questions and the helpful response from Elizabeth 1978 is here.

clip_image002[17]

Then I created a discovery based upon a wmi query against the root\webadministration namespace to retrieve a list of sites. (Try it out in Powershell first: get-wmiobject –query “select * from site” –namespace root\webadministration.)

 clip_image002[19]

 

Now try to simulate this (learning to use the simulate tool as an experiment in itself – remember to load the MP into SCOM then click the arrow heads to attach to your development RMS so expressions can be resolved)… and it doesn’t work.

clip_image002[21]

clip_image002[23]

clip_image002[29]

Strange. Then by trial and error I find that the asterisk doesn’t allow SCOM to pick up the data element for the name from the WMI query. Basically it seems to need you to identify each value you want returned in the WMI query to be sure you can map it in the Authoring Console mapper screen.

So this works:

clip_image002[25]

You can check by running a simulation.

clip_image002[27]

And to be doubly sure I imported the management pack into the SCOM environment with a monitor that targeted the class and checked when the ASP.NET Apps v4.0.30319 Requests/Sec counter was in excess of 10 requests/second.

As a web service I used a wcf service – just a simple hello world affair (in F# – why is there no template in visual studio??) and executed from a powershell console.

1..1000 | foreach-object {(new-object system.net.webclient).downloadstring(“http://localhost/service.svc”) }

Thursday, April 22, 2010

“Ah Ha” Moment

So if I can convert a system definition model from OpsMgr/SCOM to directed graph markup language… then presumably I could use VS2010 to create my architecture model and then generate the framework for my OpsMgr/SCOM management pack!

Update... it seems to me that none fo the vs2010 model types make sense with scom. Guess that it might be better waiting till the system center team publish a modelling tool.

Wednesday, April 21, 2010

SCOM Class Hierarchy to Directed Graph Markup

As part of a struggle to get to grips with management pack authoring for Systems Center Operations Manager I wanted a way to diagram the relationships between classes. You can do it with the OpsMgr Authoring kit and Visio… but I don’t have it on my machine. However, with the management pack being xml, it seemed a simple job to transform to directed graph markup language to view inside Visual Studio 2010. Here’s a sample xsl transform.

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
<DirectedGraph xmlns="http://schemas.microsoft.com/vs/2009/dgml">
<Nodes>
</Nodes>
<Links>
<xsl:for-each select="ManagementPack/TypeDefinitions/EntityTypes/RelationshipTypes/RelationshipType">
<Link>
<xsl:attribute name="Source"><xsl:value-of select="Source"/></xsl:attribute>
<xsl:attribute name="Target"><xsl:value-of select="Target"/></xsl:attribute>
</Link>
</xsl:for-each>
</Links>
<Categories>
</Categories>
</DirectedGraph>
</xsl:template>
</xsl:stylesheet>




This seems to work with the sample management pack created on Brian Wren’s blog for an article about embedded Powershell scripts. Using the transform and either the Altova xslt1 processor or the native transform in VS2010 I got a dgml file that displays like this.



image

Monday, January 18, 2010

PowerShell Data Munging

There’s a data munging exercise on Rosetta Code which was missing a PowerShell solution. Since I spend a lot of time importing data to graph and present in my day job – often using PowerShell, I thought I’d add a couple of PowerShell options for the import of the data in the Data Munging 2 problem.

First just using iteration alone to look up good values.

$dateHash = @{}
$goodLineCount = 0
get-content c:\temp\readings.txt
ForEach-Object {
$line = $_.split(" `t",2)
if ($dateHash.containskey($line[0])) {
$line[0] + " is duplicated"
} else {
$dateHash.add($line[0], $line[1])
}
# split up the 24 instrument values and count the total number of entries with flag >=1
$readings = $line[1].split()
$goodLine = $true
if ($readings.count -ne 48) { $goodLine = $false; "incorrect line length : $line[0]" }
for ($i=0; $i -lt $readings.count; $i++) {
if ($i % 2 -ne 0) {
if ([int]$readings[$i] -lt 1) {
$goodLine = $false
}
}
}
if ($goodLine) { $goodLineCount++ }
}
$goodLineCount




And secondly taking advantage of the regular expression syntax.



$dateHash = @{}
$goodLineCount = 0
ForEach ($rawLine in ( get-content c:\temp\readings.txt) ){
$line = $rawLine.split(" `t",2)
if ($dateHash.containskey($line[0])) {
$line[0] + " is duplicated"
} else {
$dateHash.add($line[0], $line[1])
}
$readings = [regex]::matches($line[1],"\d+\.\d+\s-?\d")
if ($readings.count -ne 24) { "incorrect number of readings for date " + $line[0] }
$goodLine = $true
foreach ($flagMatch in [regex]::matches($line[1],"\d\.\d*\s(?<flag>-?\d)")) {
if ([int][string]$flagMatch.groups["flag"].value -lt 1) {
$goodLine = $false
}
}
if ($goodLine) { $goodLineCount++}
}
[string]$goodLineCount + " good lines"




The F# solution on the site includes use of seq.forall – I thought maybe this would be useful to implement for the PowerShell solution as well – but I couldn't figure it out. Fortunately the good folks at stackoverflow helped out on that...

Wednesday, November 04, 2009

Connecting to SCOM from the Powershell ISE

Temporary interlude, figuring out how to get some numbers from our IT environment to create some models for complexity in our technology environment. I thought System Center Operations Manager should be useful here but running powershell from the SCOM shell isn't that clever. It'd be much nicer in a decent editor... but how? I couldn't find this anywhere else on the net... so here's how I managed to get SCOM (R2) accessible from the Powershell ISE...

import-module "C:\Program Files\System Center Operations Manager 2007\Microsoft.EnterpriseManagement.OperationsManager.ClientShell.dll"

&"C:\Program Files\System Center Operations Manager 2007\Microsoft.EnterpriseManagement.OperationsManager.ClientShell.Functions.ps1"

Start-OperationsManagerClientShell -ManagementServerName: somemachinename -PersistConnection: $true -Interactive: $True

Wednesday, March 18, 2009

S&G Night Heron – Fibreglassing the Outside

Quick notes from here on as the exterior was considerably easier than the interior.

I bias cut the fibrglass for the exterior to get it to drape better. The epoxy application was much simpler than inside although I did find a few areas that ended up a bit on the dry side. Main reason for this was I ended up working into the evenings and the lighting was awful. This also resulted in a couple of unnecessary floating bubbles and drips – but all easily fixed. So much easier after having done the interior first.

One tip (I think) was to fibreglass across the sheer line; that is, when I fibreglassed the deck, I went to about an inch beyond the deck-hull join, and likewise when I fibreglassed the hull, so that the join between deck and hull was secured with interior tape and a doubling of the exterior glass.

I doubled the glass on the exterior hull from the sheer line to the keel so that under my body I ended up with 4 layers of 200g (6oz) fibreglass.

Having read about the difficulties of making a lightweight boat I spent a lot of time checking the weight as I progressed. One very useful thing here (especially to avoid wastage) was a cheap digital scale. I bought this from a supermarket for $16 and used it to successfully mix epoxy down to 1g hardener and 5g epoxy. I recorded the weight of each batch of epoxy and I weighed the boat after each major application so I could clearly see the increase from 12kg prior to exterior glassing to 19kg after the fill coats were complete.

I found the fill coats a little painful. I seemed to never quite get the right amount on. I’d put a coat on, sand some off, then try again; many times over. What was particularly irritating here was that to avoid excessive exposure to the epoxy while curing I would make myself wait a few days before any sanding. The time just seemed to drag!

If I was doing it again I’d make two changes.

Firstly, I’d use a slow hardener and warm epoxy/conditions. I found that on a few of my (autumn) evenings the temperature had dropped to maybe 15C and the epoxy had thickened and would spread easily. You want it to spread really easily so a really hot day with a slow hardener would be a better combination.

Secondly, I’d use a random orbital sander more extensively. I spent far too much time continuing on with hand sanding when I should have just used the ROS. The pads clog up quick but crikey it does a hell of a job!

S&G Night Heron – Varnishing and Outfitting

I was initially unsure what to use for the final coat: varnish or polyurethane. The documentation on the net seemed a little confusing. In the end I’ve gone with a varnish from Altex. Not sure if this was the best choice, I suspect it’s more expensive than the equivalent products I could have just bought at Mitre 10 or Placemakers. Nevermind.

The can said 6 to 10 coats. I think I’ve run up 7 on the top and 6 on the bottom. Hard to remember!

I used the ROS with 180 grit pads and this seems to produce a good surface. I’ve still got a fair 250mls left so I’ll put that on sometime in winter.

I enjoyed this part much more than the epoxy. No special safety gear required and it could be done at an enjoyable pace.

I put the kayak in the garage – there was some dust but it pails into insignificance when viewed from a few feet. Runs were definitely a problem. Sponge applicators helped but invariably I’d come back the next day and find a few runs that had formed.

For the outfitting I’ve kept to a bare minimum, at least for the moment. I used window weather stripping for the hatches – seems a bit leaky but I’m sure I’ll be able to tune it better.

I used plastic foot pegs; very light but they also seem a bit flimsy. In retrospect I’d go aluminium.

The back rest provided in the Night Heron plans seems quite effective without any padding. In fact, I spent $80 on closed cell foam and so far haven’t put any in yet, but it doesn’t seem to be especially uncomfortable so I’m in no great rush to finish it.

For the spray deck I ended up, after a few false starts, with getting one made by someone (Gabi) in Nelson. You can get hold of them on TradeMe and I’d recommend the product. Other options include Rasdex and BackOfBeyond.

And the final result? Well, here I am on the inaugural launch in the Waikanae River at the Otaihanga domain. Beautiful spot; you can head out at high tide down the 2kms to the river mouth, play in the sea, then come back with the salt water washed off in the river.DSC03342

 

In the end I guess I spent 10 hours / week from the middle of November 2008 until the first week of March this year. So that’s about 160 hours. The cost is approximately $1000. It’s easy to spend more if you don’t hunt around for good prices on ply, fibreglass, epoxy and varnish.

And performance? Well, I’m very familiar with the plastic sea kayaks that you can hire. My Night Heron is faster, feels more manoeuvrable (and it doesn’t have a rudder) and it’s much lighter. So all in all – I LOVE IT!

Friday, February 27, 2009

Functionally complete kayak

Second to last day of February and a quick note to remind me in the future: kayak is functionally complete. No photograph, camera batteries are flat, but the rubber seals are on hatch rims, the foot pegs are in, the back rest is in. That makes it about 15 weeks from when I started in mid november. Phew. One thing left to do - varnish, maybe wait a couple of weeks to be sure the epoxy has set. Weather this weekend looks shocking. Maybe Sunday to try on the sea? Write some more detail on the last steps of the build after that. For those interested, final weight about 19kgs. Hard to tell, scales difficult to read, maybe 18.5. That's with 6oz everywhere, 2 layers on the bottom and 2 layers most of the inside hull.

Monday, February 02, 2009

S&G Night Heron – Attaching the Deck to the Hull

I found I couldn’t do this with just tape. The hull and deck needed more force to get the positioning of them together so I ended up wiring them together. This was the second time I did this. I did it first time round when wiring together the deck on top of the hull. I probably should’ve put more effort in then with the stern and it would’ve made life easier for me now.

The stern of the Night Heron has to be squashed together with some force. I’m not the only one that seems to have to do this. In the pictures supplied with Nick’s instructions you can see he has it happen to him and I’ve seen pictures from another builder with the same problem:

http://outdoors.webshots.com/photo/1165926632056308877loLvMK – this builder’s comments mirrored my experience exactly

The bow was easy. The last two feet of the stern were stubborn and took a bit of technique. There I used a paint spatula to force out the hull and then pressed hard and fast on the deck to squish the two beveled edges together for taping. One side of the stern just didnt want to play nice...

Maybe an extra form or two would be useful when creating the stern of the boat?

To help with getting the stern to fit I ended up putting in extra stitches along the rear of the boat. Getting them in at the back is easy as long you use long wires and get them through both holes while the deck and hull are still some distance apart. Then, only after all wires are in do you push the deck down onto the hull and tighten the wires.

Attaching deck and hull. The stern was difficult. You seem to need to press down hard to get the hull to expand out and meet the deck on the edges. Finally finished with those wires (except for the stern and bow - I'm going to pack glue and chopped fibreglass in there then tighten up).

I then glued up between the stitches – wish I’d done a cleaner job as I’m still sanding the rough bits up - and then waited a few days to be sure the two pieces wouldn’t crack or pop apart at any point.

With the stitches gone I then put the kayak up on it’s side and taped the inside seam. Notice I cut the hatches before attaching the deck. This made the taping quite easy.

DSC03268

I taped up to maybe 50cms from each end but in retrospect I could have gone further. The secret seemed to be lots of light!

Here’s one bit that went a bit wobbly:)

Oh, I can see it wobbling off to the side there...

(Notice all the sanding dust still left inside!)

 

And then I just had to put it into the pool and proved it worked!

 It floats! (Just taped internal seams and thought it deserved to see water...)

S&G Night Heron – Extra Cockpit Glass

Since I did such a terrible job of glassing the inside of the hull on my first attempt I decided to put a second, large piece of glass on the inside of the boat.

I guess I covered maybe 40% of the inside of the hull with a second layer of 200g glass (equivalent to 6oz), so it should be very strong!

An oversize cockpit area sheet of extra 200g (6oz) fibreglass in the hull. I did this because my first hull fibreglassing left a lot to be desired.

Here’s the finished product. Much better! This time I took extra care to wipe off excess epoxy during the initial curing process and I used a tape edge to stop the frayed glass fibres sticking. 

Much nicer!

S&G Night Heron – Grab Loops

Rather than a big end pour I’ve gone with a couple of small plastic tubes (from old felt pens). I drilled the holes using the stitching holes in the hull as a guide for positioning them on each side of the hull.

To glue them into place I used the chopped up glass, epoxy mix. I wish I’d discovered this earlier. It looks very useful.

I should've discovered this stuff earlier. It would've made a much better way of fibreglassing round the pvc tube Maroske fitting. It's chopped up fibres with a cotton microfibre adhesive additive.

 

Notice the digital scales in the picture. I bought these from a supermarket for $16. They’ve been extremely useful in ensuring I get the epoxy mix right. I use small mixes of typically 36g, 48g, or 60g total weight (the mix ratio for Nuplex R180 is 1:5…).

 Gluing in the loop holders (old marker pens).

S&G Night Heron – Deck Line Fittings

For these I used the Maroske style fitting. I used the instructions on Bjorn Thomasson’s site but in retrospect would do things a little differently.

The first couple that I did I left the pvc tubes in place for more than 24 hours and had a tough time pulling the tube out. In the end I found a hair dryer would blow in hot air and soften the tube sufficiently they came out. For the rest I found if I just pulled the tube out within 12 hours I was fine.

If I was doing it again I’d put a few larger pieces under the pvc loop then cover the pvc with epoxy mixed with lots of chopped up fibreglass then place a couple of larger pieces of glass over the top. I’m sure it would make a smaller, better fitting.

Inside view of one of the Maroske style fittings.

S&G Night Heron – Hip Plates

These were quite easy to position prior to gluing with a few lengths of masking tape.

Positioning both cheek plates.

I glued them into position with a microfibre additive then created a thick fillet and applied fibreglass up each side then a couple more shorter fibreglass pieces to strengthen the joint on the inside (where I’ll never be able to reach again once the deck is attached to the hull).

S&G Night Heron Build Notes – Fibreglassing The Coaming

Quick post. This wasn’t especially easy. Two layers of bias cut cloth. Putting them on wasn’t hard until it came time to push the cloth under the deck. You have to cut darts and fold the cloth under but it’s a tight corner and fibreglass doesn’t like tight corners. If I was doing this again I’d make a rounder corner to fold under. Unfortunately this is neigh on impossible with the thigh braces as you’ve only got the thickness of the ply to work with. Also, I flipped the deck upside down and the glass on the top of the coaming wanted to come off. Maybe I should have waited for the epoxy to gel before turning the deck upside down?

DSC03213