One of the great advantages of OpsMgr 2007 against MOM 2005 is that you can easily test OpsMgr 2007 scripts from the command prompt.
Just go to the C:\Program Files\System Center Operations Manager 2007\Health Service State and open a command prompt.
Type DIR /B /S *.vbs and you find all the scripts that are used on that specific agent. And if you have found your script to debug you can easily run it with cscript and see what happens.
But what if a scripts needs some parameters? Most of the time these are GUIDS and how do you find the right parameters?
A colleague of mine Dirk van Coeverden found an easy way to find these parameters.
Let’s Look at the Operational Database Space Free (%) Monitor.
This Monitor uses a vbscript GetOpsMgrDBPercentageFreeSpace.vbs which needs two parameters to work
So if we want to debug this script we need two parameters; DatabaseServerName and DatabaseName.
How do we find those parameters?
First we need to go to the Authoring Pane in the Opsmgr Console and find the monitor which runs this script.
Then we change the default timeout of the script to something smaller then the default with an override. Say 1 second.
Now we have to wait for this monitor to run again and hopefully see that the script timeouts because of the lower timeout settings. And if the script runs longer than the timeout period an event 21402 – Script ran longer than the timeout period will be created.
Now you can debug the script from the commandprompt with the correct parameters. Don’t forget to remove the overrides.
I got a question about Windows Live Writer from Rod Trent and when investigating this question I found that you can easily create blog posts when you are in Internet Explorer.
How? Just go to Tools and click on Blog This in Windows Live Writer. This should also work in IE7.
Source: Secure Vantage Weblog
Secure Vantage has released an update to the ACS Resource Kit for the community.
The ACS Resource Kit now includes a revised version of the ACS Disk Planning Calculator originally posted on System Center Forum, new database utilities for ad-hoc queries and advanced grooming, plus the ACS Visio Stencils previously posted on our blog.
For more information and to download the latest version of the ACS Resource Kit please visit http://www.securevantage.com/Products/ACSResourceKit.aspx
ACS Resource Kit v1.1, Contents
Marco Shaw published a blogpost about and Advanced example using PowerShell and the OpsMgr SDK: Creating and Updating Groups and mentioned an old blog post from me which he could not find anymore.
Here is that blog post from me (without the pictures)
Compiling commandline application for Creating and Updating Groups
Mon, 22/10/2007 - 21:32 — Stefan
Today I saw a question from Marco Shaw in the MyITForum MOM maillist about how to compile the code from Jakub Oleksy where he explains how you can use the OpsMgr SDK to create and update groups in OpsMgr.
In this article is demonstrate how I was able to compile that code to create a commandline tool. Keep in mind I'm not a programmer, just trying to get some knowledge about creating tools using the OpsMgr SDK. If you are looking for real great tools for OpsMgr visit Boris Yanushpolsky website ;-)
Install Compiler First I downloaded Snippet Compiler (why download and install Visual Studio Express if you only need to compile the code?). After the download just unzip the files and you are ready to run the Snippet Compiler.
Install OpsMgr SDK Check if you have installed the OpsMgr SDK. If not you can download the SDK from the Microsoft Connect site on the System Center Operations and Service Management downloads after you registered.
Add OpsMgr SDK references After starting the Snippet Compiler you first have to add the OpsMgr SDK References.
Go to Tools->References and select the Microsoft.EnterpriseManagement.OperationsManager.Common.dll and Microsoft.EnterpriseManagement.OperationsManager.dll from the SDK as refrerence in Snippet Compiler. Click on OK.
Change the code from Jakub Olesky The code Jakub has provided will not work on it's own, but you can use it to create a commandline tool. I changed the code (bold and larger fonts) slightly to create a console app. But you can add more arguments if you want, it's just for the learning.
namespace Jakub_WorkSamples { using System; using Microsoft.EnterpriseManagement; using Microsoft.EnterpriseManagement.Configuration; using Microsoft.EnterpriseManagement.ConnectorFramework; using Microsoft.EnterpriseManagement.Monitoring; internal class Program { private static void Main(string[] args) { Console.WriteLine("CreateGroups - Version 1.0 - Compiled October 22, 2007"); Console.WriteLine("http://weblog.stranger.nl"); if (args.Length < 1) { Console.WriteLine("\n"); Console.WriteLine("Provide name Root Management Server"); Console.WriteLine(@"ex: CreateGroups.exe RMSServer01"); } else { string strRMS = args[0]; Console.WriteLine("Connect to Root Management Server:" + strRMS); // Connect to the sdk service on the local machine ManagementGroup localManagementGroup = new ManagementGroup(strRMS); string formula = @"<MembershipRule> <MonitoringClass>$MPElement[Name=""Windows!Microsoft.Windows.Computer""]$</MonitoringClass> <RelationshipClass>$MPElement[Name=""InstanceGroup!Microsoft.SystemCenter.InstanceGroupContainsEntities""]$</RelationshipClass> </MembershipRule>"; // Create the custom monitoring object group CustomMonitoringObjectGroup allComputersGroup = new CustomMonitoringObjectGroup("Jakub.At.Work.Namespace", "AllComputerGroup", "Jakub@Work Sample All Computers Group", formula); // Get the default management pack. ManagementPack defaultManagementPack = localManagementGroup.GetManagementPacks( "Microsoft.SystemCenter.OperationsManager.DefaultUser")[0]; // Get the management packs for references ManagementPack windowsManagementPack = localManagementGroup. GetManagementPack(SystemManagementPack.Windows); ManagementPack instanceGroupManagementPack = localManagementGroup. GetManagementPack(SystemManagementPack.Group); ManagementPackReferenceCollection newReferences = new ManagementPackReferenceCollection(); newReferences.Add("Windows", windowsManagementPack); newReferences.Add("InstanceGroup", instanceGroupManagementPack); defaultManagementPack.InsertCustomMonitoringObjectGroup(allComputersGroup, newReferences); // Get the class that represents my new group MonitoringClass myNewGroup = localManagementGroup. GetMonitoringClasses("Jakub.At.Work.Namespace.AllComputerGroup")[0]; // Get the discovery rule that populates this group // For the purposes of this sample, I know there is only 1 in the template MonitoringDiscovery groupPopulateDiscovery = myNewGroup. GetMonitoringDiscoveries()[0]; // This is the full configuration of the discovery of which the // membership rule is one part that you can configure and update Console.WriteLine("The discovery configuration: {0}", groupPopulateDiscovery.DataSource.Configuration); // Update the configuration in some fasion string newConfiguration = @"<RuleId>$MPElement$</RuleId> <GroupInstanceId>$MPElement[Name=""Jakub.At.Work.Namespace.AllComputerGroup""]$</GroupInstanceId> <MembershipRules> <MembershipRule> <MonitoringClass>$MPElement[Name=""Windows!Microsoft.Windows.Computer""]$</MonitoringClass> <RelationshipClass>$MPElement[Name=""InstanceGroup!Microsoft.SystemCenter.InstanceGroupContainsEntities""]$</RelationshipClass> <ExcludeList> <MonitoringObjectId>f5E5F15E-3D7D-1839-F4C6-13E36BCD982a</MonitoringObjectId> </ExcludeList> </MembershipRule> </MembershipRules>"; // Now we want to update the group membership for this group groupPopulateDiscovery.Status = ManagementPackElementStatus.PendingUpdate; groupPopulateDiscovery.DataSource.Configuration = newConfiguration; groupPopulateDiscovery.GetManagementPack().AcceptChanges(); } } } }
Copy to code into Snippet Compiler Now you have to copy the code from above to the Snippet Compiler and Select Build Current to file. Give it a nice name (CreateGroups.exe) and save it as Console EXE. Or you can download the code from here and import it in the Snippet Compiler.
Result After you compiled the CreateGroups.exe commandline tool and copied it to the RMS you can run it with the next command: CreateGroups.exe localhost. When the console app is finished a new Group Jakub@Work Sample All Computers Group is created with "Windows Computer" as Members.
Just change the code if you want to change the name of the Group or the formula to populate the group.
Scenario:
The Windows NT Service of a buggy application crashes regularly and is restarted automatically with an Recovery Task.
You only want to receive an Alert if this happens n-times within a specified time.
Steps:
Step 1. Create a Basic Service Monitor which does not generate an Alert
Just create a ‘normal’ Windows Service Monitor.
Step 2. Create a Recovery Task for the Basic Service Monitor in Step 1.
Change working directory to %windir%
Tip: On Windows 2000 servers there isn't being logged that a service is stopped in the System Eventlog. Create another Recovery Task which creates an Eventlog if the service is stopped. You can use the LOGEVENT tool in the Windows 2000 Server Reskit if you want.
Step 3. Create a Windows Event Repeated Event Detection Monitor.
Configure the EventID which shows that a service is being stopped. Or use your own created Windows NT EventID on a Windows 2000 server.
Configure the Repeat Settings for your environment.
Info from the OpsMgr Helpfile.
Enable the monitor with an Override for the correct computers.
Jose Rodas works at Microsoft as a Senior Support Engineer in the System Center Support Team and started to blog and will be focused in Service Management products.
Add his blog to your blogroll if you need more blogs to follow ;-).
Source: Pavleck.Net
Jeremy started an OpsMgr Video Experiment called Ask About OpsMgr and I really like the idea.
“I’ve been reading and hearing all over the place how complicated and difficult Operations Manager is. You’re half-right. It’s immensely complicated when compared to previous editions, and when it’s your first exposure to it. I’m aiming to change all that, and I’m trying it in a new medium - video! So watch the video below (Or if your firewall rules don’t prohibit it, go directly to the YouTube link) and post a video response asking me your question. Any question.
I’ll do my best to answer it with the help of the OpsMgr Army and screencast it all!”
So because I quite new to creating videos I installed my webcam software did some tests and create my first Ask About OpsMgr Video question! Sorry for not being a great actor yet:-)
I’ve already some thoughts about how I would solve my question but maybe there are some other ways to do it.
Merry Xmass and Happy New Year!
Repost ;-) In the Twitter world we use Retweet if you post the tweet of someone else. So why not do it with blogposts ;-) That way you can easy filter on subject.
My colleague Daniele Muscetta has posted an great article about using PowerShell to Check for updates in OpsMgr 2007 R2. I wish had found out how to do this, but you can learn a lot from this article.
Remember that this is just SAMPLE code, it is not meant to be used in production environment and it is worth mentioning again that OpsMgr2007 R2 this is BETA software at the time of writing, therefore this functionality (and its implementation) might change at any time, and the script will break. Also, at present, the MP Catalog web service still returns slightly older MP versions and it is not yet kept in sync and updated with MP Releases, but it will be ready and with complete/updated content by the time R2 gets released.
I saw a question of SQLBatman about Operations Manager Authoring.
Here my attempt to answer those questions.
Q: Referenced MP could not be found
A: Search on your (Root) Management Server for *.mp files and copy all these files to one directory, like c:\Mps. If your Authoring Console is on another machine then your (Root) Management Server copy these files to this machine.
Add this directory to the References in Options
Q: Create a custom attribute to the SQL DB Engine
A: I only found that there are only two WMI Providers for Microsoft SQL Server 2005: WMI Provider for Configuration Management and WMI Provider for Server Events. Source: Microsoft Windows PowerShell and SQL Server 2005 WMI Providers – Part 1 and Microsoft Windows PowerShell and SQL Server 2005 WMI Providers - Part 2
I’ve to look for more info about this question, but I at the moment I don’t have much time. But I’ll try to look into this soon.
Source: Microsoft Download Center
Version: 1.7
Date Published: 12/19/2008
Language: English
Download Size: 221 KB - 5.4 MB*
*Download size depends on selected download components.
This download contains the following documentation for System Center Operations Manager 2007: