Archive | SCOM

Deleting a Distributed Application

If you try to delete a distributed application you may get an error like this.

Application: System Center Operations Manager 2007 R2
Application Version: 6.1.7221.0
Severity: Error
Message:

: Verification failed with [1] errors:
——————————————————-
Error 1:
: Failed to verify View with ID: View_1f1998325fe94ccb97855d7154bfa30c
Target property :ManagementPackElement=Service_ceecc43c88ee428197f7eafbf91236e2 in ManagementPack:[Name=my.managementpack, KeyToken=, Version=1.0.0.0] for this View is incorrect.Cannot find ManagementPackElement [Type=ManagementPackClass, ID=Service_ceecc43c88ee428197f7eafbf91236e2] in ManagementPack [ManagementPack:[Name=my.managmentpack, KeyToken=, Version=1.0.0.0]]
——————————————————-

error

 

The reason for this error is that there is a view that you created in the Monitoring Console to display the distributed application.  You have to delete this view first.  Then you can delete the distributed Application.

Continue Reading

Disabling SQL Express Instance Discoveries

Our SQL Team doesn’t want to manage SQL Express installations. Typically SQL Express is used for Dev/Test and they don’t want to be alerted on these databases.

Turns out there is a nice override to disable discovery of these in the “SQL 200x Database Engines (Windows Server)” discovery.

All you need to do is find the SQL 200x Database Engines (Windows Server) discovery.  Create an override “For all objects of type: Windows Server”

SCOM

Then choose the Parameter Name “Exclude List” and type in “SQLEXPRESS”.

Continue Reading

Writing C# applications to do complex monitoring with SCOM

I ran into an issue where I needed to count the number of xml files in a directory.  The problem was there are 10,000 other files in the directory.  The application team didn’t care about the extra files and didn’t want to clean them out.  All they wanted to know was when the number of XML files was over 15.

First I tried a basic vb script, like this.

 

Set objFSO=CreateObject(“Scripting.FileSystemObject”)

Set oArgs = WScript.Arguments

 

FolderName = oArgs(0)

Set objFolder=objFSO.GetFolder(FolderName)

 

Set Dirfiles = objFolder.Files

 

Int filecount = 0

 

For each file In Dirfiles

 

            sext = objFSO.GetExtensionName(file.Path)

     

If LCase(sext) = “xml” Then

           

            filecount = filecount+1

     

End If     

      Next

           

 WScript.Echo filecount

 

This works fine in a directory with only a few files but my directory has 10,000 other files in it.  I ran this script waited 10 minutes and then canceled it.  Obviously this was not going to work as the script has to touch every file in the directory.  Operations Manager would time out way before the script finishes.

So after many Google and Bing searches looking for a different vb scripts to count only the xml files, I decided to see how easy it would be in C#.

In C# it was a piece of cake.  You can download the C# project file with source here.
https://www.scom2k7.com/downloads/filecount.zip 

 

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.IO;

 

namespace filecount

{

    class Program

    {

        static void Main(string[] args)

        {

 

            string directoryPath = args[0];

            string eXtension = “*.” + args[1];

 

 

            int fileCount = System.IO.Directory.GetFiles(directoryPath,

            eXtension).Length;

 

            Console.WriteLine(fileCount);

 

        }

    }

}

 

I ran the executable that visual studio created with two parameters “directory” and “extension” and it took one second to count the number of xml files in the directory.  This is what I was looking for, way faster and more efficient. 

Commandline

So now I have a working executable the takes two parameters.  How do I get it to work with SCOM? 

The easiest way was to remove the Console.WriteLine(fileCount) and set the count to the exit code. 

 

Environment.Exit(fileCount);

 

Now all I need to do is wrap this executable with a vbscipt and have SCOM call it. You can download the vb script here. https://www.scom2k7.com/downloads/advanced.zip

 

Dim oAPI, oBag, objShell, objFSO, objFile, myCMD, bWaitOnReturn, returnCmd, oArgs

 

Set oAPI = CreateObject(“MOM.ScriptAPI”)

Set oBag = oAPI.CreateTypedPropertyBag(StateDataType)

Set oArgs = WScript.Arguments

 

If oArgs.Count < 3 Then

Call oAPI.LogScriptEvent(“FileCountCSharp.vbs”, 500, 0, “Script aborted. Not enough parameters provided.”)

WScript.Quit -1

End If

 

folder = oArgs(0)

extension = oArgs(1)

userCount = cint(oArgs(2))

 

bWaitOnReturn= True

 

 

Set objShell=CreateObject(“WScript.Shell”)

Set objFSO=CreateObject(“Scripting.FileSystemObject”)

 

 

strPath=“C:\ScomTools\filecount.exe”

 

If objFSO.FileExists(strPath) Then

set objFile=objFSO.GetFile(strPath)

 

 

myCMD = strPath & ” “ & folder & ” “ & extension

returnCmd = objShell.Run (myCMD,0,bWaitOnReturn)

 

Else

 

Call oAPI.LogScriptEvent(“filecount.exe”, 510, 0, “Can’t find EXE to run Script”)

WScript.Quit

 

End If

 

If returnCmd > userCount Then

 

            strReturn = userCount

           

            Call oBag.AddValue(“State”,“BAD”)

            Call oBag.AddValue(“ret”,strReturn)

 

      Else

 

            Call oBag.AddValue(“State”,“GOOD”)

 

End If

 

Call oAPI.Return(oBag)

 

To test it I ran this command cscript c:\temp\newtest.vbs “c:\temp” “xml” 4 saying if there are more than 4 files in the directory and should return BAD state and how many files actual files are in the directory.  This is what I got back.

 

<DataItem type=”System.PropertyBagData” time=”2009-06-17T10:58:59.3066298-04:00″
sourceHealthServiceId=”B3B5A38D-0DBE-5CA9-592D-B76333A989D8″>
<Property Name=”State”VariantType=”8″>BAD</Property>
<Property Name=”ret” VariantType=”3″>5</Property></DataItem>

 

Looks good now to test a good condition.  cscript c:\temp\newtest.vbs “c:\temp” “xml” 25 saying if there is more than 25 xml files create an alert.  There is not  more than 25 files so the scom script should return good.

 

<DataItem type=”System.PropertyBagData” time=”2009-06-17T10:59:34.5256052-04:00″
sourceHealthServiceId=”B3B5A38D-0DBE-5CA9-592D-B76333A989D8″>
<Property Name=”State” VariantType=”8″>GOOD</Property></DataItem>

 

Command2

Ok now we have a good working script and c# executable.  Now we just need to put the script into a monitor and copy the file to the server we want to monitor and we are done.  You can follow these directions if you don’t know how to put the script into a monitor.  https://www.scom2k7.com/create-a-script-based-unit-monitor-in-opsmgr2007-via-the-gui/

So now think of the possibilities.  Anything that can be called from C# can now be monitored in SCOM.  SDKs, APIs, Web Services, are all easily leveraged in C#.    The only downside is you need the executable on the server the monitor is running on, but that could be fixed by having the script to check for the executable and if it wasn’t there you could copy it from a centralized network location.

 

Continue Reading

Windows Server 2008 R2 Service Pack Level at RTM

From http://www.expta.com/2009/06/windows-server-2008-r2-service-pack.html

You may have known that Windows Server 2008 RTM shipped as Service Pack 1. This is because the Windows Server 2008 code base is shared by Windows Vista, and Windows Vista was at SP1 when 2008 shipped. Windows Server 2008 SP2 was released on May 26, 2009 and was the first service pack you can actually apply to Windows Server 2008.

Unlike Windows Server 2003 R2, which was based on the same code base as Windows Server 2003 SP1, Windows Server 2008 R2 is based on an entirely different code base (Windows 7). The Windows 7 code base is derived from Vista, but is actually a seperate kernel. This change in strategy was required to address challenges that 2008 R2 faced, such as hardware platforms with many processor cores and new power saving features that couldn’t be addressed by keeping the same kernel as Server 2008.

For this reason, Windows Server 2008 R2 RTM will ship as service pack level SP0, not SP1.

Good to know as I plan on upgrading all of my SCOM R2 Servers to Windows 2008 R2.

 

Continue Reading

TechNet Webcast: Operations Manager 2007 R2 Deployment and Upgrade Best Practices (Level 300) Recording Posted

* This event was Recorded on Thursday, April 30, 2009. *

http://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?culture=en-US&EventID=1032409727&CountryCode=US

Agenda

– Deployment and Performance Best Practices

– High Availability and Disaster recovery Best Practices

– Virtualization Best Practices

– OpsMgr R2 Deployment and Upgrade

– Deployment Case Studies

Continue Reading

Operations Manager 2007 R2 RTM to be released in 30 days

In the MMS keynote today Bob Kelly, Corporate Vice President, Server & Tools, announced that Operations Manager 2007 R2 RTM will be released in 30 days.

If you are not at MMS like me you can still catch the keynotes streaming online live at https://www1.mms-2009.com/public/Headlines.aspx

Today was

The Dynamic Datacenter
Tuesday, April 28, 8:30am–9:45am PDT (GMT-8)
Bob Kelly, Corporate Vice President, Server & Tools


Tomorrow is

Managing Clients in a User-Centered World
Wednesday, April 29, 8:30am–9:45am PDT (GMT-8)
Brad Anderson, General Manager

You can also attend MMS virtually this year for $350 at

https://microsoft.crgevents.com/MMS-2009/Register/Contact/Default.aspx

which includes

  • Live Webcast of the MMS 2009 Keynotes*
  • Video Recordings of Breakout session topics**
  • Downloadable PowerPoint slide decks from the Breakout sessions
  • Hands-on Lab Manuals
  • Sample files shared by Speakers
  • Access to the MessagePoint system for online discussions with other attendees
  • Copy of the MMS 2009 Post-show DVD set mailed shortly after the event (a $275 value)
  • Copy of the MMS 2009 Hands-on Lab Walkthrough DVD mailed after the event (a $125 value)
  • Access to all MMS 2009 Online content for 3 months after the event closes
Continue Reading

Updated Microsoft SQL Server Management Pack v. 6.0.6569.0 released

An updated Microsoft SQL Server Management Pack has been released sorta.

**UPDATE**

The Management Pack has been updated on the site.

Here are the changes.

  • Fixed performance issues caused by excessive CPU utilization and script timeouts from Windows Management Instrumentation (WMI) queries in the following management pack discoveries: Discover SQL Server 2005 Database Engines (Windows Server), Discover SQL Server 2005 Reporting Services (Windows Server), Discover SQL Server 2005 Analysis Services (Windows Server), Discover SQL Server 2008 Database Engines (Windows Server), Discover SQL Server 2008 Reporting Services (Windows Server), Discover SQL Server 2008 Analysis Services (Windows Server).
  • Fixed an issue where SQL Server 2005 and SQL Server 2008 Analysis Services and Reporting Services discoveries were not reliably discovering these objects on instances of SQL Server that did not have the Database  Engine installed.
  • Removed the hard-coded exception in rules and monitors that prevented the monitoring of the System, Temp, and Master databases.
  • Improved the means by which database discoveries recognize autogrowth enabled settings. Database discoveries now recognize both “KB” and “%” growth settings; previously the database discoveries recognized only the “KB” growth setting.
  • Corrected typographical errors in product knowledge and improved the quality of the text.

After downloading the MP I realized that the file is still the old version  6.0.6460.0.   Hopefully Microsoft will fix this.   I left feedback to mpgfeed@microsoft.com to let them know.

3/31/2009 – Updated version 6.0.6569.0, which provided a number of fixes. Refer to the MP guide for more details.

Continue Reading

SCVMM 2008 R2 Beta – now available for download

The beta software is now available for download on Microsoft Connect. To download, simply go to our site on Connect and sign in with your Live Id.

What is VMM 2008 R2 Beta and what are its new capabilities?

VMM 2008 R2 Beta is a comprehensive management solution for virtualized infrastructure that takes advantage of many of the great new features of Windows Server 2008 R2 Beta including:

* Live Migration: Enables the movement of running virtual machines from one virtual host to another with no downtime.
* Clustered Shared Volumes: Helps enable Live Migration and eliminates the previous one LUN per virtual machine requirement thus simplifying SAN administration.
* Hot addition/removal of storage: Allows the addition and removal of new virtual hard disks (VHDs) and iSCSI pass-through disks running on virtual infrastructure.
* Networking optimizations: two new technologies — Virtual Machine Queue (VMQ) and Chimney – provide increased network throughput while reducing CPU load.

Continue Reading