Search
Joel Hendrickson - Joels Blog
You are here: DevCentral > Weblogs

posted on Friday, November 13, 2009 2:38 PM

Workflows are the fundamental mechanism by which Operations Manager gets things done. Workflows, in essence, are individual pieces of code (modules) that are chained together. For a primer on workflows and modules, I recommend the AuthorMPs site. Workflows remind me of Powershell pipelines or to a lesser extent, linux command piping. Individual commandlets (the equivalent of OpsMgr modules) can be mixed together in different ways to accomplish a more complex task (the equivalent of an OpsMgr workflow) by piping output from one to another. As long as the output from one commandlet can be processed by the next commandlet in the pipeline, you can chain them together.

One big difference between developing pipeline-aware commandlets and developing OpsMgr modules and workflows is the potential for debugging. With Powershell, you can use the full debugging power of Visual Studio (or whatever editor you use) by simply setting breakpoints in your commandlet and attaching to the host running powershell (usually powershell.exe). Workflow debugging is certainly possible but not nearly as easy. There are several reasons for this:

  • If you’re not using custom-made modules, the running code is a black box. If the module does not already have the ability to output tracing information, there is no way to add it.
  • You can’t just run a workflow from a debugger. OpsMgr is complete control of when it starts and ends, so you must do this indirectly.
  • If you are using custom-made modules, you need to find the OpsMgr process that they get loaded into in order to debug them.

One of the most common problems in developing workflows is trying to figure why (or why not) a data item is making it through certain parts of the workflow such as condition detection modules. In order to avoid “trial and error” development, you need some way to debug the workflows. I’ll outline a few options below for troubleshooting this kind of scenario below.

Option 1: Attach a Debugger

If you’ve developed a custom module, you can step through the code by doing the following:

  • Get OpsMgr to start running your workflow. For example if you are debugging a monitor, make sure the monitor is enabled and it’s datasource is receiving data.
  • Open the code in your debugger (Visual Studio in this example)
  • Attach to the OpsMgr process running your workflow. This is the tricky step. The process is MonitoringHost.exe, but there may be several. You want the one that is running managed code (see the Type column in screenshot below) with the credentials of the Operations Manager action account. If it is still not obvious which process to attach to, you’ll have to attach to each one and see if your DLL module is loaded. Use the module window (Ctrl+Alt+U) to list the DLLs once you attach to the process. Once you see your DLL, you’re read to debug!

debug

On a side note, I (or one of our team members) may do a blog post in the future on creating managed code modules.

Option 2: Use the Operations Manager Trace Files

Honestly I would leave this as a last resort, but the trace files can be useful beyond workflow debugging (such as script debugging). See #8 on my top 10 list for instructions and comments on this.

Option 3: Use the F5 Workflow Tracer

Inspired by the workflow tracer that was #6 in my top 10 list, our team has built a debugging module that can be used to trace the output of any module in your workflows. We used the same configuration elements as the workflow tracer and added support for data item batching, robust acknowledgements, and other minor improvements.

The module can be placed after any module in your workflows, and reports on the data item that come out of that module. Here is an example from the F5 Monitoring Log:

Element: F5.PRO.PerformanceMonitorType (note: this tells me which workflow is being traced)
Stage: After COUNTER TYPE detection (note: this tells me which module is being traced)
Target: {4447e45e-9f65-e01d-2c17-24dee61fb1d9}

<?xml version="1.0" encoding="utf-16"?>
<DataItem type="System.Performance.LinkedData" time="2009-11-12T12:32:46Z" sourceHealthServiceId="fa056941-2b22-7d8e-a34d-7604e1347f99">
  <ObjectName>LTM Pool Member</ObjectName>
  <CounterName>Server - Current Connections</CounterName>
  <InstanceName />
  <IsNull>false</IsNull>
  <Value>0</Value>
  <ManagedEntityId>{29c7fc90-0f44-b70c-9f88-5a7ee6d13a40}</ManagedEntityId>
  <RuleId>{0e799c3d-b8d0-bce0-259b-f9025d507996}</RuleId>
