OpsMgr 2007 R2: Script Unit Monitor Comparison Problems!

 

While making my last Management Pack , I discovered a problem in the Operations Console of OpsMgr.

Problem:

 

When i created the Critical/Unhealthy/Healthy Expressions i had to compare to a Integer that was returned by the Script.

The problem was that when i compared 50 with 100, it acted like 50 was more than 100 !!

I was kind of baffled and did not know what was going on.

Solution:

So i exported the Management Pack to XML and took at closer look in the details:

This is a snippet from the XML, it is only one of the 3 expressions, the same has to be done with the  last 2.

As you can see in line 6, 10, 17 and 21, the datatype is configured as ”String”.

This means that the system is doing a string comparison on “50” and “100”, which results in 50 being more than 100.

To fix the problem, I knew i had to change the datatype, but i did not know which was allowed.

i tried to find some help on google, but without luck.

Then i looked into other MPs and figured that “Double” is supported, and this was the one i was hoping to use anyway.

So i changed all the “String” to “Double”

and everything worked as it should!!

For some reason the Operations Console GUI, always use String comparison, but if you export the management pack, edit the XML, and import it again.

Of cause you could use the Authoring Console to make your Management Packs, and it has the possibility to write what type of data it is, instead of using string always.

Good luck with your MPs 😉

By | 2009-10-22T15:11:52+00:00 October 22nd, 2009|Operations Manager (SCOM)|1 Comment

About the Author:

Jakob Gottlieb Svendsen

Twitter: @JakobGSvendsen

Jakob Gottlieb Svendsen is a Microsoft Cloud and Data Center Management MVP (http://mvp.microsoft.com/en-us/default.aspx), Working as Global Lead Developer, Senior Consultant and Trainer at CTGlobal, where he is one of the driving forces in keeping CTGlobal a System Center Gold Partner and member of the System Center Alliance.

Since he started at Coretech in 2007, he has focused on Scripting and Development, primarily developing tools, extensions and scripts for the System Center Suite. His main area is Automation (including OMS/Azure Automation, Service Management Automation, PowerShell and Orchestrator). Another area is Windows Azure Pack / Azure Stack, where he does implementation, development, workshops and presentations. He is a world-wide renowned voice in the Automation field.

He is passionately devoted to the community, to which he contributes by being a moderator at TechNet and sharing his knowledge at https://blog.ctglobalservices.com/jgs

  • Co-founder: PowerShell User Group Denmark
  • Speaker at MMS 2016, Minneapolis (www.mmsmoa.com)
  • SCU Europe 2014, 2015, 2016 (www.systemcenteruniverse.ch)
  • Microsoft TechEd North America 2014, Houston
  • NIC 2012,2013,2014,2015, Oslo (www.nic.com)
  • Microsoft CampusDays 2011, 2013, Copenhagen
  • Microsoft TechDays 2015, Sweden (www.techdays.se)
  • Microsoft Partner Event: New in SC2012 SP1
  • User group meetings (PSUG.DK , SCUG.DK/BE/NO, AZMUG + more)
  • Microsoft Certified Trainer.
  • Microsoft Scripting Guys Forum Moderator

Main working areas:

  • Automation (Azure Automation, SMA, SCO)
  • Windows Azure Pack / Azure Stack
  • System CenterVisual Studio Team Services / Team Foundation Server
  • Development:C#.Net, VB.NET, VBScript, PowerShell, Service Manager, OpsMgr, ConfigMgr
  • Orchestrator
  • Windows Azure Pack / Azure Stack

Training:

  • Azure Automation
  • Service Management Automation
  • System Center Orchestrator
  • PowerShell, VBScript, C#.Net, VB.Net
  • Windows Azure Pack / Azure Stack Development Workshops

One Comment

  1. Vaibhav September 21, 2011 at 15:50 - Reply

    Nice post!

Leave A Comment