</DataItem>

This module can be downloaded here. You’ll need to import the included MP into OpsMgr and place the included DLL in the Operations Manager program files folder. Instructions for installation and configuration are the same as the original workflow tracer, except with our MP and DLL.

Another barrier to debugging OpsMgr becomes apparent if you want to use this module to debug a sealed workflow (one that’s in a sealed MP and is not marked public). There is no way to simply insert a module of your own in such a workflow since you cannot change a sealed MP. The workaround goes like this:

  • Create an override for the workflow that disables it
  • Export the MP that the workflow is in to XML format (use the #1 tool on my top 10 list).
  • Get the XML for the workflow from the exported pack and create a copy of it in your own, new, MP. If the workflow references other elements marked “internal” to the MP, you will have to create copies of those as well.
  • Insert the debugging module wherever you’d like in your new workflow.
  • Import your new pack

Simple as that ! :)

To help understand this process, I’ve created an override pack for our own F5 PRO-Enabled Management Pack that replaces one of our monitors with one that includes the debugging module between each module in the workflow. I realize the pack looks strange as formatted in our wiki – just copy and paste from the <xml> element on down to </ManagementPack>.

Option 4: Use the Operations Manager Workflow Analyzer

I was both elated and saddened by the brand new workflow analyzer included in the new authoring console. Elated because this tool rocks, and saddened because it really would have helped to have it earlier :). This tool does the following things:

  • Shows you all the workflows registered in OpsMgr as well as their state
    • Technical note: Internally this is basically running the “Show Running Rules and Monitors” task that is already available via the UI

screen1 

  • Allows you trace any of the workflows
    • Technical note: Internally this is overriding the TraceEnabled property on the workflow and hooking into OpsMgr’s built in tracing capabilities. I’ve looked for a way to override this property through the UI, and it does not seem possible.

trace2 

  • Allows you do an ‘analysis’ of the workflow. This was not very interesting to me – just shows you some basic properties and running instances.

You can increase the amount of information printed out in the trace if you turn on verbose logging (see Option 2 above).

The main drawback of this tool is that it’s hooking into trace calls made by the OpsMgr modules so you’re not going to get this level of detail if you’re trying to debug a custom-built module. It may be possible to write to the same mechanism, but I have not looked into that yet.

Happy Debugging!

<< Back to Part I



Feedback

2/11/2011 1:30 AM
Gravatar For parent, when in abercrombie et fitch spending budget condition, you can occasionally purchase some branded products and options for kids, but for some branded addicts children, you couldn't do any compromise. you need to allow the youngsters comprehend the loved types situation, if necessary; you can hold the a & f for the working place, to ensure which they are able to possess a uncover that how hard inside the earning. You may allow the youngsters report the loved types fees so they will comprehend the usage level of your home. Even your loved types have an awesome concern of economics, thrift on just about every loved types is quite important. Have you actually believed that possibly the kids' favor of branded h abercrombie fitch like special ed hardy hardy, Levis, or mentor are attributed by parents' unintentional induction. For abercrombie and fitch tiny children, they may possibly have no believed of style or a feeling of . Therefore, getting a parent, you need to create an awesome example to kids.
abercrombie fitch
3/15/2011 11:13 PM
Gravatar new online casinos
I wanted to thank you for this great read!! I definitely enjoying every little bit of it I have you bookmarked to check out new stuff you post
dimpy
3/30/2011 11:49 PM
Gravatar Easy option to get useful information as well as share good stuff with good ideas and concepts
Fantech DBF110
3/31/2011 12:01 AM
Gravatar thanks will not just be sufficient, for the wonderful lucidity in your writing. I will directly grab your rss feed to stay abreast of any updates. Good work and much success in your business dealings!
Distance MBA
3/31/2011 1:31 AM
Gravatar This is easier and surely gives comfort to internet users. Thanks for sharing. Post like this offers great benefit. Thank you!
Apprenticeships
4/1/2011 1:06 AM
Gravatar Some interesting and well researched information on cameras. I'll put a link to this site on my blog. Thank you!
Hyundai Sonata Palm Beach
4/4/2011 1:31 AM
Gravatar I really like following your blog as the articles are so simple to read and follow. Excellent. Please keep up the good work. Thanks.
Chicago Dentist
4/4/2011 5:28 AM
Gravatar I Really enjoyed your blog. I just bookmarked it. I am a regular visitor of your website I will share It with my friends .Thanks.
Burbank Airport Car Rental
4/4/2011 5:51 AM
Gravatar This is a really good read for me. Must admit that you are one of the best bloggers I have ever read. Thanks for posting this informative article.
USED ENGINE
4/25/2011 3:53 AM
Gravatar I wonder how you got so good. This is really a fascinating blog, lots of stuff that I can get into. One thing I just want to say is that your Blog is so perfect!
send mothers day flowers Denmark
5/5/2011 10:24 PM
Gravatar When you share with someone your appreciation and gratitude, they will not forget you. Appreciation will return to you many times
online bingo
5/19/2011 12:31 AM
Gravatar I would like to assure you of my continued sincerity and dedication and I promise to continue to serve the company to the best of my abilities. Thanks
Real Estate
4/25/2011 3:59 AM
Gravatar Really your post is really very good and I appreciate it. It’s hard to sort the good from the bad sometimes, but I think you’ve nailed it. You write very well which is amazing. I really impressed by your post.
send mothers day flowers Ecuador
8/8/2011 9:37 AM
Gravatar Thanks for the awesome post. Looking forward to staying current with your blog. Keep it up with your good work. I will share your blog with my friends. Thanks
dissertation writing service
9/8/2011 7:26 PM
Gravatar As long as the output from one commandlet can be processed by the next commandlet in the pipeline, you can chain them together.
ugg boots sale
9/8/2011 7:59 PM
Gravatar The main drawback of this tool is that it’s hooking into trace calls made by the OpsMgr modules so you’re not going to get this level of detail if you’re trying to debug a custom-built module. It may be possible to write to the same mechanism, but I have not looked into that yet.
ugg boots sale
9/8/2011 8:38 PM
Gravatar This was not very interesting to me – just shows you some basic properties and running instances.
louis vuitton speedy
9/29/2011 12:02 AM
Gravatar It may be possible to write to the same mechanism, but I have not looked into that yet.
need best essay
1/1/2012 11:44 PM
Gravatar Thanks for providing such useful information. I really appreciate your professional approach. I would like to thank you for the efforts you made in writing this post. I am hoping the same best work from you in the future as well.
Stay Connected! Tell us what yo

Let Me Know What You Think


Please use the form below if you have any comments, questions, or suggestions.

Title:
 
Name:
 
Email: (so we can show your gravatar)
Website:
Comment: Allowed tags: blockquote, a, strong, em, p, u, strike, super, sub, code
 
Please add 8 and 5 and type the answer here:

82,243 Members in 102 Countries and Growing!

Join DevCentral Today!

About DevCentral

DevCentral has been a successful, thriving community for many years. We have always strived to bring you the best technical documentation, discussion forums, blogs, media and much more that we can.

So dive in, get familiar with DevCentral. We hope you like it, we hope it makes your job easier, and lets you get that much more power out of the community. To learn more, make sure to check out the Getting Started section. And if you have any problems, or think something could be easier to use, drop us a line to let us know.

Got It !

We've received your comment and transmitted it directly to DevCentral HQ.

Thanks for taking time to let us know what's on your mind. At DevCentral | Community Matters!

Get In Touch With Us

Have questions, suggestions or just want to get something off your chest?

Use our handy form below to Direct Connect with DevCentral Mission Control.

Send Us Feedback       or