<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Operating-Quadrant</title>
	<atom:link href="http://operatingquadrant.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://operatingquadrant.com</link>
	<description>Living in the I.T. Operating Quadrant. Useful articles on real world solutions involving Monitoring (System Center Operations Manager), Virtualization, Reporting, Scripting (PowerShell), and much more.</description>
	<lastBuildDate>Thu, 02 Feb 2012 16:43:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='operatingquadrant.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Operating-Quadrant</title>
		<link>http://operatingquadrant.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://operatingquadrant.com/osd.xml" title="Operating-Quadrant" />
	<atom:link rel='hub' href='http://operatingquadrant.com/?pushpress=hub'/>
		<item>
		<title>OpsMgr 2012 UNIX/Linux Authoring Templates:  More Information on the Shell Command Templates</title>
		<link>http://operatingquadrant.com/2012/02/01/opsmgr-2012-unixlinux-authoring-templates-more-information-on-the-shell-command-templates/</link>
		<comments>http://operatingquadrant.com/2012/02/01/opsmgr-2012-unixlinux-authoring-templates-more-information-on-the-shell-command-templates/#comments</comments>
		<pubDate>Wed, 01 Feb 2012 20:22:08 +0000</pubDate>
		<dc:creator>Kristopher Bash</dc:creator>
				<category><![CDATA[Management Packs]]></category>
		<category><![CDATA[System Center Operations Manager]]></category>
		<category><![CDATA[UNIX/LInux]]></category>

		<guid isPermaLink="false">http://operatingquadrant.com/?p=746</guid>
		<description><![CDATA[In my last post, I described the new UNIX/Linux Shell Command templates in OpsMgr 2012, and provided a walkthrough on creating a Management Pack for monitoring BIND DNS servers on Linux. In this post, I will provide more detail on the nuts and bolts of the Shell Command templates, as well as a list of [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=operatingquadrant.com&amp;blog=8969466&amp;post=746&amp;subd=operatingquadrant&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In my last post, I described the new UNIX/Linux Shell Command templates in OpsMgr 2012, and provided a walkthrough on creating a Management Pack for monitoring BIND DNS servers on Linux. In this post, I will provide more detail on the nuts and bolts of the Shell Command templates, as well as a list of tips &amp; tricks to consider when using the templates.</p>
<h3><strong>Using the Shell Command Templates</strong></h3>
<p><span id="more-746"></span></p>
<ul>
<li><strong>Targeting:</strong>  The only acceptable targets for the UNIX/Linux Shell Command templates are UNIX/Linux Computer, or classes based on it.  So <em>UNIX/Linux Computer</em>, <em>Linux Computer,</em> <em>Red Hat Enterprise Linux Computer</em>, and <em>Red Hat Enterprise Linux 5 Computer</em> (for example) are all valid targets. <em>Operating System</em>, <em>Logical Disk</em>, <em>Local Application,</em> and <em>Computer Role</em> types are not valid targets.  Best practice for rules and monitors is to target the computer object but disable the rule/monitor by default, and use an override to enable it for a group. The Shell Command templates do not support object discovery. If you want to discover and target custom class types (like a UNIX/Linux Computer Role or Local Application), traditional MP Authoring (XML) can be used.<strong></strong></li>
<li><strong>Shell Command Input</strong>:  As the templates use the ExecuteShellCommand method of the agent’s script provider with a WSMan Invoke module, the command is sent to the agent on each execution. This requires that the shell command is a single line. Simple shell scripts can be condensed into a “one-liner” by replacing line breaks with semi-colons. If you want to use a complex or long script, the best approach is to distribute it as a shell script to a common path on monitored agents, then use the shell command templates to invoke the script by providing the path, such as:  <em>/opt/scripts/myscript.sh</em><strong></strong></li>
<li><strong>Synchronous Execution &amp; Command Performance:  </strong>The agent’s script provider executes scripts synchronously. For optimal server and agent performance and monitor reliability, it is important to make sure that shell commands execute quickly. If you want to use a long-running command or script in a monitor or rule, it is advisable to configure the script to execute periodically on the agent (e.g. with cron) outputting to a file, and then use the shell command monitor or rule to parse the output file. Unless all parameters for the rule or monitor (e.g. scheduler, shell command, timeout, etc) are identical, rules and monitors created by the Shell Command templates will not cookdown.</li>
<li><strong>Handling Complex Output: </strong> The agent’s script provider returns StdOut, StdErr, and ReturnCode for the shell command execution. Using the templates, it is not possible to post-process this output to split the output into multiple data items, so it is best to consider StdOut from the shell command as representative of one value.  You can always call the same shell command and use the pipeline to parse with <em>grep</em>, <em>awk</em>, <em>sed</em>, etc to filter the output to a single output value. If your shell command returns structured data representing multiple data points, you still have the option of authoring outside of the Operations Console and using a PowerShell script to parse the output.<strong></strong></li>
<li><strong>Mind the Quotes and Special Characters: </strong> The agent’s script provider executes the shell command using the default shell (for the user context of the specified Run as Account), and wraps the actual command in quotes.  So the command executed on the agent host will be something like: <em>sh –c “my shell command”</em> or <em>bash –c</em> “my shell command.” This means that double-quotes inside the shell command need special handling. If you can’t use single-quotes instead of double-quotes, escape the double-quotes with a backslash. As Management Packs are XML-based, some characters like &lt; and /&gt; can be problematic. It is not possible to embed CDATA blocks in the template wizards, so if you can’t avoid use of &lt; and /&gt; in the command and they prove to be problematic, it is advisable to distribute the script to a common file system location on the monitored agents and use the Shell Command templates to invoke the script on the file system.<strong></strong></li>
<li><strong>sudo Eevation</strong>:  If the Run As account specified via the selected Run As profile in the Shell Command templates is configured for sudo elevation, sudoers will need to be configured to authorize the user to execute the command.  For example, adding the following line through <em>visudo</em> will allow the user <em>monuser</em> to execute the command <em>service named restart</em> as input in the Shell Command task template (assuming the default shell of /bin/sh):<br />
<em>monuser ALL=(root) NOPASSWD: /bin/sh -c service named restart</em><strong></strong></li>
<li><strong>Expression Filters<br />
</strong>Valid values for Parameter Names in the template Expression Filters are:<strong></strong></p>
<ul>
<li><em>//*[local-name()=”StdErr”]</em> <em> </em>for StdErr<strong></strong></li>
<li><em>//*[local-name()=”StdOut”]</em> for StdOut<strong></strong></li>
<li><em>//*[local-name()=”ReturnCode”]</em>for ReturnCodeThe Expression Filters in the templates are pre-configured for common scenarios. However, some commands used in monitoring will return values to evaluate on StdOut while other cases will mandate evaluation of StdErr.  For example, if you wanted to run a command to check a connection to a MySQL server, any errors would be output to StdErr. Thusly, the monitor’s expression filter would need to look for the presence of the string ERROR in the StdErr output.Additionally, the default Expression Filters evaluate that ReturnCode = 0 for rules and monitors. This default behavior drops the workflow if the shell command itself fails.  However, if you want to generate an alert if a command fails, the ReturnCode may be 1 in the error state. In this case, the Expression Filter could be configured to go unhealthy when ReturnCode = 1, or StdErr could be evaluated for a string, and the ReturnCode evaluation removed.As in all OpsMgr templates, the Expression Filter dialogs assume values are strings, which can be problematic when evaluating numeric data.  Options for addressing this issue are</li>
<li>Export the MP after creating the rule or monitor, and edit the Type attribute in the Expression XM</li>
<li>Use Regular Expressions in the Expression Filter instead of greater than/less than evaluations</li>
<li>Perform numeric evaluation operations on the agent in the Shell Command and output a simple health state (OK or ERROR) from the shell command itself.And lastly, be mindful of the logical outcome of Expression Filters. For monitors, any potential value from the shell script should positively evaluate to one of the health states (Error or Healthy for two state monitors, or Error, Warning, or Healthy for three state monitors). Particularly, be mindful of AND and OR groupings on Error and Healthy states.  For example, a monitor that requires condition 1 AND condition 2 to be true to be in an Error state should require that only condition 1 OR condition 2 <em>not </em>be true to be Healthy.</li>
</ul>
</li>
</ul>
<h3>Tips, Tricks, and Best Practices</h3>
<ul>
<li><em>When creating shell command rules and monitors, test out the commands in a task first! </em> Shell Command tasks are very simple to create and provide immediate feedback.  Syntactical or authorization issues will be most quickly identified through this method.<strong><em></em></strong></li>
<li>Target “Computer” classes, but disable the rules and monitors by default.  Override the rule and monitor for a group to enable it.</li>
<li>Only use short-running shell commands in rules and monitors<strong></strong>
<ul>
<li>Long running commands or scripts can be scheduled with cron and output to file, using the Shell Command templates to parse the output file<strong></strong></li>
</ul>
</li>
<li>Avoid double quotes as well as &lt; and /&gt; characters if possible. <strong></strong>
<ul>
<li>Complex scripts can be deployed to the file system of the monitored agents and invoked by the Shell Command templates<strong></strong></li>
</ul>
</li>
<li>For optimal performance, use the largest schedule interval that makes sense (15 minutes is preferred for most cases)<strong></strong></li>
<li>Optimize the shell commands (using pipeline formatting with grep, awk, sed, etc)  to return a single, easy to parse value
<ul>
<li>For monitors, returning values like: OK, WARNING, ERROR are best<strong></strong></li>
<li>For performance rules, the value evaluated must be a single numeric value<strong></strong></li>
</ul>
</li>
<li>To troubleshoot sudo issues, tail /var/log/messages and look for the exact command that failed – to cross reference with sudoers configuration.</li>
<li>Be aware what the shell command returns for StdOut, StdErr, and ReturnCode in healthy and unhealthy scenarios. This is critical information when configuring the Expression Filters.</li>
<li>Have fun!<strong></strong></li>
</ul>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/operatingquadrant.wordpress.com/746/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/operatingquadrant.wordpress.com/746/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/operatingquadrant.wordpress.com/746/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/operatingquadrant.wordpress.com/746/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/operatingquadrant.wordpress.com/746/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/operatingquadrant.wordpress.com/746/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/operatingquadrant.wordpress.com/746/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/operatingquadrant.wordpress.com/746/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/operatingquadrant.wordpress.com/746/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/operatingquadrant.wordpress.com/746/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/operatingquadrant.wordpress.com/746/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/operatingquadrant.wordpress.com/746/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/operatingquadrant.wordpress.com/746/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/operatingquadrant.wordpress.com/746/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=operatingquadrant.com&amp;blog=8969466&amp;post=746&amp;subd=operatingquadrant&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://operatingquadrant.com/2012/02/01/opsmgr-2012-unixlinux-authoring-templates-more-information-on-the-shell-command-templates/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/26f47dda05ea2d756f1f83f1164605aa?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">KB</media:title>
		</media:content>
	</item>
		<item>
		<title>OpsMgr 2012 UNIX/Linux Authoring Templates:  Shell Command</title>
		<link>http://operatingquadrant.com/2012/01/30/opsmgr-2012-unixlinux-authoring-templates-shell-command/</link>
		<comments>http://operatingquadrant.com/2012/01/30/opsmgr-2012-unixlinux-authoring-templates-shell-command/#comments</comments>
		<pubDate>Mon, 30 Jan 2012 15:11:38 +0000</pubDate>
		<dc:creator>Kristopher Bash</dc:creator>
				<category><![CDATA[Management Packs]]></category>
		<category><![CDATA[System Center Operations Manager]]></category>
		<category><![CDATA[UNIX/LInux]]></category>

		<guid isPermaLink="false">http://operatingquadrant.com/?p=677</guid>
		<description><![CDATA[Many of the OpsMgr authoring examples for UNIX/Linux monitoring that I have described on this blog are based on the use of the WSMan Invoke modules to execute shell commands. This is a really powerful mechanism to extend the capabilities of Operations Manager monitoring, and the 2012 version of Operations Manager includes a new set of templates [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=operatingquadrant.com&amp;blog=8969466&amp;post=677&amp;subd=operatingquadrant&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Many of the OpsMgr authoring examples for UNIX/Linux monitoring that I have described on this blog are based on the use of the WSMan Invoke modules to execute shell commands. This is a really powerful mechanism to extend the capabilities of Operations Manager monitoring, and the 2012 version of Operations Manager includes a new set of templates allowing the creation of rules, monitors, and tasks using UNIX/Linux shell commands <em>directly from the Authoring pane of the console</em>.</p>
<p>The new templates are:</p>
<p><strong>Monitors</strong></p>
<ul>
<li>UNIX/Linux Shell Command Three State Monitor</li>
<li>UNIX/Linux Shell Command Two State Monitor</li>
</ul>
<p><strong>Rules</strong></p>
<ul>
<li>UNIX/Linux Shell Command (Alert)</li>
<li>UNIX/Linux Shell Command (Performance)</li>
</ul>
<p><strong>Tasks</strong></p>
<ul>
<li>Run a UNIX/Linux Shell Command</li>
</ul>
<p><em>Note: For the OpsMgr 2012 Release Candidate, the Shell Command Template MP needs to be <a href="http://www.microsoft.com/download/en/details.aspx?id=27974">downloaded</a> and imported.  In the final release, it will be imported by default.</em></p>
<p>Underneath the covers, all of these templates use the ExecuteShellCommand method of the agent’s script provider with the WSMan Invoke module. This method executes the command and outputs StdOut, StdErr, and ReturnCode. The command can be a path to a simple command, a command or script existing on the managed computer, or a “one-liner” script (a shell script condensed to one line with pipes and semi-colons).  The templates also allow you to select whether to run with the nonprivileged action account, or the privileged account (which also supports sudo elevation).</p>
<p>If you’ve done this kind of UNIX/Linux authoring in 2007 R2, you will quickly see how much easier and faster this can be done in 2012.</p>
<p>To show the use of these templates, I have put together an MP authoring walkthrough for monitoring BIND DNS servers on Linux. This entire MP will be created in the Operations Console, with no XML editing!</p>
<h2><strong>Walkthrough: Monitoring BIND on Linux</strong></h2>
<p><span id="more-677"></span></p>
<p>Before starting on the MP implementation, let’s have a look at what we might want to monitor to check health of a BIND DNS server.  Some basic metrics would be:</p>
<ul>
<li><strong>Daemon status:</strong>   if the <em>named</em> daemon is not running, it’s a pretty good indication that BIND is not healthy!</li>
<li><strong>DNS resolution success</strong>:  a good way to validate that BIND is functioning properly is to check that the server can resolve a hostname.  This could be the FQDN of a local host or an Internet URL (if we wanted to confirm that Internet DNS resolution was functioning properly).  This can be done easily with nslookup on the BIND server itself:
<ul>
<li><em>nslookup lx12.contoso.com 127.0.0.1</em></li>
<li><em>nslookup www.microsoft.com 127.0.0.1</em></li>
</ul>
</li>
<li><strong>Performance metrics: </strong>  we can use the shell command templates to collect or monitor numeric performance data as well.  For a BIND server, one performance metric we could collect is the time to resolve a name (in seconds):<br />
<em>/usr/bin/time -f %e nslookup lx12.contoso.com 127.0.0.1 &gt; /dev/null<br />
</em></li>
</ul>
<h3><strong>Setting up the Management Pack:</strong></h3>
<ul>
<li>The first step is to create a new Management Pack.  In the <strong>Administration</strong> pane of the Operations Console, right-click on left-hand menu and choose <strong>Create Management Pack</strong>. Input a name and description and complete the wizard:<br />
<a href="http://operatingquadrant.com/2012/01/30/opsmgr-2012-unixlinux-authoring-templates-shell-command/createthemp/" rel="attachment wp-att-678"><img class="alignnone size-medium wp-image-678" title="Create the MP" src="http://operatingquadrant.files.wordpress.com/2012/01/createthemp.png?w=400&#038;h=333" alt="" width="400" height="333" /></a></li>
<li>We will use a group to control targeting of the rules and monitors in the MP, so the next step is to create a group. In the <strong>Authoring</strong> pane, right click on <strong>Groups</strong> and choose: <strong>Create a new Group</strong>.  Provide a name and description, and select the target Management Pack (the one created in the previous step) and click <strong>Next</strong>.<br />
<a href="http://operatingquadrant.com/2012/01/30/opsmgr-2012-unixlinux-authoring-templates-shell-command/createthegroup/" rel="attachment wp-att-679"><img class="alignnone size-medium wp-image-679" title="Create the Group" src="http://operatingquadrant.files.wordpress.com/2012/01/createthegroup.png?w=400&#038;h=315" alt="" width="400" height="315" /></a></li>
<li>In the <strong>Explicit Members</strong>, add the Bind hosts (filter by UNIX/Linux Computer or Linux Computer objects).  Note:  membership can be controlled for this group at any point in the future, so not all BIND servers have to be added at this point.<br />
<a href="http://operatingquadrant.com/2012/01/30/opsmgr-2012-unixlinux-authoring-templates-shell-command/add-group-members/" rel="attachment wp-att-680"><img class="alignnone size-medium wp-image-680" title="Add Group Members" src="http://operatingquadrant.files.wordpress.com/2012/01/add-group-members.png?w=400&#038;h=385" alt="" width="400" height="385" /></a></li>
<li>No action is needed for the <strong>Dynamic Members</strong>, <strong>Subgroups</strong>, or <strong>Excluded Members</strong> dialogs, so click next through these to complete the group creation wizard.</li>
<li>With the MP and group created, it’s on to the actual monitoring.</li>
</ul>
<h3><strong>Creating a BIND Restart Task</strong></h3>
<p>The <strong>Run a UNIX/Linux Shell Command</strong> task wizard is the simplest of the shell command templates, so it is a good place to start. These steps will result in a task that restarts the BIND daemon on a Linux computer from the Operations Console.</p>
<ul>
<li>In the <strong>Authoring</strong> pane of the console, expand <strong>Management Pack Objects</strong> and right click <strong>Tasks</strong>. Select <strong>Create a New Task</strong>.</li>
<li>Select <strong>Run a UNIX/Linux Shell Command</strong> from the <strong>Agent Tasks</strong> list, and select the target <strong>Management Pack </strong>(created in a previous step).  Click <strong>Next</strong>.<br />
<a href="http://operatingquadrant.com/2012/01/30/opsmgr-2012-unixlinux-authoring-templates-shell-command/create-a-task/" rel="attachment wp-att-685"><img class="alignnone size-medium wp-image-685" title="Create a Task" src="http://operatingquadrant.files.wordpress.com/2012/01/create-a-task.png?w=400&#038;h=339" alt="" width="400" height="339" /></a></li>
<li>Input a <strong>Name</strong> for the task (<em>Restart BIND Daemon</em>), provide a <strong>Description</strong>, and select the <strong>Target</strong> (<em>Linux Computer</em>). Click <strong>Next</strong>.<br />
<a href="http://operatingquadrant.com/2012/01/30/opsmgr-2012-unixlinux-authoring-templates-shell-command/task-name-and-description/" rel="attachment wp-att-688"><img class="alignnone size-medium wp-image-688" title="Task - Name and Description" src="http://operatingquadrant.files.wordpress.com/2012/01/task-name-and-description.png?w=400&#038;h=339" alt="" width="400" height="339" /></a></li>
<li>The command to restart the BIND daemon is: <em>service named restart</em>.  Type this into the <strong>Shell Command</strong> entry pane.  Restarting a daemon is a privileged operation, so select the <em>UNIX/Linux Privileged Account </em><strong>Run As profile</strong>.  The default timeout of 120 seconds should be sufficient, so click <strong>Create</strong>.<br />
<a href="http://operatingquadrant.com/2012/01/30/opsmgr-2012-unixlinux-authoring-templates-shell-command/task-shell-command-details/" rel="attachment wp-att-689"><img class="alignnone size-medium wp-image-689" title="Task - Shell Command Details" src="http://operatingquadrant.files.wordpress.com/2012/01/task-shell-command-details.png?w=400&#038;h=339" alt="" width="400" height="339" /></a></li>
<li>That’s all it takes to create a shell command task.  When clicking on a Linux Computer instance in the monitoring view, the <strong>Restart BIND Daemon</strong> task will be listed in the right-hand task pane and can be run directly from the console.</li>
</ul>
<h3><strong>Monitoring the BIND Daemon</strong></h3>
<ul>
<li>In the <strong>Authoring </strong>pane of the console, right-click<strong> Management Pack Templates</strong> and choose <strong>Add Monitoring Wizard</strong>.</li>
<li>Select <strong>UNIX/Linux Process Monitoring</strong> and click <strong>Next<br />
<a href="http://operatingquadrant.com/2012/01/30/opsmgr-2012-unixlinux-authoring-templates-shell-command/process-add-monitoring-wizard/" rel="attachment wp-att-752"><img class="alignnone size-medium wp-image-752" title="Process Add Monitoring Wizard" src="http://operatingquadrant.files.wordpress.com/2012/01/process-add-monitoring-wizard.png?w=400&#038;h=315" alt="" width="400" height="315" /></a></strong></li>
<li>Input a <strong>Name </strong>for the monitor, a <strong>Description</strong>, and select the target <strong>Management Pack</strong> (created previously):<br />
<a href="http://operatingquadrant.com/2012/01/30/opsmgr-2012-unixlinux-authoring-templates-shell-command/process-template-name-and-description/" rel="attachment wp-att-691"><img class="alignnone size-medium wp-image-691" title="Process Template Name and Description" src="http://operatingquadrant.files.wordpress.com/2012/01/process-template-name-and-description.png?w=400&#038;h=315" alt="" width="400" height="315" /></a></li>
<li>This is a pretty simple process monitor, so simply input <em>named </em>for the <strong>Process name</strong>, click <strong>Select a group</strong> and select the BIND servers group created previously.  An <strong>Alert severity</strong> of Error is appropriate and process argument filtering is not required, so click <strong>Next</strong>.<br />
<a href="http://operatingquadrant.com/2012/01/30/opsmgr-2012-unixlinux-authoring-templates-shell-command/process-template-details/" rel="attachment wp-att-692"><img class="alignnone size-medium wp-image-692" title="Process Template Details" src="http://operatingquadrant.files.wordpress.com/2012/01/process-template-details.png?w=400&#038;h=315" alt="" width="400" height="315" /></a></li>
<li>On the <strong>Settings </strong>page, accept the defaults by clicking <strong>Next</strong>. This will generate an alert if <em>named</em> is not running.<br />
<a href="http://operatingquadrant.com/2012/01/30/opsmgr-2012-unixlinux-authoring-templates-shell-command/process-template-settings/" rel="attachment wp-att-693"><img class="alignnone size-medium wp-image-693" title="Process Template Settings" src="http://operatingquadrant.files.wordpress.com/2012/01/process-template-settings.png?w=400&#038;h=315" alt="" width="400" height="315" /></a></li>
<li>Click <strong>Create<em> </em></strong>to complete the wizard.</li>
</ul>
<h3><strong>Creating the Name Resolution Monitor</strong></h3>
<p>As described above, the command <em>nslookup </em>can be used to check name resolution health from the DNS server (specifying the local host as the server in the second argument).  For example: <em>nslookup lx12.contoso.com 127.0.0.1<strong>.  </strong></em>The actual output of this command looks like:</p>
<p><em>lx11:/var/lib/named # nslookup lx12.contoso.com 127.0.0.1<br />
</em><em>Server:         127.0.0.1<br />
</em><em>Address:        127.0.0.1#53</em></p>
<p><em>Name:   lx12.contoso.com<br />
</em><em>Address: 192.168.1.76 </em></p>
<p>To make this command more monitor friendly, we can do a bit of pipeline parsing:<br />
<em>nslookup lx12.contoso.com 127.0.0.1|egrep &#8216;^Name:.*lx12.contoso.com&#8217;|wc -l</em></p>
<p>This shell command will return a value of 1 if the line: <em>Name:   lx12.contoso.com </em>is found in StdOut and a value of 0 otherwise.  Thusly, a value of 1 means that the name resolution attempt succeeded, and a value of 0 means that it failed.</p>
<p>The steps to create a monitor using this command are:</p>
<ul>
<li>In the <strong>Authoring</strong> pane of the console, expand <strong>Management Pack Objects</strong> and right click <strong>Monitors</strong>. Select <strong>Create a Monitor</strong> and <strong>Unit Monitor</strong>.</li>
<li>Expand <strong>Scripting</strong>, then <strong>Generic</strong> and select <strong>UNIX/Linux Shell Command Two State Monitor</strong> and select the target <strong>Management Pack</strong> (created previously). Click <strong>Next</strong>.<br />
<a href="http://operatingquadrant.com/2012/01/30/opsmgr-2012-unixlinux-authoring-templates-shell-command/create-a-shell-command-monitor/" rel="attachment wp-att-698"><img class="alignnone size-medium wp-image-698" title="Create a Shell Command Monitor" src="http://operatingquadrant.files.wordpress.com/2012/01/create-a-shell-command-monitor.png?w=400&#038;h=373" alt="" width="400" height="373" /></a></li>
<li>Input a <strong>Name</strong>, <strong>Description</strong>, and <strong>Target</strong> (<em>Linux Computer</em>) for the monitor. Select a <strong>Parent monitor </strong>(<em>Availability</em>) and uncheck <strong>Monitor is enabled</strong>.  Click <strong>Next</strong>.<br />
<a href="http://operatingquadrant.com/2012/01/30/opsmgr-2012-unixlinux-authoring-templates-shell-command/shell-command-monitor-name-and-description/" rel="attachment wp-att-700"><img title="Shell Command Monitor Name and Description" src="http://operatingquadrant.files.wordpress.com/2012/01/shell-command-monitor-name-and-description.png?w=400&#038;h=373" alt="" width="400" height="373" /></a></li>
<li>Configure a schedule interval.  For performance optimization, this should be as large of a value as reasonable.  10 or 15 minutes should be sufficient for most purposes. Click <strong>Next</strong><br />
<a href="http://operatingquadrant.com/2012/01/30/opsmgr-2012-unixlinux-authoring-templates-shell-command/shell-command-monitor-scheduler/" rel="attachment wp-att-701"><img class="alignnone size-medium wp-image-701" title="Shell Command Monitor Scheduler" src="http://operatingquadrant.files.wordpress.com/2012/01/shell-command-monitor-scheduler.png?w=400&#038;h=373" alt="" width="400" height="373" /></a></li>
<li>Input the <strong>Shell Command </strong>(replacing lx12.contoso.com with the hostname to resolve):<br />
<strong><br />
</strong><em>nslookup lx12.contoso.com 127.0.0.1|egrep &#8216;^Name:.*lx12.contoso.com&#8217;|wc –l<br />
</em><br />
The <em>UNIX/Linux Action Account </em><strong>Run As profile</strong><em> </em>is appropriate for this command, and 120 seconds is a sufficient value for the <strong>Timeout</strong>. Click <strong>Next</strong>.<br />
<a href="http://operatingquadrant.com/2012/01/30/opsmgr-2012-unixlinux-authoring-templates-shell-command/shell-command-monitor-details/" rel="attachment wp-att-702"><img class="alignnone size-medium wp-image-702" title="Shell Command Monitor Details" src="http://operatingquadrant.files.wordpress.com/2012/01/shell-command-monitor-details.png?w=400&#038;h=373" alt="" width="400" height="373" /></a></li>
<li>The next page of the wizard is for configuring the <strong>Error Expression</strong>. If the conditions defined in this expression are matched, the monitor will go to an error state. The Expression Filter dialog is preloaded with the following values://*[local-name()="StdOut"]  <em>Contains </em> &lt;input value&gt;<br />
//*[local-name()="ReturnCode"] <em>Equals</em>  <em>0</em>With the shell command used in this example, the error state should be triggered when StdOut does not equal 1, so we can simply modify the first line to that effect.  This results in an error condition that is triggered when StdOut does not equal 1 and the nslookup command executed successfully (ReturnCode equals 0).<br />
<a href="http://operatingquadrant.com/2012/01/30/opsmgr-2012-unixlinux-authoring-templates-shell-command/shell-command-monitor-error-expression/" rel="attachment wp-att-703"><img title="Shell Command Monitor Error Expression" src="http://operatingquadrant.files.wordpress.com/2012/01/shell-command-monitor-error-expression.png?w=400&#038;h=373" alt="" width="400" height="373" /></a></li>
<li>After clicking <strong>Next</strong>, the <strong>Healthy Expression</strong> dialog is displayed. As a StdOut value of 1 indicates a successful nslookup operation using the provided shell command, simply set the first line to: //*[local-name()="StdOut"]  <em>Equals 1 </em>and click <strong>Next</strong>.<br />
<em><a href="http://operatingquadrant.com/2012/01/30/opsmgr-2012-unixlinux-authoring-templates-shell-command/shell-command-monitor-healthy-expression/" rel="attachment wp-att-704"><img title="Shell Command Monitor Healthy Expression" src="http://operatingquadrant.files.wordpress.com/2012/01/shell-command-monitor-healthy-expression.png?w=400&#038;h=373" alt="" width="400" height="373" /></a></em></li>
<li>In the <strong>Configure Health </strong>dialog, we can choose whether we want the error state to map to a Critical or Warning event by changing the <strong>Health State</strong> drop down.   In this example, I will set the <strong>Health State</strong> to Warning.<br />
<a href="http://operatingquadrant.com/2012/01/30/opsmgr-2012-unixlinux-authoring-templates-shell-command/shell-command-monitor-health-mapping/" rel="attachment wp-att-705"><img class="alignnone size-medium wp-image-705" title="Shell Command Monitor Health Mapping" src="http://operatingquadrant.files.wordpress.com/2012/01/shell-command-monitor-health-mapping.png?w=400&#038;h=373" alt="" width="400" height="373" /></a></li>
<li>The next dialog is for alert configuration. Check <strong>Generate alerts for this monitor </strong>and select an appropriate <strong>Priority </strong>and <strong>Severity</strong> (<em>Match monitor’s health). <strong> </strong></em>Edit the <strong>Alert name</strong> if appropriate and provide an <strong>Alert description</strong>.Standard $Target$ variables can be embedded in the <strong>Alert description</strong> by clicking <strong>[…]</strong>.  The syntax to include data from the shell command execution is:StdOut:  $Data/Context///*[local-name()=”StdOut”]$<br />
StdErr:  $Data/Context///*[local-name()=”StdErr”]$<br />
ReturnCode: $Data/Context///*[local-name()=”ReturnCode”]$In this example, I used the following description:<em>The BIND DNS server: $Target/Property[Type="MicrosoftUnixLibrary7320040!Microsoft.Unix.Computer"]/NetworkName$ failed a name resolution test.</em><em>StdErr: $Data/Context///*[local-name()="StdErr"]$</em>Click <strong>Create</strong> to complete the monitor creation.<br />
<img class="alignnone size-medium wp-image-706" title="Shell Command Monitor Alert" src="http://operatingquadrant.files.wordpress.com/2012/01/shell-command-monitor-alert.png?w=400&#038;h=373" alt="" width="400" height="373" /></li>
<li>As this monitor targets all <em>Linux Computers</em>, we created it without enabling it by default. We can enable it for the group of BIND servers with an override. In the <strong>Authoring</strong> pane, expand <strong>Management Pack Objects</strong>, and click on <strong>Monitors</strong>. In the top-right of the <strong>Monitors</strong> pane, click <strong>Change Scope</strong>, and check <em>Linux Computers </em>from the <strong>Scope Management Pack Objects</strong> dialog.  Find the monitor that was just created (<em>BIND Name Resolution Check</em>).<br />
<a href="http://operatingquadrant.com/2012/01/30/opsmgr-2012-unixlinux-authoring-templates-shell-command/find-the-monitor-2/" rel="attachment wp-att-708"><img title="Find the Monitor" src="http://operatingquadrant.files.wordpress.com/2012/01/find-the-monitor1-e1327557772379.png?w=400&#038;h=107" alt="" width="400" height="107" /></a></li>
<li>Right-click the monitor, click <strong>Overrides</strong>, then <strong>Override the Monitor</strong>, then <strong>For a Group</strong>.  Select the BIND servers group created previously and click <strong>OK</strong>.<br />
<a href="http://operatingquadrant.com/2012/01/30/opsmgr-2012-unixlinux-authoring-templates-shell-command/select-the-group/" rel="attachment wp-att-709"><img class="alignnone size-medium wp-image-709" title="Select the group" src="http://operatingquadrant.files.wordpress.com/2012/01/select-the-group.png?w=400&#038;h=429" alt="" width="400" height="429" /></a></li>
<li>Override the <strong>Enabled </strong>property to equal <strong>True</strong> and click <strong>OK</strong><br />
<a href="http://operatingquadrant.com/2012/01/30/opsmgr-2012-unixlinux-authoring-templates-shell-command/monitor-override/" rel="attachment wp-att-710"><img title="Monitor override" src="http://operatingquadrant.files.wordpress.com/2012/01/monitor-override.png?w=400&#038;h=408" alt="" width="400" height="408" /></a></li>
</ul>
<h3><strong>Creating the Name Resolution Time Performance Rule</strong></h3>
<ul>
<li>In the <strong>Authoring </strong>pane of the console, right-click <strong>Rules</strong>, and select <strong>Create a new rule</strong>.</li>
<li>Under <strong>Collection Rules</strong>, <strong>Probe Based</strong>, select <strong>UNIX/Linux Shell Command (Performance) </strong>and select the target <strong>Management Pack</strong> (previously created).  Click <strong>Next</strong>.<br />
<a href="http://operatingquadrant.com/2012/01/30/opsmgr-2012-unixlinux-authoring-templates-shell-command/create-a-shell-command-rule/" rel="attachment wp-att-713"><img title="Create a Shell Command Rule" src="http://operatingquadrant.files.wordpress.com/2012/01/create-a-shell-command-rule.png?w=400&#038;h=339" alt="" width="400" height="339" /></a></li>
<li>Input the <strong>Name</strong> and <strong>Description</strong> for the rule. Select the <strong>Target</strong> (<em>Linux Computer</em>) and uncheck <strong>Rule is enabled</strong>. Click <strong>Next</strong>.<br />
<a href="http://operatingquadrant.com/2012/01/30/opsmgr-2012-unixlinux-authoring-templates-shell-command/shell-command-rule-name-and-description/" rel="attachment wp-att-714"><img title="Shell Command Rule Name and Description" src="http://operatingquadrant.files.wordpress.com/2012/01/shell-command-rule-name-and-description.png?w=400&#038;h=339" alt="" width="400" height="339" /></a></li>
<li>Configure a schedule interval.  For performance optimization, this should be as large of a value as reasonable.  10 or 15 minutes should be sufficient for most purposes. Click <strong>Next.</strong><br />
<a href="http://operatingquadrant.com/2012/01/30/opsmgr-2012-unixlinux-authoring-templates-shell-command/shell-command-rule-scheduler/" rel="attachment wp-att-715"><img class="alignnone size-medium wp-image-715" title="Shell Command Rule Scheduler" src="http://operatingquadrant.files.wordpress.com/2012/01/shell-command-rule-scheduler.png?w=400&#038;h=339" alt="" width="400" height="339" /></a></li>
<li>On the <strong>Shell Command Details</strong> page, input the <strong>Shell Command</strong>:<br />
<em>/usr/bin/time -f %e nslookup lx12.contoso.com 127.0.0.1 &gt; /dev/null<br />
</em>This command will return the time in seconds (to StdErr) that it took to complete the name resolution lookup. This is a non-privileged operation, so the <em>UNIX/Linux Action Account</em> is sufficient for the <strong>Run As profile</strong>.  Click <strong>Next</strong>.<br />
<a href="http://operatingquadrant.com/2012/01/30/opsmgr-2012-unixlinux-authoring-templates-shell-command/shell-command-rule-details/" rel="attachment wp-att-716"><img title="Shell Command Rule Details" src="http://operatingquadrant.files.wordpress.com/2012/01/shell-command-rule-details.png?w=400&#038;h=339" alt="" width="400" height="339" /></a></li>
<li>The next page provides the opportunity to filter the output before mapping to performance data.  Performance data mapping can only occur if the value is a valid double value, so the default expression syntax uses a RegExp to validate that StdOut is a numeric value, and also filters that the ReturnCode = 0, indicating a successful execution.  While the default configuration is valid for most scenarios, the <em>time</em> command used in this shell command actually outputs its value to StdErr.  So in this case, the first line of the filter should be modified to use a <strong>Parameter Name</strong> of <em>//*[local-name()=”StdErr”]</em>. Click <strong>Next.</strong><br />
<a href="http://operatingquadrant.com/2012/01/30/opsmgr-2012-unixlinux-authoring-templates-shell-command/shell-command-rule-filter/" rel="attachment wp-att-717"><img class="alignnone size-medium wp-image-717" title="Shell Command Rule Filter" src="http://operatingquadrant.files.wordpress.com/2012/01/shell-command-rule-filter.png?w=400&#038;h=339" alt="" width="400" height="339" /></a></li>
<li>Configure the <strong>Performance Mapper</strong>.  <strong>Object</strong>, <strong>Counter,</strong> and <strong>Instance</strong> are arbitrary values that will be used to identify the performance metric in performance views and reports. The default <strong>Value</strong> of <em>$Data///*[local-name()=”StdOut”]$ </em>is the variable syntax for the returned StdOut, which is appropriate for most cases. Again, this needs to be modified because the<em> time</em> command used in this example outputs to StdErr.  The StdErr variable is: <em>$Data///*[local-name()='StdErr']$.</em> Click <strong>Create</strong>.<br />
<a href="http://operatingquadrant.com/2012/01/30/opsmgr-2012-unixlinux-authoring-templates-shell-command/shell-command-rule-mapper/" rel="attachment wp-att-718"><img title="Shell Command Rule Mapper" src="http://operatingquadrant.files.wordpress.com/2012/01/shell-command-rule-mapper.png?w=400&#038;h=339" alt="" width="400" height="339" /></a></li>
<li>As this rule targets all <em>Linux Computers</em>, we created it without enabling it by default. We can enable it for the group of BIND servers with an override. In the <strong>Authoring</strong> pane, expand <strong>Management Pack Objects</strong>, and click on <strong>Rules</strong>. In the top-right of the <strong>Rules </strong>pane, click <strong>Change Scope</strong>, and check <em>Linux Computers </em>from the <strong>Scope Management Pack Objects</strong> dialog.  Find the rules that was just created (<em>BIND Name Resolution Test Time in Seconds</em>).<br />
<a href="http://operatingquadrant.com/2012/01/30/opsmgr-2012-unixlinux-authoring-templates-shell-command/find-the-rule/" rel="attachment wp-att-719"><img title="Find the Rule" src="http://operatingquadrant.files.wordpress.com/2012/01/find-the-rule-e1327591561234.png?w=400&#038;h=65" alt="" width="400" height="65" /></a></li>
<li>Right-click the rule, click <strong>Overrides</strong>, then <strong>Override the Monitor</strong>, then <strong>For a Group</strong>.  Select the BIND servers group created previously and click <strong>OK</strong>.<br />
<img title="Select the group" src="http://operatingquadrant.files.wordpress.com/2012/01/select-the-group.png?w=400&#038;h=429" alt="" width="400" height="429" /></li>
<li>Override the <strong>Enabled </strong>property to equal <strong>True</strong> and click <strong>OK</strong>.<br />
<a href="http://operatingquadrant.com/2012/01/30/opsmgr-2012-unixlinux-authoring-templates-shell-command/override-the-rule/" rel="attachment wp-att-721"><img title="Override the Rule" src="http://operatingquadrant.files.wordpress.com/2012/01/override-the-rule.png?w=400&#038;h=408" alt="" width="400" height="408" /></a></li>
</ul>
<h3><strong>Creating a Dashboard View</strong></h3>
<p>With the monitoring pieces now in place, we can move on to creating a dashboard view to show health and performance.</p>
<ul>
<li>In the <strong>Monitoring </strong>pane of the console, find the folder for the BIND management pack. Right-click the folder and choose <strong>New</strong>, then <strong>Dashboard View</strong><br />
<a href="http://operatingquadrant.com/2012/01/30/opsmgr-2012-unixlinux-authoring-templates-shell-command/mp-folder/" rel="attachment wp-att-729"><img class="alignnone size-medium wp-image-729" title="MP Folder" src="http://operatingquadrant.files.wordpress.com/2012/01/mp-folder-e1327591937989.png?w=320&#038;h=80" alt="" width="320" height="80" /></a></li>
<li>Select <strong>Grid Layout </strong>and click <strong>Next</strong>.<br />
<a href="http://operatingquadrant.com/2012/01/30/opsmgr-2012-unixlinux-authoring-templates-shell-command/dashboard-grid-layout/" rel="attachment wp-att-723"><img class="alignnone size-medium wp-image-723" title="Dashboard Grid Layout" src="http://operatingquadrant.files.wordpress.com/2012/01/dashboard-grid-layout.png?w=400&#038;h=293" alt="" width="400" height="293" /></a></li>
<li>Input a <strong>Name</strong> and <strong>Description</strong> and click <strong>Next</strong>.<br />
<a href="http://operatingquadrant.com/2012/01/30/opsmgr-2012-unixlinux-authoring-templates-shell-command/dashboard-name-and-description/" rel="attachment wp-att-725"><img class="alignnone size-medium wp-image-725" title="Dashboard Name and Description" src="http://operatingquadrant.files.wordpress.com/2012/01/dashboard-name-and-description.png?w=400&#038;h=293" alt="" width="400" height="293" /></a></li>
<li>Select <strong>3 Cells</strong> and pick a layout. Click <strong>Next</strong> then <strong>Create</strong>.<br />
<a href="http://operatingquadrant.com/2012/01/30/opsmgr-2012-unixlinux-authoring-templates-shell-command/dashboard-cells/" rel="attachment wp-att-722"><img class="alignnone size-medium wp-image-722" title="Dashboard Cells" src="http://operatingquadrant.files.wordpress.com/2012/01/dashboard-cells.png?w=400&#038;h=293" alt="" width="400" height="293" /></a></li>
<li>We now have an empty dashboard view.</li>
</ul>
<h4></h4>
<ul>
<li>Click <strong>Click to add widget</strong> in the top-left rectangle. Select <strong>State Widget</strong> and click <strong>Next</strong>.<br />
<a href="http://operatingquadrant.com/2012/01/30/opsmgr-2012-unixlinux-authoring-templates-shell-command/dashboard-state-widget/" rel="attachment wp-att-727"><img class="alignnone size-medium wp-image-727" title="Dashboard State Widget" src="http://operatingquadrant.files.wordpress.com/2012/01/dashboard-state-widget.png?w=400&#038;h=293" alt="" width="400" height="293" /></a></li>
<li>Provide a <strong>Name </strong>and <strong>Description</strong> and click <strong>Next</strong>.<br />
<a href="http://operatingquadrant.com/2012/01/30/opsmgr-2012-unixlinux-authoring-templates-shell-command/dashboard-state-widget-name-and-description/" rel="attachment wp-att-726"><img class="alignnone size-medium wp-image-726" title="Dashboard State Widget Name and Description" src="http://operatingquadrant.files.wordpress.com/2012/01/dashboard-state-widget-name-and-description.png?w=400&#038;h=293" alt="" width="400" height="293" /></a></li>
<li>Under <strong>Groups and objects</strong> click <strong>Add</strong>. In the search dialog, find the BIND servers group, add it to the selection list and click <strong>OK</strong>.<br />
<a href="http://operatingquadrant.com/2012/01/30/opsmgr-2012-unixlinux-authoring-templates-shell-command/dashboard-group-filter/" rel="attachment wp-att-724"><img class="alignnone size-medium wp-image-724" title="Dashboard Group Filter" src="http://operatingquadrant.files.wordpress.com/2012/01/dashboard-group-filter.png?w=400&#038;h=424" alt="" width="400" height="424" /></a></li>
<li>Configure the display and filtering preferences and complete the widget wizard.</li>
</ul>
<h4>Adding the Performance Widget</h4>
<ul>
<li>Click <strong>Click to add widget</strong> in the top-right rectangle. Select <strong>Performance Widget</strong> and click <strong>Next</strong>.<br />
<a href="http://operatingquadrant.com/2012/01/30/opsmgr-2012-unixlinux-authoring-templates-shell-command/dashboard-performance-widget/" rel="attachment wp-att-738"><img class="alignnone size-medium wp-image-738" title="Dashboard Performance Widget" src="http://operatingquadrant.files.wordpress.com/2012/01/dashboard-performance-widget.png?w=400&#038;h=293" alt="" width="400" height="293" /></a></li>
<li>Input a <strong>Name </strong>and <strong>Description</strong> and click <strong>Next</strong>.<br />
<a href="http://operatingquadrant.com/2012/01/30/opsmgr-2012-unixlinux-authoring-templates-shell-command/dashboard-performance-widget-name-and-description/" rel="attachment wp-att-737"><img class="alignnone size-medium wp-image-737" title="Dashboard Performance Widget Name and Description" src="http://operatingquadrant.files.wordpress.com/2012/01/dashboard-performance-widget-name-and-description.png?w=400&#038;h=293" alt="" width="400" height="293" /></a></li>
<li>Under <strong>Select a group or object </strong>click <strong>[…]</strong> and find the BIND servers group.  Select the group and click <strong>OK.</strong><br />
<a href="http://operatingquadrant.com/2012/01/30/opsmgr-2012-unixlinux-authoring-templates-shell-command/dashboard-performance-widget-scope/" rel="attachment wp-att-740"><img class="alignnone size-medium wp-image-740" title="Dashboard Performance Widget Scope" src="http://operatingquadrant.files.wordpress.com/2012/01/dashboard-performance-widget-scope.png?w=400&#038;h=293" alt="" width="400" height="293" /></a></li>
<li>Under <strong>Select performance counters</strong> click <strong>Add</strong>. Select the <strong>Object</strong> (<em>BIND Server</em>), <strong>Counter </strong>(<em>Name Resolution Time (s)</em>), and select (<em>All</em>) for <strong>Instance</strong>.  Click <strong>Add</strong> to add the performance counter and click <strong>OK</strong>.<br />
<a href="http://operatingquadrant.com/2012/01/30/opsmgr-2012-unixlinux-authoring-templates-shell-command/dashboard-performance-widget-counters/" rel="attachment wp-att-739"><img class="alignnone size-medium wp-image-739" title="Dashboard Performance Widget Counters" src="http://operatingquadrant.files.wordpress.com/2012/01/dashboard-performance-widget-counters.png?w=400&#038;h=424" alt="" width="400" height="424" /></a><br />
<em>Note: only performance counters that have been collected will show up in this list. If you created the rule in the past few minutes and don’t see it listed yet, wait a little bit longer.</em></li>
<li>Select the <strong>Time Range</strong> and <strong>Display Options</strong> and complete the wizard.</li>
</ul>
<h4>Adding the Alert Widget</h4>
<ul>
<li>Click <strong>Click to add widget</strong> in the bottom rectangle. Select <strong>Alert Widget</strong> and click <strong>Next</strong>.<br />
<a href="http://operatingquadrant.com/2012/01/30/opsmgr-2012-unixlinux-authoring-templates-shell-command/dashboard-alert-widget/" rel="attachment wp-att-736"><img class="alignnone size-medium wp-image-736" title="Dashboard Alert Widget" src="http://operatingquadrant.files.wordpress.com/2012/01/dashboard-alert-widget.png?w=400&#038;h=293" alt="" width="400" height="293" /></a></li>
<li> Input a <strong>Name</strong> and <strong>Description</strong> and click <strong>Next</strong>.<br />
<a href="http://operatingquadrant.com/2012/01/30/opsmgr-2012-unixlinux-authoring-templates-shell-command/dashboard-alert-widget-name-and-description/" rel="attachment wp-att-735"><img class="alignnone size-medium wp-image-735" title="Dashboard Alert Widget Name and Description" src="http://operatingquadrant.files.wordpress.com/2012/01/dashboard-alert-widget-name-and-description.png?w=400&#038;h=293" alt="" width="400" height="293" /></a></li>
<li>Under <strong>Select a group or object</strong> click <strong>[…]</strong>, find and selecd the BIND servers group and click <strong>OK</strong>.<br />
<a href="http://operatingquadrant.com/2012/01/30/opsmgr-2012-unixlinux-authoring-templates-shell-command/dashboard-alert-widget-group-selection/" rel="attachment wp-att-734"><img class="alignnone size-medium wp-image-734" title="Dashboard Alert Widget Group Selection" src="http://operatingquadrant.files.wordpress.com/2012/01/dashboard-alert-widget-group-selection.png?w=400&#038;h=424" alt="" width="400" height="424" /></a></li>
<li>Specify the criteria.  Be sure to filter for only the <strong>New</strong> resolution state if you just want to see active alerts. Click <strong>Next</strong>.<br />
<a href="http://operatingquadrant.com/2012/01/30/opsmgr-2012-unixlinux-authoring-templates-shell-command/dashboard-alert-widget-criteria/" rel="attachment wp-att-733"><img class="alignnone size-medium wp-image-733" title="Dashboard Alert Widget Criteria" src="http://operatingquadrant.files.wordpress.com/2012/01/dashboard-alert-widget-criteria.png?w=400&#038;h=293" alt="" width="400" height="293" /></a></li>
<li>Configure <strong>Display Preferences</strong> and complete the wizard.</li>
</ul>
<p>The end result is a dashboard showing health and performance of monitored BIND servers:</p>
<p><a href="http://operatingquadrant.com/2012/01/30/opsmgr-2012-unixlinux-authoring-templates-shell-command/completed-dashboard/" rel="attachment wp-att-732"><img class="alignnone size-medium wp-image-732" title="Completed Dashboard" src="http://operatingquadrant.files.wordpress.com/2012/01/completed-dashboard.png?w=400&#038;h=266" alt="" width="400" height="266" /></a></p>
<h3><strong>Summary</strong></h3>
<p>As you can see from this walkthrough, the new template wizards for UNIX/Linux monitoring in OpsMgr 2012 are a significant improvement and make custom monitoring far easier to implement!<strong><br />
</strong></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/operatingquadrant.wordpress.com/677/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/operatingquadrant.wordpress.com/677/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/operatingquadrant.wordpress.com/677/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/operatingquadrant.wordpress.com/677/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/operatingquadrant.wordpress.com/677/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/operatingquadrant.wordpress.com/677/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/operatingquadrant.wordpress.com/677/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/operatingquadrant.wordpress.com/677/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/operatingquadrant.wordpress.com/677/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/operatingquadrant.wordpress.com/677/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/operatingquadrant.wordpress.com/677/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/operatingquadrant.wordpress.com/677/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/operatingquadrant.wordpress.com/677/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/operatingquadrant.wordpress.com/677/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=operatingquadrant.com&amp;blog=8969466&amp;post=677&amp;subd=operatingquadrant&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://operatingquadrant.com/2012/01/30/opsmgr-2012-unixlinux-authoring-templates-shell-command/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/26f47dda05ea2d756f1f83f1164605aa?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">KB</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2012/01/createthemp.png?w=400" medium="image">
			<media:title type="html">Create the MP</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2012/01/createthegroup.png?w=400" medium="image">
			<media:title type="html">Create the Group</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2012/01/add-group-members.png?w=400" medium="image">
			<media:title type="html">Add Group Members</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2012/01/create-a-task.png?w=400" medium="image">
			<media:title type="html">Create a Task</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2012/01/task-name-and-description.png?w=400" medium="image">
			<media:title type="html">Task - Name and Description</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2012/01/task-shell-command-details.png?w=400" medium="image">
			<media:title type="html">Task - Shell Command Details</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2012/01/process-add-monitoring-wizard.png?w=400" medium="image">
			<media:title type="html">Process Add Monitoring Wizard</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2012/01/process-template-name-and-description.png?w=400" medium="image">
			<media:title type="html">Process Template Name and Description</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2012/01/process-template-details.png?w=400" medium="image">
			<media:title type="html">Process Template Details</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2012/01/process-template-settings.png?w=400" medium="image">
			<media:title type="html">Process Template Settings</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2012/01/create-a-shell-command-monitor.png?w=400" medium="image">
			<media:title type="html">Create a Shell Command Monitor</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2012/01/shell-command-monitor-name-and-description.png?w=400" medium="image">
			<media:title type="html">Shell Command Monitor Name and Description</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2012/01/shell-command-monitor-scheduler.png?w=400" medium="image">
			<media:title type="html">Shell Command Monitor Scheduler</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2012/01/shell-command-monitor-details.png?w=400" medium="image">
			<media:title type="html">Shell Command Monitor Details</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2012/01/shell-command-monitor-error-expression.png?w=400" medium="image">
			<media:title type="html">Shell Command Monitor Error Expression</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2012/01/shell-command-monitor-healthy-expression.png?w=400" medium="image">
			<media:title type="html">Shell Command Monitor Healthy Expression</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2012/01/shell-command-monitor-health-mapping.png?w=400" medium="image">
			<media:title type="html">Shell Command Monitor Health Mapping</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2012/01/shell-command-monitor-alert.png?w=400" medium="image">
			<media:title type="html">Shell Command Monitor Alert</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2012/01/find-the-monitor1-e1327557772379.png?w=400" medium="image">
			<media:title type="html">Find the Monitor</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2012/01/select-the-group.png?w=400" medium="image">
			<media:title type="html">Select the group</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2012/01/monitor-override.png?w=400" medium="image">
			<media:title type="html">Monitor override</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2012/01/create-a-shell-command-rule.png?w=400" medium="image">
			<media:title type="html">Create a Shell Command Rule</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2012/01/shell-command-rule-name-and-description.png?w=400" medium="image">
			<media:title type="html">Shell Command Rule Name and Description</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2012/01/shell-command-rule-scheduler.png?w=400" medium="image">
			<media:title type="html">Shell Command Rule Scheduler</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2012/01/shell-command-rule-details.png?w=400" medium="image">
			<media:title type="html">Shell Command Rule Details</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2012/01/shell-command-rule-filter.png?w=400" medium="image">
			<media:title type="html">Shell Command Rule Filter</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2012/01/shell-command-rule-mapper.png?w=400" medium="image">
			<media:title type="html">Shell Command Rule Mapper</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2012/01/find-the-rule-e1327591561234.png?w=400" medium="image">
			<media:title type="html">Find the Rule</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2012/01/select-the-group.png?w=400" medium="image">
			<media:title type="html">Select the group</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2012/01/override-the-rule.png?w=400" medium="image">
			<media:title type="html">Override the Rule</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2012/01/mp-folder-e1327591937989.png?w=320" medium="image">
			<media:title type="html">MP Folder</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2012/01/dashboard-grid-layout.png?w=400" medium="image">
			<media:title type="html">Dashboard Grid Layout</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2012/01/dashboard-name-and-description.png?w=400" medium="image">
			<media:title type="html">Dashboard Name and Description</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2012/01/dashboard-cells.png?w=400" medium="image">
			<media:title type="html">Dashboard Cells</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2012/01/dashboard-state-widget.png?w=400" medium="image">
			<media:title type="html">Dashboard State Widget</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2012/01/dashboard-state-widget-name-and-description.png?w=400" medium="image">
			<media:title type="html">Dashboard State Widget Name and Description</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2012/01/dashboard-group-filter.png?w=400" medium="image">
			<media:title type="html">Dashboard Group Filter</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2012/01/dashboard-performance-widget.png?w=400" medium="image">
			<media:title type="html">Dashboard Performance Widget</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2012/01/dashboard-performance-widget-name-and-description.png?w=400" medium="image">
			<media:title type="html">Dashboard Performance Widget Name and Description</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2012/01/dashboard-performance-widget-scope.png?w=400" medium="image">
			<media:title type="html">Dashboard Performance Widget Scope</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2012/01/dashboard-performance-widget-counters.png?w=400" medium="image">
			<media:title type="html">Dashboard Performance Widget Counters</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2012/01/dashboard-alert-widget.png?w=400" medium="image">
			<media:title type="html">Dashboard Alert Widget</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2012/01/dashboard-alert-widget-name-and-description.png?w=400" medium="image">
			<media:title type="html">Dashboard Alert Widget Name and Description</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2012/01/dashboard-alert-widget-group-selection.png?w=400" medium="image">
			<media:title type="html">Dashboard Alert Widget Group Selection</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2012/01/dashboard-alert-widget-criteria.png?w=400" medium="image">
			<media:title type="html">Dashboard Alert Widget Criteria</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2012/01/completed-dashboard.png?w=400" medium="image">
			<media:title type="html">Completed Dashboard</media:title>
		</media:content>
	</item>
		<item>
		<title>OpsMgr 2012 UNIX/Linux Authoring Templates:  Process Monitoring</title>
		<link>http://operatingquadrant.com/2012/01/27/opsmgr-2012-unixlinux-authoring-templates-process-monitoring/</link>
		<comments>http://operatingquadrant.com/2012/01/27/opsmgr-2012-unixlinux-authoring-templates-process-monitoring/#comments</comments>
		<pubDate>Fri, 27 Jan 2012 19:05:13 +0000</pubDate>
		<dc:creator>Kristopher Bash</dc:creator>
				<category><![CDATA[System Center Operations Manager]]></category>
		<category><![CDATA[UNIX/LInux]]></category>

		<guid isPermaLink="false">http://operatingquadrant.com/?p=655</guid>
		<description><![CDATA[In Operations Manager, custom rules and monitors can be used to extensively build on the out-of-the-box Management Pack contents. Unfortunately, this kind of custom authoring for UNIX/Linux monitoring carried a steep learning curve with OpsMgr 2007 R2. However, the 2012 release of Operations Manager has some new features to enable many common UNIX/Linux authoring scenarios [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=operatingquadrant.com&amp;blog=8969466&amp;post=655&amp;subd=operatingquadrant&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In Operations Manager, custom rules and monitors can be used to extensively build on the out-of-the-box Management Pack contents. Unfortunately, this kind of custom authoring for UNIX/Linux monitoring carried a steep learning curve with OpsMgr 2007 R2. However, the 2012 release of Operations Manager has some new features to enable many common UNIX/Linux authoring scenarios using templates, <em>directly from the console</em>.  The first of these new templates I wanted to cover is the new process monitoring template.</p>
<h3><strong>UNIX/Linux Process Monitoring Template</strong></h3>
<p>Operations Manager 2007 R2 included the Unix Service Monitoring template for custom monitoring of daemons on UNIX and Linux agents.   This template has been replaced in the System Center 2012 release of Operations Manager with the far more capable UNIX/Linux Process Monitoring template.   The new UNIX/Linux Process Monitoring template allows more flexibility in process/daemon monitoring, including the ability to monitor for minimum and maximum process count thresholds, and the ability to filter processes on arguments in addition to the process name. For this example, I will walk through the use the UNIX/Linux Process Monitoring template to monitor a Tomcat daemon.</p>
<p>The UNIX/Linux Process Monitoring template is accessible in the Authoring Pane of the Operations Console.   It can be launched with the “Add Monitoring Wizard” task under the Management Pack Templates view.</p>
<p><a href="http://operatingquadrant.com/2012/01/27/opsmgr-2012-unixlinux-authoring-templates-process-monitoring/template1/" rel="attachment wp-att-656"><img class="alignnone  wp-image-656" title="Process Template: Add Monitoring Wizard" src="http://operatingquadrant.files.wordpress.com/2012/01/template1.jpg?w=400&#038;h=257" alt="" width="400" height="257" /></a></p>
<p><span id="more-655"></span></p>
<p>Input a name, description, and select the target management pack (where the template-created MP elements will be saved).</p>
<p><a href="http://operatingquadrant.com/2012/01/27/opsmgr-2012-unixlinux-authoring-templates-process-monitoring/template2-2/" rel="attachment wp-att-663"><img class="alignnone size-medium wp-image-663" title="Process Template Name and Description" src="http://operatingquadrant.files.wordpress.com/2012/01/template21-e1327550026555.jpg?w=400&#038;h=318" alt="" width="400" height="318" /></a></p>
<p>The next page is the details page, where process information is input.   If you already know the process name, you can just type that in and select the group to target.  Alternatively, you can click <strong>Select a Process</strong> to connect to an agent and list the currently running processes.</p>
<p><a href="http://operatingquadrant.com/2012/01/27/opsmgr-2012-unixlinux-authoring-templates-process-monitoring/template3/" rel="attachment wp-att-664"><img class="alignnone size-medium wp-image-664" title="Process Template Details Page" src="http://operatingquadrant.files.wordpress.com/2012/01/template3-e1327550140140.png?w=400&#038;h=314" alt="" width="400" height="314" /></a></p>
<p>In this case, I will connect to an agent and enumerate the running processes.  The Tomcat daemon is a Java process, so I select the process named: <em>java</em>.</p>
<p><a href="http://operatingquadrant.com/2012/01/27/opsmgr-2012-unixlinux-authoring-templates-process-monitoring/template4/" rel="attachment wp-att-665"><img class="alignnone size-medium wp-image-665" title="Process Template Details Page 2" src="http://operatingquadrant.files.wordpress.com/2012/01/template4-e1327550327767.png?w=400&#038;h=316" alt="" width="400" height="316" /></a></p>
<p>In the bottom field of the details dialog, the running processes on the agent that match the selected name are listed.   This particular agent is also running WebSphere, and its process also has the name: java, which is why two java processes are listed in this field.   As I only want to monitor the Tomcat daemon with this particular monitor, I don’t want the WebSphere process to affect the monitoring.   While the two processes share the same name, they have different process arguments.  The <strong>Regular expression to filter process arguments</strong> field allows me to input a regular expression that will be evaluated against the process arguments.   Only processes that match the regular expression will be included in this monitor.   So, I can input a regular expression of <strong>^.+tomcat.+</strong> and only processes with a name of “java” that have the string: tomcat in their arguments list will be evaluated by the monitor.   The wizard filters the list of running processes on the fly to show what will be evaluated with a given regular expression.</p>
<p>A few notes on this functionality:</p>
<ul>
<li>The regular expression filtering by arguments is an optional function.  If you just want to monitor processes by name, you can leave this field blank.</li>
<li>The regular expression is evaluated against all arguments as one long string.  That is, the arguments (argv[0] – argv[&lt;max&gt;]) are concatenated with a  space separator, and the regular expression is evaluated against this concatenated string.</li>
<li>The regular expression filtering is performed on the Windows-side (Health Service), not on the UNIX/Linux agent. Thus, .NET regular expressions are used (this differs from the log file monitoring template where the regular expression matching is performed on the UNIX/Linux agent).</li>
<li>If you know the regular expression that you want to use, and you are targeting a group, you can just select a group, and type the process name and regular expression into the field without connecting to an agent.   However, if you want to test the regular expression in the wizard, you need to use the <strong>Select a process</strong> function to connect to an agent and list running processes that match the selected name.   Once you are satisfied with the arguments filter, you can retarget the monitor to a group by clicking <strong>Select a group</strong>.    The filtering by arguments functionality works whether you are targeting a single agent or a group, but testing it requires connecting to an agent to list the running processes.</li>
</ul>
<p><a href="http://operatingquadrant.com/2012/01/27/opsmgr-2012-unixlinux-authoring-templates-process-monitoring/template5/" rel="attachment wp-att-666"><img class="alignnone size-medium wp-image-666" title="Process Template Details Page 3" src="http://operatingquadrant.files.wordpress.com/2012/01/template5-e1327550478428.png?w=400&#038;h=311" alt="" width="400" height="311" /></a></p>
<p><a href="http://operatingquadrant.com/2012/01/27/opsmgr-2012-unixlinux-authoring-templates-process-monitoring/template6/" rel="attachment wp-att-667"><img class="alignnone size-medium wp-image-667" title="Process Template Details Page 4" src="http://operatingquadrant.files.wordpress.com/2012/01/template6-e1327550591950.png?w=400&#038;h=312" alt="" width="400" height="312" /></a></p>
<p>On the next page, optional minimum and maximum thresholds can be set for the acceptable count of processes that match the name and optional arguments filter.  For example, to monitor that at least one instance of a process is running, set a minimum threshold of 1, to alert if any instances of a process are running, set a maximum threshold of 0.  To monitor that no less than 5 and no more than 10 instances of a process is running, set a minimum threshold of 5 and a maximum of 10.   Note:  the process count is calculated after the optional arguments filter is applied.   So in this example, the WebSphere “java” process will not be included in the process count, because the ^.+tomcat.+ filter was applied to the arguments.</p>
<p><a href="http://operatingquadrant.com/2012/01/27/opsmgr-2012-unixlinux-authoring-templates-process-monitoring/template7/" rel="attachment wp-att-668"><img class="alignnone size-medium wp-image-668" title="Process Template Settings Page" src="http://operatingquadrant.files.wordpress.com/2012/01/template7-e1327550705956.png?w=400&#038;h=319" alt="" width="400" height="319" /></a></p>
<p>All done:</p>
<p><a href="http://operatingquadrant.com/2012/01/27/opsmgr-2012-unixlinux-authoring-templates-process-monitoring/template8/" rel="attachment wp-att-669"><img class="alignnone size-medium wp-image-669" title="Process Template Summary Page" src="http://operatingquadrant.files.wordpress.com/2012/01/template8-e1327551034163.png?w=400&#038;h=312" alt="" width="400" height="312" /></a></p>
<p>When I kill the Tomcat daemon, this is what the alert looks like:</p>
<p><a href="http://operatingquadrant.com/2012/01/27/opsmgr-2012-unixlinux-authoring-templates-process-monitoring/template9/" rel="attachment wp-att-670"><img class="alignnone size-medium wp-image-670" title="Process Template Alert" src="http://operatingquadrant.files.wordpress.com/2012/01/template9-e1327551136746.png?w=400&#038;h=368" alt="" width="400" height="368" /></a></p>
<p><strong>Note:</strong></p>
<p>Despite similar functionality to the Unix Service Template from 2007 R2, the new UNIX/Linux Process Monitoring template is an entirely new template. If you are upgrading from 2007 R2 to 2012, both templates will be available. To make use of the new functionality in the process template, you will need to create new instances to replace the previous instances created by the Unix Service Template.</p>
<h3>Performance and Cookdown Considerations</h3>
<p>Each unique process name that is specified in a process template will involve one WSMan query to the agent per polling interval.  Multiple template instances that inspect a single process name but implement unique regular expression filtering will cookdown into a single WSMan query to the agent per polling interval. For example, if ten process template instances target a single host and all monitor a process named java with distinct process argument filters (RegExp), only one WSMan query will be sent to the agent per polling interval.  If ten process template instances target a single host and each monitors a unique process name (processA, processB, etc.), ten WSMan queries will be sent to the agent per polling interval.</p>
<p>In cases where a large number of unique process names need to be monitored, process argument filtering is not required, and the monitored agents do not have a large number of running processes (with sizable parameter strings), custom MP authoring can be used to create a cookdown-optimized monitor type that enumerates SCX_UnixProcess with the filter: Select Name, Parameters from SCX_UnixProcess. This would allow all of the process monitors to cookdown to a single WSMan query assuming all other configuration parameters (such as Interval) are aligned.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/operatingquadrant.wordpress.com/655/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/operatingquadrant.wordpress.com/655/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/operatingquadrant.wordpress.com/655/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/operatingquadrant.wordpress.com/655/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/operatingquadrant.wordpress.com/655/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/operatingquadrant.wordpress.com/655/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/operatingquadrant.wordpress.com/655/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/operatingquadrant.wordpress.com/655/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/operatingquadrant.wordpress.com/655/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/operatingquadrant.wordpress.com/655/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/operatingquadrant.wordpress.com/655/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/operatingquadrant.wordpress.com/655/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/operatingquadrant.wordpress.com/655/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/operatingquadrant.wordpress.com/655/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=operatingquadrant.com&amp;blog=8969466&amp;post=655&amp;subd=operatingquadrant&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://operatingquadrant.com/2012/01/27/opsmgr-2012-unixlinux-authoring-templates-process-monitoring/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/26f47dda05ea2d756f1f83f1164605aa?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">KB</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2012/01/template1.jpg?w=400" medium="image">
			<media:title type="html">Process Template: Add Monitoring Wizard</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2012/01/template21-e1327550026555.jpg?w=400" medium="image">
			<media:title type="html">Process Template Name and Description</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2012/01/template3-e1327550140140.png?w=400" medium="image">
			<media:title type="html">Process Template Details Page</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2012/01/template4-e1327550327767.png?w=400" medium="image">
			<media:title type="html">Process Template Details Page 2</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2012/01/template5-e1327550478428.png?w=400" medium="image">
			<media:title type="html">Process Template Details Page 3</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2012/01/template6-e1327550591950.png?w=400" medium="image">
			<media:title type="html">Process Template Details Page 4</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2012/01/template7-e1327550705956.png?w=400" medium="image">
			<media:title type="html">Process Template Settings Page</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2012/01/template8-e1327551034163.png?w=400" medium="image">
			<media:title type="html">Process Template Summary Page</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2012/01/template9-e1327551136746.png?w=400" medium="image">
			<media:title type="html">Process Template Alert</media:title>
		</media:content>
	</item>
		<item>
		<title>OpsMgr: UNIX/Linux Heartbeat Failures After Applying KB2585542</title>
		<link>http://operatingquadrant.com/2012/01/12/opsmgr-unixlinux-heartbeat-failures-after-applying-kb2585542/</link>
		<comments>http://operatingquadrant.com/2012/01/12/opsmgr-unixlinux-heartbeat-failures-after-applying-kb2585542/#comments</comments>
		<pubDate>Thu, 12 Jan 2012 22:27:14 +0000</pubDate>
		<dc:creator>Kristopher Bash</dc:creator>
				<category><![CDATA[SCOM]]></category>
		<category><![CDATA[SCX]]></category>
		<category><![CDATA[System Center Operations Manager]]></category>
		<category><![CDATA[UNIX/LInux]]></category>

		<guid isPermaLink="false">http://operatingquadrant.com/?p=644</guid>
		<description><![CDATA[The OpsMgr UNIX/Linux monitoring team at Microsoft is currently investigating an issue that results in heartbeat failures on Operations Manager UNIX/Linux agents after the security update KB2585542 is applied to a Management Server or Gateway.  This update fixes a vulnerability in SSL/TLS1.0, but appears to cause WS-Management connections to UNIX/Linux agents to fail.  The vulnerability is described [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=operatingquadrant.com&amp;blog=8969466&amp;post=644&amp;subd=operatingquadrant&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The OpsMgr UNIX/Linux monitoring team at Microsoft is currently investigating an issue that results in heartbeat failures on Operations Manager UNIX/Linux agents after the security update KB2585542 is applied to a Management Server or Gateway.  This update fixes a vulnerability in SSL/TLS1.0, but appears to cause WS-Management connections to UNIX/Linux agents to fail. </p>
<p>The vulnerability is described in bulletin <a href="http://technet.microsoft.com/en-us/security/bulletin/ms12-006">MS12-006</a>, and more information can be found in the <a href="http://support.microsoft.com/kb/2643584">KB article</a>.  While we continue to investigate options for resolving this issue, there are two viable workarounds (which must be applied to all Mgmt Servers and Gateways that manage UNIX/Linux agents):</p>
<ol>
<li>Uninstall the update KB2585542 </li>
<li>Make a registry modification to disable the SecureChannel changes implemented in the update</li>
</ol>
<p>Note: the registry modification described here and in the KB article effectively disables the security fix that the update implements, so the modified system is subject to the same vulnerability as an unpatched system.</p>
<p><strong>Modifying the registry to disable the SecureChannel changes:</strong></p>
<ul>
<li>A &#8220;FixIt&#8221; package is available in the <a href="http://support.microsoft.com/kb/2643584">KB article</a> under the <strong>Known Issues</strong> section that can be used to disable the security update</li>
<li>Alternatively, you can add the 32bit DWORD value:<br />
<em>HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control<br />
\SecurityProviders\SCHANNEL\</em><br />
<em> SendExtraRecord = 2</em></li>
</ul>
<p>These changes take effect immediately and do not require a reboot.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/operatingquadrant.wordpress.com/644/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/operatingquadrant.wordpress.com/644/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/operatingquadrant.wordpress.com/644/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/operatingquadrant.wordpress.com/644/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/operatingquadrant.wordpress.com/644/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/operatingquadrant.wordpress.com/644/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/operatingquadrant.wordpress.com/644/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/operatingquadrant.wordpress.com/644/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/operatingquadrant.wordpress.com/644/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/operatingquadrant.wordpress.com/644/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/operatingquadrant.wordpress.com/644/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/operatingquadrant.wordpress.com/644/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/operatingquadrant.wordpress.com/644/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/operatingquadrant.wordpress.com/644/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=operatingquadrant.com&amp;blog=8969466&amp;post=644&amp;subd=operatingquadrant&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://operatingquadrant.com/2012/01/12/opsmgr-unixlinux-heartbeat-failures-after-applying-kb2585542/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/26f47dda05ea2d756f1f83f1164605aa?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">KB</media:title>
		</media:content>
	</item>
		<item>
		<title>Operations Manager UNIX/Linux Agent Certificates (and using a PKI)</title>
		<link>http://operatingquadrant.com/2011/11/23/operations-manager-unixlinux-agent-certificates-and-using-a-pki/</link>
		<comments>http://operatingquadrant.com/2011/11/23/operations-manager-unixlinux-agent-certificates-and-using-a-pki/#comments</comments>
		<pubDate>Wed, 23 Nov 2011 05:05:01 +0000</pubDate>
		<dc:creator>Kristopher Bash</dc:creator>
				<category><![CDATA[System Center Operations Manager]]></category>
		<category><![CDATA[UNIX]]></category>
		<category><![CDATA[UNIX/LInux]]></category>

		<guid isPermaLink="false">http://operatingquadrant.com/?p=638</guid>
		<description><![CDATA[Introduction UNIX and Linux agent monitoring in Operations Manager requires certificates to secure the SSL communication channel between the Management Servers and agents.  In this post, I will provide some background information on this communication and the certificates, as well as describe an optional approach to replace the default Operations Manager certificate infrastructure with your organization’s [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=operatingquadrant.com&amp;blog=8969466&amp;post=638&amp;subd=operatingquadrant&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2>Introduction</h2>
<p>UNIX and Linux agent monitoring in Operations Manager requires certificates to secure the SSL communication channel between the Management Servers and agents.  In this post, I will provide some background information on this communication and the certificates, as well as describe an optional approach to replace the default Operations Manager certificate infrastructure with your organization’s Public Key Infrastructure.</p>
<h2>The Protocols</h2>
<p>The Operations Manager UNIX/Linux agent is a very lightweight agent implementation, comprising a CIM Object Manager (OpenPegasus) and CIM Providers.   Unlike Operations Manager Windows agents, the UNIX/Linux agent doesn’t have a health service, and doesn’t run workflows locally.  Rather, the Management Server (or Gateway) that manages the agent runs the workflows and remotely connects to the UNIX/Linux agent to retrieve current data.  </p>
<p>There are two protocols involved in the communication between the Management Server and the UNIX/Linux agent:  ssh and WS-Management.   </p>
<p>Ssh is used purely for agent maintenance activities, and is not used for any monitoring.   Operations like agent installation, uninstallation, upgrade, or agent daemon restart (through a recovery task) are executed over ssh.    Ssh facilitates the transfer of files and execution of remote commands for these operations when the agent daemon is unavailable.  </p>
<p>WS-Management (or WSMan) is the core protocol used in UNIX/Linux monitoring.   WSMan is a SOAP-based protocol for cross-platform management.   All monitoring operations (e.g. enumerating CIM providers for data on file systems, memory, etc, execution of commands/scripts for monitoring, executing log file reads for monitoring) are implemented over WSMan.   As WSMan is a web service protocol, the OpenPegasus-based CIMOM functions as a secure web server (user credentials are authenticated through PAM).  This is where the agent certificate comes in to play.</p>
<h2>The Certificate</h2>
<p>The UNIX/Linux agent certificate is quite simply used to secure the WSMan connection using SSL and provide authentication for the remote agent host.   The requirements for this certificate are:</p>
<ul>
<li>The certificate is a server authentication certificate (Enhanced Key Usage: 1.3.6<strong>.</strong>1.5.5.7.3.1)</li>
<li>The CN of the certificate matches the FQDN that the Management Server uses to connect to the agent</li>
<li>The certificate is signed by a trusted authority (and can be checked for revocation)</li>
</ul>
<p>When the Operations Manager UNIX/Linux agent is installed, it generates a certificate (using openssl) at the path:  /etc/opt/microsoft/ssl.  The file name of the certificate is scx-host-&lt;hostname&gt;.pem and the corresponding private key is named scx-key.pem.   The agent actually looks for the certificate at /etc/opt/microsoft/scx/ssl/scx.pem, which is initially configured as a symbolic link pointing to scx-host-&lt;hostname&gt;.pem.</p>
<p>Upon initial agent installation, the certificate is not signed, and is not usable for securing the WSMan SSL communication.</p>
<p>Note:  when initially creating the certificate, the agent attempts to determine the agent hostname for use as the CN value of the certificate.   In cases where the DNS name known to the local host does not match the FQDN that OpsMgr will use to communicate with the agent, additional steps are required to establish a valid certificate.  More information can be found here: <a href="http://technet.microsoft.com/en-us/library/dd891009.aspx">http://technet.microsoft.com/en-us/library/dd891009.aspx</a></p>
<h2>Certificates and Management Servers</h2>
<p>When a Management Server discovers a UNIX or Linux agent, the server uses its certificate to sign the agent certificate, acting like a standalone Certificate Authority.  In the discovery process, this actually involves securely transferring the certificate from the agent to the Management Server, signing it, copying it back to the agent, and restarting the agent daemon.  </p>
<p>In order to move an agent between Management Servers, the new Management Server must trust the certificate that was used to sign the agent’s certificate.  This becomes particularly important in the 2012 version of Operations Manager, where agents will move automatically between the Management Servers that are members of the Resource Pool managing the agent.  For more information on the procedure to trust a server’s certificate from another server, review this document: <a href="http://technet.microsoft.com/en-us/library/hh287152.aspx">http://technet.microsoft.com/en-us/library/hh287152.aspx</a>.</p>
<h2>Using a PKI Instead of Management Servers for Signing</h2>
<p>Because the certificates used for securing the agent SSL channel are not proprietary, a separate Public Key Infrastructure can be used to manage the agent certificates, if the PKI option is appealing for your organization.  While this requires some additional resources in the environment (a Certificate Authority) and customization, there are a few benefits to using a PKI: </p>
<ul>
<li>Certificate policies are controlled by the PKI and customizable to meet your organization’s security requirements</li>
<li>Migrations of agents between Management Servers (within or between Resource Pools) can be done without exporting/importing Management Server certificates – simplifying the provisioning of Management Servers.</li>
<li>More options exist for automation of agent deployment and certificate signing</li>
</ul>
<p>The procedure to use a PKI instead of Management Server signed certificates varies with different requirements and environments, but I will describe the steps required for one example approach.  This example assumes that the Certificate Authority is a Windows 2008 Certificate Authority. </p>
<p><strong>Prerequisites:</strong></p>
<ol>
<li>Configure the certificate template on the Certificate Authority – you can use the “Web Server” template or a copy of it – configure options and permissions, publish the template.</li>
<li>Import the CA certificate from the signing CA  to the trusted authorities list <em>on every management server</em>that will manage the UNIX/Linux agents:
<ol>
<li>certutil -f -config &#8220;&lt;CAHostname&gt;\&lt;CAName&gt;&#8221; -ca.cert &lt;CACertFile&gt;</li>
<li>certutil -addstore Root &lt;CACertFile&gt;</li>
</ol>
</li>
</ol>
<p><strong>Per-Agent steps:</strong></p>
<ol>
<li>Install the agent – this can be done through the OpsMgr Discovery Wizard, manually, or with another package distribution tool.  If you use the OpsMgr Discovery Wizard to install the agent, the agent will generate a certificate that is signed by the management server, but this can be replaced with your PKI CA signed certificate.</li>
<li>Generate a cert signing request – either create a new private key with OpenSSL or use the private key generated during the agent install</li>
<ol>
<li><em>a.      </em>Command to generate a CSR using the key generated during agent install:<br />
openssl req -new -key /etc/opt/microsoft/scx/ssl/scx-key.pem  -subj /CN=&lt;FQDN of agent host&gt; -text -out &lt;OutputPath&gt;<em></em></li>
<li><em>3.       </em>Copy the CSR back to a Windows machine<em></em></li>
<li><em>4.       </em>Submit the CSR to the CA – this command assumes auto-enrollment is enabled and authorized:<em></em></li>
<ol>
<li>certreq.exe -submit -config &lt;CAHostName&gt;\&lt;CAName&gt; -attrib &#8220;CertificateTemplate:&lt;TemplateName&gt;” &lt;CSR FileName&gt; &lt;OutputCertName&gt;</li>
<li>Copy the signed cert back to the UNIX/Linux agent using  a secure copy method.  If auto-enrollment was used in step 4, the value for &lt;OutputCertName&gt;  specifies the file name of the signed certificate to copy to the agent.</li>
<li>Update the symbolic link: /etc/opt/microsoft/scx/ssl/scx.pem to point to your new signed certificate</li>
<li>Restart the agent:  /opt/microsoft/scx/bin/tools/scxadmin –restart</li>
<li>Discover the agent using the Operations Console or PowerShell Cmdlet</li>
</ol>
</ol>
</ol>
<h3>Automation and Customization Opportunities</h3>
<p>All of the per-agent steps described above can be executed from a command line, meaning that this procedure can be automated through scripting.  Using a script on a Windows server, the UNIX/Linux commands and file copying actions can be executed with SSH utilities like PuTTY’s plink and pscp.  For really robust automation capabilities, all of the steps can be implemented in a PowerShell script – I like the plink.exe integration example described on this blog: <a href="http://www.christowles.com/2011/06/how-to-ssh-from-powershell-using.html">http://www.christowles.com/2011/06/how-to-ssh-from-powershell-using.html</a>.</p>
<p>Aside from the primary benefits of automating these steps in terms of reducing manual interactions, other customization opportunities are exposed with using this scripting approach.  For example, if your DNS infrastructure and UNIX/Linux agent hostnames don’t neatly correlate, you could modify step 2 of the per-agent steps to also generate a new certificate with openssl using the desired FQDN as the certificate’s CN (<a href="http://technet.microsoft.com/en-us/library/dd891009.aspx">http://technet.microsoft.com/en-us/library/dd891009.aspx</a>).  Alternatively, if you are using Operations Manager 2007 R2 and want to implement agent deployment and certificate signing using sudo elevation instead of root credentials, the UNIX/Linux host commands in the per-agent steps could be prepended with the sudo command (this functionality is built into the 2012 version of Operations Manager).</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/operatingquadrant.wordpress.com/638/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/operatingquadrant.wordpress.com/638/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/operatingquadrant.wordpress.com/638/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/operatingquadrant.wordpress.com/638/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/operatingquadrant.wordpress.com/638/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/operatingquadrant.wordpress.com/638/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/operatingquadrant.wordpress.com/638/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/operatingquadrant.wordpress.com/638/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/operatingquadrant.wordpress.com/638/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/operatingquadrant.wordpress.com/638/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/operatingquadrant.wordpress.com/638/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/operatingquadrant.wordpress.com/638/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/operatingquadrant.wordpress.com/638/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/operatingquadrant.wordpress.com/638/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=operatingquadrant.com&amp;blog=8969466&amp;post=638&amp;subd=operatingquadrant&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://operatingquadrant.com/2011/11/23/operations-manager-unixlinux-agent-certificates-and-using-a-pki/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/26f47dda05ea2d756f1f83f1164605aa?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">KB</media:title>
		</media:content>
	</item>
		<item>
		<title>Operations Manager Releases</title>
		<link>http://operatingquadrant.com/2011/08/18/operations-manager-releases/</link>
		<comments>http://operatingquadrant.com/2011/08/18/operations-manager-releases/#comments</comments>
		<pubDate>Thu, 18 Aug 2011 16:25:30 +0000</pubDate>
		<dc:creator>Kristopher Bash</dc:creator>
				<category><![CDATA[System Center Operations Manager]]></category>
		<category><![CDATA[UNIX]]></category>

		<guid isPermaLink="false">http://operatingquadrant.com/?p=633</guid>
		<description><![CDATA[In case you missed it&#8230; Operations Manager 2012 Beta http://www.microsoft.com/systemcenter/en/us/om-vnext-beta.aspx Operations Manager 2012 Beta is available.   Exciting new features for UNIX/Linux monitoring include: Discovery Wizard:  All new Discovery Wizard, making it easier to deploy and discover UNIX and Linux agents Sudo support:  Privileged operations (monitoring and agent maintenance) can now be performed without root privileges [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=operatingquadrant.com&amp;blog=8969466&amp;post=633&amp;subd=operatingquadrant&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In case you missed it&#8230;</p>
<h2><strong>Operations Manager 2012 Beta</strong></h2>
<p><a href="http://www.microsoft.com/systemcenter/en/us/om-vnext-beta.aspx">http://www.microsoft.com/systemcenter/en/us/om-vnext-beta.aspx</a></p>
<p>Operations Manager 2012 Beta is available.   Exciting new features for UNIX/Linux monitoring include:</p>
<ul>
<li>Discovery Wizard:  All new Discovery Wizard, making it easier to deploy and discover UNIX and Linux agents</li>
<li>Sudo support:  Privileged operations (monitoring and agent maintenance) can now be performed <em>without</em> root privileges by using a non-privileged credential and sudo elevation.</li>
<li>SSH Key support:  Agent maintenance operations (via SSH) can be authenticated with an SSH key instead of password</li>
<li>High Availability for UNIX/Linux agent monitoring:   Resource Pools implement highly-available UNIX/Linux monitoring with automatic failover and load distribution.</li>
<li>RHEL 6 and AIX 7.1 support</li>
</ul>
<h2><strong>Operations Manager 2007 R2 CU5</strong></h2>
<p><a href="http://support.microsoft.com/kb/2495674">http://support.microsoft.com/kb/2495674</a></p>
<p>Operations Manager 2007 R2 Cumulative Update 5 is also now available.   Fixes for UNIX/Linux monitoring include:</p>
<ul>
<li>Performance data for LVM managed volumes not available</li>
<li>Process monitoring does not keep name if run by using symbolic link</li>
<li>AIX with large number of running processes crashes with bad alloc</li>
</ul>
<p>CU5 also implements RHEL 6 support for Operations Manager 2007 R2.</p>
<p>&nbsp;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/operatingquadrant.wordpress.com/633/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/operatingquadrant.wordpress.com/633/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/operatingquadrant.wordpress.com/633/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/operatingquadrant.wordpress.com/633/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/operatingquadrant.wordpress.com/633/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/operatingquadrant.wordpress.com/633/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/operatingquadrant.wordpress.com/633/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/operatingquadrant.wordpress.com/633/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/operatingquadrant.wordpress.com/633/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/operatingquadrant.wordpress.com/633/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/operatingquadrant.wordpress.com/633/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/operatingquadrant.wordpress.com/633/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/operatingquadrant.wordpress.com/633/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/operatingquadrant.wordpress.com/633/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=operatingquadrant.com&amp;blog=8969466&amp;post=633&amp;subd=operatingquadrant&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://operatingquadrant.com/2011/08/18/operations-manager-releases/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/26f47dda05ea2d756f1f83f1164605aa?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">KB</media:title>
		</media:content>
	</item>
		<item>
		<title>Operations Manager – Extending UNIX/Linux Monitoring with MP Authoring – Part IV</title>
		<link>http://operatingquadrant.com/2011/03/27/operations-manager-%e2%80%93-extending-unixlinux-monitoring-with-mp-authoring-%e2%80%93-part-iv/</link>
		<comments>http://operatingquadrant.com/2011/03/27/operations-manager-%e2%80%93-extending-unixlinux-monitoring-with-mp-authoring-%e2%80%93-part-iv/#comments</comments>
		<pubDate>Sun, 27 Mar 2011 23:06:10 +0000</pubDate>
		<dc:creator>Kristopher Bash</dc:creator>
				<category><![CDATA[Management Packs]]></category>
		<category><![CDATA[SCX]]></category>
		<category><![CDATA[System Center Operations Manager]]></category>
		<category><![CDATA[UNIX]]></category>

		<guid isPermaLink="false">http://operatingquadrant.com/?p=610</guid>
		<description><![CDATA[Introduction In Part III of this series, I walked through creation of data sources, a discovery, and a rule for discovering dynamically-named log files and implementing an alert-generating rule for log file monitoring.  In this post, I will continue to expand this Management Pack to implement performance collection rules, using WSMan Invoke methods to collect [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=operatingquadrant.com&amp;blog=8969466&amp;post=610&amp;subd=operatingquadrant&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h1>Introduction</h1>
<p>In Part III of this series, I walked through creation of data sources, a discovery, and a rule for discovering dynamically-named log files and implementing an alert-generating rule for log file monitoring.  In this post, I will continue to expand this Management Pack to implement performance collection rules, using WSMan Invoke methods to collect numerical performance data from a shell command. </p>
<h1>Using Shell Commands to Collect Performance Data</h1>
<p>Whether it is system performance data from the /proc or /sys file systems, or application performance metrics in other locations, performance data for UNIX and Linux systems can often be found in flat files.   In this example Management Pack, I wanted to demonstrate using a WSMan Invoke module with the script provider to gather a numeric value from a file and publish the data as performance data.   In many cases, this would be slightly more complex than is represented in this example (e.g. if the performance metric value should be the delta between data points in the file over time), but this example should provide the framework for using the contents of a file to drive performance collection rules.   The root of these workflows is a shell command using the cat command to parse the file, which could be piped to grep, awk, and sed to filter for specific lines and columns.  </p>
<p>Additionally, if the performance data (e.g. hardware temperature or fan speed, current application user or connection count) that you are looking for is not stored in a file, but available in the output of a utility command, the same method could be used by using the utility command instead of cat.</p>
<h2>Collecting Performance Data from a File</h2>
<p>In this example, the MyApp application stores three performance metrics in flat files in the subdirectory ./perf.   I have built three rules that cat these files, and map the values to performance data.  The three rules are functionally identical, so I will only describe one of them.</p>
<h3>Performance Collection Rule:  MyApp.Monitoring.Rule.CollectMyAppMem</h3>
<p><span id="more-610"></span></p>
<p>This rule collects the value from the ./perf/mem file in the application directory, which represents the current memory used by the application in KB.   The rule targets the MyApp.Monitoring.MyApp application class.</p>
<h4>Rule Data Source:</h4>
<p>The rule uses the MyApp.Monitoring.ShellCommandMonitoring data source, described in Post I of this series, with the configuration:</p>
<pre>&lt;Interval&gt;300&lt;/Interval&gt;
&lt;TargetSystem&gt;
$Target/Host/Property[Type="MicrosoftUnixLibrary!
Microsoft.Unix.Computer"]/NetworkName$&lt;/TargetSystem&gt;
&lt;ShellCommand&gt;
cat $Target/Property[Type="MyApp.Monitoring.MyApp"]
  /InstallPath$/perf/mem
&lt;/ShellCommand&gt;
&lt;Timeout&gt;120&lt;/Timeout&gt;</pre>
<p>Notice that the ShellCommand is our cat command:  <em>cat $Target/Property[Type="MyApp.Monitoring.MyApp"]/InstallPath$/perf/mem</em></p>
<h4>Rule Condition Detection:</h4>
<p>A System.Performance.DataGenericMapper is used as the condition detection module to map the StdOut to performance data, with the configuration:</p>
<pre>&lt;ObjectName&gt;
$Target/Property[Type="MyApp.Monitoring.MyApp"]
  /Name$
&lt;/ObjectName&gt;
&lt;CounterName&gt;Memory used (KB)&lt;/CounterName&gt;
&lt;InstanceName&gt;Total&lt;/InstanceName&gt;
&lt;Value&gt;
  $Data///*[local-name()="StdOut"]$
&lt;/Value&gt;</pre>
<h4>Write Actions:</h4>
<p>The rule defines two write actions:  Microsoft.SystemCenter.CollectPerformanceData and Microsoft.SystemCenter.DataWarehouse.PublishPerformanceData to collect the data and publish it to the DW.   These require no configuration.</p>
<p><a rel="attachment wp-att-612" href="http://operatingquadrant.com/2011/03/27/operations-manager-%e2%80%93-extending-unixlinux-monitoring-with-mp-authoring-%e2%80%93-part-iv/writeactions/"><img class="alignnone size-medium wp-image-612" title="writeactions" src="http://operatingquadrant.files.wordpress.com/2011/03/writeactions.png?w=400&#038;h=398" alt="" width="400" height="398" /></a></p>
<p>The end result is that the scheduled rule grabs the value from the text file, maps it to performance data, collects and publishes the performance data to the OM and DW databases.  This mechanism can be used for nearly any numerical performance metric that is accessible (in a timely fashion) from a shell command pipeline or script.</p>
<p><a rel="attachment wp-att-617" href="http://operatingquadrant.com/2011/03/27/operations-manager-%e2%80%93-extending-unixlinux-monitoring-with-mp-authoring-%e2%80%93-part-iv/perf/"><img class="alignnone size-medium wp-image-617" title="Memory Performance" src="http://operatingquadrant.files.wordpress.com/2011/03/perf-e1300740967244.jpg?w=400&#038;h=379" alt="" width="400" height="379" /></a></p>
<h3>Stay tuned for more in this series….</h3>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/operatingquadrant.wordpress.com/610/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/operatingquadrant.wordpress.com/610/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/operatingquadrant.wordpress.com/610/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/operatingquadrant.wordpress.com/610/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/operatingquadrant.wordpress.com/610/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/operatingquadrant.wordpress.com/610/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/operatingquadrant.wordpress.com/610/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/operatingquadrant.wordpress.com/610/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/operatingquadrant.wordpress.com/610/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/operatingquadrant.wordpress.com/610/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/operatingquadrant.wordpress.com/610/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/operatingquadrant.wordpress.com/610/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/operatingquadrant.wordpress.com/610/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/operatingquadrant.wordpress.com/610/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=operatingquadrant.com&amp;blog=8969466&amp;post=610&amp;subd=operatingquadrant&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://operatingquadrant.com/2011/03/27/operations-manager-%e2%80%93-extending-unixlinux-monitoring-with-mp-authoring-%e2%80%93-part-iv/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/26f47dda05ea2d756f1f83f1164605aa?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">KB</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2011/03/writeactions.png?w=400" medium="image">
			<media:title type="html">writeactions</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2011/03/perf-e1300740967244.jpg?w=400" medium="image">
			<media:title type="html">Memory Performance</media:title>
		</media:content>
	</item>
		<item>
		<title>Operations Manager – Extending UNIX/Linux Monitoring with MP Authoring – Part III</title>
		<link>http://operatingquadrant.com/2011/03/24/operations-manager-%e2%80%93-extending-unixlinux-monitoring-with-mp-authoring-%e2%80%93-part-iii/</link>
		<comments>http://operatingquadrant.com/2011/03/24/operations-manager-%e2%80%93-extending-unixlinux-monitoring-with-mp-authoring-%e2%80%93-part-iii/#comments</comments>
		<pubDate>Fri, 25 Mar 2011 03:45:10 +0000</pubDate>
		<dc:creator>Kristopher Bash</dc:creator>
				<category><![CDATA[Management Packs]]></category>
		<category><![CDATA[SCX]]></category>
		<category><![CDATA[System Center Operations Manager]]></category>
		<category><![CDATA[UNIX]]></category>

		<guid isPermaLink="false">http://operatingquadrant.com/?p=601</guid>
		<description><![CDATA[Introduction In Part II of this series, I walked through creation of data sources, a discovery, a monitor type, and a monitor for customized &#8221;Process Count&#8221; monitoring for discovered instances of a &#8221;Service&#8221; class. In this post, I will continue to build on this example MP to implement dynamic log file discovery and monitoring. Dynamic Log File Discovery and Monitoring ﻿﻿Log file [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=operatingquadrant.com&amp;blog=8969466&amp;post=601&amp;subd=operatingquadrant&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h1>Introduction</h1>
<p>In Part II of this series, I walked through creation of data sources, a discovery, a monitor type, and a monitor for customized &#8221;Process Count&#8221; monitoring for discovered instances of a &#8221;Service&#8221; class. In this post, I will continue to build on this example MP to implement dynamic log file discovery and monitoring.</p>
<h1>Dynamic Log File Discovery and Monitoring</h1>
<p>﻿﻿Log file monitoring of a single known log file can be easily implemented with the Microsoft.Unix.SCXLog modules, but in some cases, the full path to a log file isn’t static.   For example, if an application maintains multiple log files in a directory, the file name portion of the log file path may not be known ahead of time.    To handle this monitoring scenario, we can implement dynamic log file discovery – using a shell command execution, and then pass the full path of the log file to the SCXLog module for standard log file monitoring. This requires a new class instance, a discovery data source, a discovery rule, and a rule that actually implements the log file monitoring.</p>
<h2><strong>Defining the Log File Class and Hosting Relationship</strong></h2>
<p>Firstly, a new custom class is required to represent the log file objects.   Instances of this class will be discovered by the discovery rule.  </p>
<h4>Definition </h4>
<ul>
<li>ID:  MyApp.Monitoring.LogFile</li>
<li>Base Class:  Microsoft.Unix.ApplicationComponent</li>
<li>Name:  MyApp Log file</li>
</ul>
<p><strong>Properties</strong></p>
<ul>
<li>Name (String)</li>
<li>Path (String) – <em>Key</em></li>
</ul>
<p>The properties for the log file class represent the file name and full path.   The full path is assured to be unique, so I have specified that as the key property of the class.</p>
<p>The log file class needs to be hosted by the MyApp class, to maintain the relationship between the log files and the application.  </p>
<p><a rel="attachment wp-att-606" href="http://operatingquadrant.com/2011/03/24/operations-manager-%e2%80%93-extending-unixlinux-monitoring-with-mp-authoring-%e2%80%93-part-iii/relationship-2/"><img class="alignnone size-medium wp-image-606" title="Hosting Relationship" src="http://operatingquadrant.files.wordpress.com/2011/03/relationship1-e1300738052875.jpg?w=400&#038;h=390" alt="" width="400" height="390" /></a></p>
<h3>Discovery Data Source:  MyApp.Monitoring.DataSource.DiscoverLogFiles</h3>
<p>This data source will use the MyApp.Monitoring.DataSource.ShellCommandDiscovery probe action to find files in a given directory that match a pattern.   The output from this command execution will then be passed to a Microsoft.Windows.PowerShellDiscoveryProbe.   The reason that I am using a PowerShellDiscoveryProbe is that the listing of matched files will be returned as a single data item, the StdOut from the command.   Using a PowerShellDiscoveryProbe provides an easy way to split each line from the output and discover an instance per line. </p>
<h4>Configuration Parameters:</h4>
<ul>
<li>Interval (integer):  Scheduler interval in seconds &#8211; overridable</li>
<li>TargetSystem (string):  UNIX/Linux agent computer to execute the discovery</li>
<li>Appname (string):   The name of the application object (which is the key property for the hosting class instance)</li>
<li>LogFileNamePattern (string): The pattern that will be used in the grep operation to identify log files to discovery</li>
<li>LogFilepath (string):  The path to search for log files at (via an ls command)</li>
</ul>
<h4>Member Modules:</h4>
<p>The first member modules is a MyApp.Monitoring.DataSource.ShellCommandDiscovery probe action, that executes the following command:<br />
<em>ls $Config/LogFilepath$ |grep $Config/LogFileNamePattern$.  </em>This simply enumerates the contents of the specified directory path, and pipes the results to grep, to match a specified pattern, which could be a string match or regular expression.</p>
<h4>Module Configuration:</h4>
<pre>&lt;Interval&gt;$Config/Interval$&lt;/Interval&gt;
&lt;TargetSystem&gt;$Config/TargetSystem$&lt;/TargetSystem&gt;
&lt;ShellCommand&gt;ls $Config/LogFilepath$
   |grep $Config/LogFileNamePattern$&lt;/ShellCommand&gt;
&lt;Timeout&gt;120&lt;/Timeout&gt;</pre>
<p>The output of this shell command then needs to be parsed so that each valid line in the output is discovered as an instance of a log file object.   This is most easily done with a PowerShellDiscoveryProbe:</p>
<blockquote><p>param ([string]$CmdOutput,[string]$AppName,[string]$LogFilePath, [string] $TargetSystem,[string] $SourceID,[string]$ManagedEntityID)</p>
<p>$api = New-Object -comObject &#8216;Mom.ScriptAPI&#8217;<br />
$discoveryData = $api.CreateDiscoveryData(0, $SourceID, $ManagedEntityID)</p>
<p>if ($CmdOutput -ne $null){<br />
        $CmdOutput = $CmdOutput.Replace([Environment]::newline,&#8221; &#8220;)<br />
 [array]$arList = $CmdOutput.Split(&#8221; &#8220;)<br />
 $arList | ForEach-Object{<br />
  [string]$sFile = $_<br />
 if([int]$sFile.Length -ge [int]1){<br />
  $SFilePath = $LogFilePath + &#8220;/&#8221; + $sFile<br />
  $oInst = $discoveryData.CreateClassInstance(&#8220;$MPElement[Name='MyApp.Monitoring.Logfile']$&#8221;)<br />
  $oInst.AddProperty(&#8220;$MPElement[Name='MyApp.Monitoring.Logfile']/Name$&#8221;, $sFile)<br />
  $oInst.AddProperty(&#8220;$MPElement[Name='System!System.Entity']/DisplayName$&#8221;, $sFile)<br />
  $oInst.AddProperty(&#8220;$MPElement[Name='MyApp.Monitoring.Logfile']/Path$&#8221;, $sFilePath)<br />
  $oInst.AddProperty(&#8220;$MPElement[Name='MyApp.Monitoring.MyApp']/Name$&#8221;, $AppName)<br />
  $oInst.AddProperty(&#8220;$MPElement[Name='MicrosoftUnixLibrary!Microsoft.Unix.Computer']/PrincipalName$&#8221;, $TargetSystem)</p>
<p>  $discoveryData.AddInstance($oInst)<br />
 }     <br />
}<br />
 $discoveryData<br />
}</p>
<p>Remove-variable api<br />
Remove-variable discoveryData</p></blockquote>
<p>The PowerShell script loads the Mom.ScriptAPI, creates a Discovery Data instance, and then walks through each line of the ouptut.   If the file name is a valid string (not empty), a class instance is created for the MyApp.Monitoring.Logfile class, and the path and file name properties are set.   The PrincipalName property of the Microsoft.Unix.Computer object, and the AppName property of the MyApp.Monitoring.MyApp class ares included in the DiscoveryData, so that the discovery mapping process can map the hosting relationships. </p>
<p>Parameters are passed from the module configuration to the script using the Parameters XML fragment in the module configuration:</p>
<pre>&lt;Parameters&gt;
&lt;Parameter&gt;
 &lt;Name&gt;TargetSystem&lt;/Name&gt;
 &lt;Value&gt;$Config/TargetSystem$&lt;/Value&gt;
 &lt;/Parameter&gt;
&lt;Parameter&gt;
 &lt;Name&gt;AppName&lt;/Name&gt;
 &lt;Value&gt;$Config/Appname$&lt;/Value&gt;
 &lt;/Parameter&gt;
&lt;Parameter&gt;
 &lt;Name&gt;LogFilePath&lt;/Name&gt;
 &lt;Value&gt;$Config/LogFilepath$&lt;/Value&gt;
 &lt;/Parameter&gt;
&lt;Parameter&gt;
 &lt;Name&gt;CmdOutput&lt;/Name&gt;
 &lt;Value&gt;
 $Data///*[local-name()="StdOut"]$
&lt;/Value&gt;
 &lt;/Parameter&gt;
&lt;Parameter&gt;
 &lt;Name&gt;ManagedEntityID&lt;/Name&gt;
 &lt;Value&gt;$Target/Id$&lt;/Value&gt;
 &lt;/Parameter&gt;
&lt;Parameter&gt;
 &lt;Name&gt;SourceID&lt;/Name&gt;
 &lt;Value&gt;$MPElement$&lt;/Value&gt;
 &lt;/Parameter&gt;
 &lt;/Parameters&gt;</pre>
<p>This data source can then be used to discover log files matching a pattern, in a specified directory.  </p>
<h3>Discovery Rule:  MyApp.Monitoring.Discovery.LogFile</h3>
<p>This discovery will discover dynamically-named log files, in a specified path, using a regular expression to filter by file name.   It discovers instances of the MyApp.Monitoring.LogFile class, and uses the MyApp.Monitoring.DataSource.DiscoverLogFiles data source.  The discovery targets  MyApp.Monitoring.MyApp</p>
<p>Data Source Configuration:</p>
<ul>
<li>&lt;Interval&gt;14400&lt;/Interval&gt;</li>
<li>&lt;TargetSystem&gt;$Target/Host/Property[Type="MicrosoftUnixLibrary!Microsoft.Unix.Computer"]/PrincipalName$&lt;/TargetSystem&gt;</li>
<li>&lt;Appname&gt;$Target/Property[Type="MyApp.Monitoring.MyApp"]/Name$&lt;/Appname&gt;</li>
<li>&lt;LogFileNamePattern&gt;‘^log[0-9]+’&lt;/LogFileNamePattern&gt;</li>
<li>&lt;LogFilepath&gt;$Target/Property[Type="MyApp.Monitoring.MyApp"]/InstallPath$/logs&lt;/LogFilepath&gt;</li>
</ul>
<p>The two parameters to note are the LogFilepath (which is defined as the application path discovered for the MyApp application, appended with “/logs”) and the LogFileNamePattern (which is a regular expression &#8211; ‘^log[0-9]+’ – that will match log files named:  logxxx, where xxx is a number).  </p>
<h2>Monitoring the Discovered Log Files</h2>
<h3>Log File Monitoring Rule:   MyApp.Monitoring.Rule.AlertOnLogError</h3>
<p>Now that the dynamically-named log files will be discovered, we need a rule to alert when an error is found in one of the logs.   The rule will target all instances of the MyApp.Monitoring.LogFile class, so that when a new log file instance is discovered, it is automatically monitored.  The rule uses the MicrosoftUnixLibrary!Microsoft.Unix.SCXLog.Privileged.Datasource (assuming the log files require privileged credentials to access).</p>
<h4>Data source configuration:</h4>
<ul>
<li>&lt;Host&gt;$Target/Host/Host/Property[Type="MicrosoftUnixLibrary!Microsoft.Unix.Computer"]/NetworkName$&lt;/Host&gt;</li>
<li>&lt;LogFile&gt;$Target/Property[Type="MyApp.Monitoring.Logfile"]/Path$&lt;/LogFile&gt; &lt;RegExpFilter&gt;^.*(e|E)rror.*$&lt;/RegExpFilter&gt;</li>
</ul>
<p>The discovered path to the logfile instance is input as the LogFile parameter value, and a Regular Exprssion (^.*(e|E)rror.*$) is defined to match any log entries with the string:  error or Error in the message.  </p>
<h4>Condition Detection configuration:</h4>
<p>A System!System.Event.GenericDataMapper condition detection is then configured to map the data to EventData, for consumption by OpsMgr.  The configuration of this module is:</p>
<ul>
<li>&lt;EventOriginId&gt;$MPElement$&lt;/EventOriginId&gt;</li>
<li>&lt;PublisherId&gt;$MPElement$&lt;/PublisherId&gt;</li>
<li>&lt;PublisherName&gt;MyApp&lt;/PublisherName&gt;</li>
<li>&lt;Channel&gt;Application&lt;/Channel&gt;</li>
<li>&lt;LoggingComputer&gt;$Target/Host/Host/Property[Type="MicrosoftUnixLibrary!Microsoft.Unix.Computer"]/NetworkName$&lt;/LoggingComputer&gt;</li>
<li>&lt;EventNumber&gt;8001&lt;/EventNumber&gt;</li>
<li>&lt;EventCategory&gt;0&lt;/EventCategory&gt;</li>
<li>&lt;EventLevel&gt;1&lt;/EventLevel&gt;</li>
<li>&lt;UserName/&gt;</li>
<li> &lt;Params/&gt;</li>
<li> &lt;/ConditionDetection&gt;</li>
</ul>
<h4>Write Actions:</h4>
<p>In this rule, I have configured two write actions, for collecting the event, and generating an alert.  The CollectEvent (SC!Microsoft.SystemCenter.CollectEvent) module requires no additional configuration, and the alert can be configured to provide details about the logged error message:</p>
<p> <a rel="attachment wp-att-607" href="http://operatingquadrant.com/2011/03/24/operations-manager-%e2%80%93-extending-unixlinux-monitoring-with-mp-authoring-%e2%80%93-part-iii/rulealertconfig/"><img class="alignnone size-medium wp-image-607" title="Rule Alert Config" src="http://operatingquadrant.files.wordpress.com/2011/03/rulealertconfig.png?w=400&#038;h=402" alt="" width="400" height="402" /></a></p>
<h3>Stay tuned for more in this series&#8230;</h3>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/operatingquadrant.wordpress.com/601/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/operatingquadrant.wordpress.com/601/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/operatingquadrant.wordpress.com/601/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/operatingquadrant.wordpress.com/601/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/operatingquadrant.wordpress.com/601/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/operatingquadrant.wordpress.com/601/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/operatingquadrant.wordpress.com/601/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/operatingquadrant.wordpress.com/601/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/operatingquadrant.wordpress.com/601/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/operatingquadrant.wordpress.com/601/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/operatingquadrant.wordpress.com/601/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/operatingquadrant.wordpress.com/601/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/operatingquadrant.wordpress.com/601/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/operatingquadrant.wordpress.com/601/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=operatingquadrant.com&amp;blog=8969466&amp;post=601&amp;subd=operatingquadrant&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://operatingquadrant.com/2011/03/24/operations-manager-%e2%80%93-extending-unixlinux-monitoring-with-mp-authoring-%e2%80%93-part-iii/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/26f47dda05ea2d756f1f83f1164605aa?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">KB</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2011/03/relationship1-e1300738052875.jpg?w=400" medium="image">
			<media:title type="html">Hosting Relationship</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2011/03/rulealertconfig.png?w=400" medium="image">
			<media:title type="html">Rule Alert Config</media:title>
		</media:content>
	</item>
		<item>
		<title>Operations Manager – Extending UNIX/Linux Monitoring with MP Authoring – Part II</title>
		<link>http://operatingquadrant.com/2011/03/24/operations-manager-%e2%80%93-extending-unixlinux-monitoring-with-mp-authoring-%e2%80%93-part-ii/</link>
		<comments>http://operatingquadrant.com/2011/03/24/operations-manager-%e2%80%93-extending-unixlinux-monitoring-with-mp-authoring-%e2%80%93-part-ii/#comments</comments>
		<pubDate>Thu, 24 Mar 2011 04:04:01 +0000</pubDate>
		<dc:creator>Kristopher Bash</dc:creator>
				<category><![CDATA[Management Packs]]></category>
		<category><![CDATA[SCX]]></category>
		<category><![CDATA[System Center Operations Manager]]></category>
		<category><![CDATA[UNIX]]></category>

		<guid isPermaLink="false">http://operatingquadrant.com/?p=589</guid>
		<description><![CDATA[Introduction In Part I of this series, I walked through creation of a custom Management Pack for monitoring an application hosted on a UNIX or Linux server, as well as the creation of some base data sources and application discovery.   In this post, I will build on this MP to implement custom process monitoring &#8211; [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=operatingquadrant.com&amp;blog=8969466&amp;post=589&amp;subd=operatingquadrant&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h1>Introduction</h1>
<div>In Part I of this series, I walked through creation of a custom Management Pack for monitoring an application hosted on a UNIX or Linux server, as well as the creation of some base data sources and application discovery.   In this post, I will build on this MP to implement custom process monitoring &#8211; monitoring the count of instances of a running daemon/process to check that the count is within a range.   While the standard process monitoring provider (SCX_UnixProcess) is the best source for process information in OpsMgr UNIX and Linux monitoring, it does not support this level of customized monitoring.</div>
<h1>Advanced Service Monitoring</h1>
<div><span style="font-size:small;"><span style="font-family:Calibri;">Continuing this custom application monitoring scenario, our hypothetical app has a single daemon associated with the app, but we will build the classes and data sources so that they could easily be extended to add more services/daemons to monitor.    In this example, we can suppose that we want to monitor a daemon that may have multiple instances running, and drive an alert if too many or too few instances of that process are running.   This monitoring will be implemented by using the <em>ps</em> command in a WSMan Invoke module.   To implement monitoring of a daemon for a discovered, custom application, there are two approaches that are viable: </span></span></div>
<div><span style="font-size:small;"><span style="font-family:Calibri;"> </span></span></div>
<ol>
<li>
<div>Define a custom service class, and discover an instance of this class for each service to monitor, configure monitor types and monitors targeting this class</div>
</li>
<li>
<div>Create a monitor for each service to monitor, targeting the custom application class</div>
</li>
</ol>
<p>Both methods are completely viable, and in most cases, it is appropriate to take the simpler approach and target the custom monitors to the application, providing static inputs into the monitor.   There are some cases where discovering a class instance for the service makes sense though.  Facilitating dynamic discovery of services or thresholds (read from a config file), using the service class in a Distributed Application model in OpsMgr, or maintaining logical seperation (in terms of monitoring) between the application and its subsystems are all scenarios that would benefit from discovering the monitored services as class instances.   For the purpose of illustration, I will discover the daemon to monitor in this example Management Pack as a class instance.</p>
<h2>Class Definition</h2>
<h3>Class:  MyApp.Monitoring.Service</h3>
<h4>Definition</h4>
<ul>
<li>
<div>ID:  MyApp.Monitoring.Service</div>
</li>
<li>
<div>Base Class:  Microsoft.Unix.ApplicationComponent</div>
</li>
<li>
<div>Name:  MyApp Service</div>
</li>
</ul>
<h4>Properties</h4>
<ul>
<li>
<div>Name (String) – <em>Key</em></div>
</li>
<li>
<div>MinRunning (Integer)</div>
</li>
<li>
<div>MaxRunning (Integer)</div>
</li>
</ul>
<h2>Discovery</h2>
<p>Then we can define the data source to discover a service.   In this case, we know the name of the service and the value of the properties, so we don’t need to actually poll the agent to return data.   We can simply combine a Discovery Scheduler with a Discovery Data Mapper module to implement the data source.  However, we want to be able to override the values of MinRunning and MaxRunning, so these will need to be exposed as overridable configuration parameters.</p>
<p>Therefore, I’ve chosen to implement this data source in two parts.   The first data source, will simply combine a System.Discovery.Scheduler module and a System.Discovery.ClassSnapshotDataMapper module.   This data source will accept Interval, ClassId and InstanceSettings parameters as inputs.  The second data source will reference the first data source, but implement parameters for Service Name, MinRunning, and MaxRunning.    By breaking this into two data sources, the first data source can be used for other simple discoveries.</p>
<h3>Discovery Data Source:  MyApp.Monitoring.DataSource.DiscoverObject</h3>
<p>This is the data source that simply combines a scheduler and a discovery data mapper.  It requires that the MapperSchema be added to the Configuration:</p>
<pre>&lt;Configuration&gt;
&lt;IncludeSchemaTypes&gt;
&lt;SchemaType&gt;
 System!System.Discovery.MapperSchema
&lt;/SchemaType&gt;
&lt;/IncludeSchemaTypes&gt;
…
<span id="more-589"></span></pre>
<h4>Configuration Parameters:</h4>
<ul>
<li>Interval (integer):  Scheduler interval in seconds</li>
<li>ClassId (string):  ID of the Class to discover</li>
<li>InstanceSettings (SettingsType):  Discovery Instance Settings</li>
</ul>
<h4>Member Modules:</h4>
<p>The first member module is the System.Discovery.Scheduler module, with the configuration:</p>
<pre>&lt;Scheduler&gt;
&lt;SimpleReccuringSchedule&gt;
&lt;Interval&gt;$Config/Interval$&lt;/Interval&gt;
&lt;SyncTime/&gt;
&lt;/SimpleReccuringSchedule&gt;
&lt;ExcludeDates/&gt;
&lt;/Scheduler&gt;</pre>
<p>This is followed by a System.Discovery.ClassSnapshotDataMappermodule, with the configuration:</p>
<pre>&lt;ClassId&gt;$Config/ClassId$&lt;/ClassId&gt;
&lt;InstanceSettings&gt;
 $Config/InstanceSettings$
&lt;/InstanceSettings&gt;</pre>
<p>So this data source accepts the arbitrary Instance Settings and Class Id and maps the inputs to Discovery Data.</p>
<h3>Discovery Data Source:  MyApp.Monitoring.DataSource.DiscoverService</h3>
<p>This data source uses the MyApp.Monitoring.DataSource.DiscoverObject data source that we just created, but supports overridable inputs for the MinRunning and MaxRunning service class properties, by embedding the $Config/$ variables in the Instance Settings definition.</p>
<h4>Configuration Parameters:</h4>
<ul>
<li>Interval (integer):  Scheduler interval in seconds &#8211; overridable</li>
<li>TargetSystem (string):  UNIX/Linux agent computer to execute the discovery</li>
<li>AppName (string):   The name of the application object (which is the key property for the hosting class instance)</li>
<li>ServiceName (string): The name of the service to discover</li>
<li>MinRunning (integer):  The minimum threshold of running processes expected &#8211; overridable</li>
<li>MaxRunning (integer):  The maximum threshold of running processes expected &#8211; overridable</li>
</ul>
<h4>Member Modules</h4>
<p>This data source only has one member module:  MyApp.Monitoring.DataSource.DiscoverObject, with the configuration:</p>
<pre>&lt;Interval&gt;$Config/Interval$&lt;/Interval&gt;
&lt;ClassId&gt;
 $MPElement[Name="MyApp.Monitoring.Service"]$
&lt;/ClassId&gt;
&lt;InstanceSettings&gt;
&lt;Settings&gt;
&lt;Setting&gt;
&lt;Name&gt;
 $MPElement[Name='MyApp.Monitoring.MyApp']/Name$
&lt;/Name&gt;
&lt;Value&gt;$Config/AppName$&lt;/Value&gt;
&lt;/Setting&gt; 
&lt;Setting&gt;
&lt;Name&gt;
 $MPElement[Name='MyApp.Monitoring.Service']/Name$
&lt;/Name&gt;
&lt;Value&gt;$Config/ServiceName$&lt;/Value&gt;
&lt;/Setting&gt;
&lt;Setting&gt;
&lt;Name&gt;
 $MPElement[Name='MyApp.Monitoring.Service']/MinRunning$
&lt;/Name&gt;
&lt;Value&gt;$Config/MinProcesses$&lt;/Value&gt;
&lt;/Setting&gt;
&lt;Setting&gt;
&lt;Name&gt;
 $MPElement[Name='MyApp.Monitoring.Service']/MaxRunning$
&lt;/Name&gt;
&lt;Value&gt;$Config/MaxProcesses$&lt;/Value&gt;
&lt;/Setting&gt;
&lt;Setting&gt;
&lt;Name&gt;
 $MPElement[Name='MicrosoftUnixLibrary!
  Microsoft.Unix.Computer']/PrincipalName$
&lt;/Name&gt;
&lt;Value&gt;$Config/TargetSystem$&lt;/Value&gt;
&lt;/Setting&gt;
&lt;Setting&gt;
&lt;Name&gt;
$MPElement[Name='System!System.Entity']/DisplayName$
&lt;/Name&gt;
&lt;Value&gt;$Config/ServiceName$&lt;/Value&gt;
&lt;/Setting&gt;
&lt;/Settings&gt;
&lt;/InstanceSettings&gt;</pre>
<p>Note that the key properties for the hosting class instances (MyApp.Monitoring.MyApp, and Microsoft.Unix.Computer) are included in the Instance Settings so that the relationships can be mapped.  With the data sources in place, the next step is to configure the Discovery Rule (one for each service to discover).</p>
<h3>Discovery Rule:  MyApp.Monitoring.Discovery.MyAppDService</h3>
<p>This rule discovers the MyAppD daemon, using the data source just created.  It is targeted to instances of the MyApp class, and provides the name of the service and process count thresholds.</p>
<h4>Data Source Configuration:</h4>
<pre>&lt;Interval&gt;28800&lt;/Interval&gt;
&lt;TargetSystem&gt;
 $Target/Host/Property[Type="MicrosoftUnixLibrary!
  Microsoft.Unix.Computer"]/PrincipalName$
&lt;/TargetSystem&gt;
&lt;AppName&gt;
 $Target/Property[Type="MyApp.Monitoring.MyApp"]/Name$
&lt;/AppName&gt;
&lt;ServiceName&gt;myappd&lt;/ServiceName&gt;
&lt;MinProcesses&gt;1&lt;/MinProcesses&gt;
&lt;MaxProcesses&gt;3&lt;/MaxProcesses&gt;</pre>
<p>Once the MP is imported and the dicsovery has run, we can see the discovered service in the Discovered Inventory view in the Ops Console:</p>
<p><a rel="attachment wp-att-592" href="http://operatingquadrant.com/2011/03/24/operations-manager-%e2%80%93-extending-unixlinux-monitoring-with-mp-authoring-%e2%80%93-part-ii/service/"><img class="alignnone size-medium wp-image-592" title="Service" src="http://operatingquadrant.files.wordpress.com/2011/03/service-e1300736559901.png?w=348&#038;h=299" alt="" width="348" height="299" /></a></p>
<h2>Building the Monitor Type</h2>
<p>In this example, we are going to monitor the process/daemon and generate an alert if the count of running instances is outside of the threshold range.   To do this, we can use the Shell Command monitoring data source to execute a  <em>ps h -e |grep &lt;process name&gt; grep -v grep |wc –l</em> command string.  This calls the <em>ps</em> command, with switches to suppress the header row, and show all processes.   Grep is used to find the process name, and exclude the grep process itself.  Finally, the results are piped to <em>wc –l</em> to return a line count.   The result of this command string is that the running count of processes matching the process name is returned as a numeric value.</p>
<h3>Monitor Type: MyApp.Monitoring.MonitorType.ProcessCount</h3>
<p>This monitor type will use the MyApp.Monitoring.DataSource.ShellCommandMonitoring data source, to call the ps command string described above.  A set of condition detection modules are used to determine if the process count is below or above the minimum and maximum thresholds.</p>
<h4>Configuration Parameters</h4>
<ul>
<li>Interval (integer):  Scheduler interval in seconds &#8211; overridable</li>
<li>TargetSystem (string):  UNIX/Linux agent computer to monitor</li>
<li>ServiceName (string): The name of the service to monitor</li>
<li>MinRunning (integer):  The minimum threshold of running processes expected</li>
<li>MaxRunning (integer):  The maximum threshold of running processes expected</li>
</ul>
<h4>Health States</h4>
<ul>
<li>ProcessCountOK</li>
<li>ProcessCountNotOK</li>
</ul>
<h4>Member Modules</h4>
<pre>The data source for this monitor type is: MyApp.Monitoring.DataSource.ShellCommandMonitoring, with the configuration:
&lt;Interval&gt;$Config/Interval$&lt;/Interval&gt;
&lt;TargetSystem&gt;
 $Config/TargetSystem$
&lt;/TargetSystem&gt;
&lt;ShellCommand&gt;
 <em>ps h -e |grep $Config/ProcessName$|grep -v grep |wc –l</em>
&lt;/ShellCommand&gt;
&lt;Timeout&gt;120&lt;/Timeout&gt;</pre>
<p>Two configuration detection modules are required to detect the OK and NotOK states, comparing the returned StdOut to the thresholds:</p>
<pre>&lt;ConditionDetection ID="CDProcessCountOK"
  TypeID="System!System.ExpressionFilter"&gt;
&lt;Expression&gt;
&lt;And&gt;
&lt;Expression&gt;
&lt;SimpleExpression&gt;
&lt;ValueExpression&gt;
 &lt;XPathQuery Type="Double"&gt;
 //*[local-name()="StdOut"]
&lt;/XPathQuery&gt;
&lt;/ValueExpression&gt;
&lt;Operator&gt;GreaterEqual&lt;/Operator&gt;
&lt;ValueExpression&gt;
&lt;Value Type="Double"&gt;$Config/MinCount$&lt;/Value&gt;
&lt;/ValueExpression&gt;
&lt;/SimpleExpression&gt;
&lt;/Expression&gt;
&lt;Expression&gt;
&lt;SimpleExpression&gt;
&lt;ValueExpression&gt;
&lt;XPathQuery Type="Double"&gt;
 //*[local-name()="StdOut"]
&lt;/XPathQuery&gt;
&lt;/ValueExpression&gt;
&lt;Operator&gt;LessEqual&lt;/Operator&gt;
&lt;ValueExpression&gt;
&lt;Value Type="Double"&gt;$Config/MaxCount$&lt;/Value&gt;
&lt;/ValueExpression&gt;
&lt;/SimpleExpression&gt;
&lt;/Expression&gt;
&lt;/And&gt;
&lt;/Expression&gt;
&lt;/ConditionDetection&gt;</pre>
<p>And</p>
<pre>&lt;ConditionDetection ID="CDProcessCountNotOK"
  TypeID="System!System.ExpressionFilter"&gt;
&lt;Expression&gt;
&lt;Or&gt;
&lt;Expression&gt;
&lt;SimpleExpression&gt;
&lt;ValueExpression&gt;
&lt;XPathQuery Type="Double"&gt;
 //*[local-name()="StdOut"]
&lt;/XPathQuery&gt;
&lt;/ValueExpression&gt;
&lt;Operator&gt;Greater&lt;/Operator&gt;
&lt;ValueExpression&gt;
&lt;Value Type="Double"&gt;$Config/MaxCount$&lt;/Value&gt;
&lt;/ValueExpression&gt;
&lt;/SimpleExpression&gt;
&lt;/Expression&gt;
&lt;Expression&gt;
&lt;SimpleExpression&gt;
&lt;ValueExpression&gt;
&lt;XPathQuery Type="Double"&gt;
 //*[local-name()="StdOut"]
&lt;/XPathQuery&gt;
&lt;/ValueExpression&gt;
&lt;Operator&gt;Less&lt;/Operator&gt;
&lt;ValueExpression&gt;
&lt;Value Type="Double"&gt;$Config/MinCount$&lt;/Value&gt;
&lt;/ValueExpression&gt;
&lt;/SimpleExpression&gt;
&lt;/Expression&gt;
&lt;/Or&gt;
&lt;/Expression&gt;
&lt;/ConditionDetection&gt;</pre>
<h4>Regular Detections</h4>
<p>The regular detections just need to be configured to map the Condition Detection member modules to the defined Health States:</p>
<pre>&lt;RegularDetections&gt;
&lt;RegularDetection
  MonitorTypeStateID="ProcessCountOK"&gt;
&lt;Node ID="CDProcessCountOK"&gt;
&lt;Node ID="DS1"/&gt;
&lt;/Node&gt;
&lt;/RegularDetection&gt;
&lt;RegularDetection
  MonitorTypeStateID="ProcessCountNotOK"&gt;
&lt;Node ID="CDProcessCountNotOK"&gt;
&lt;Node ID="DS1"/&gt;
&lt;/Node&gt;
&lt;/RegularDetection&gt;
&lt;/RegularDetections&gt;</pre>
<p>In summary, this monitor type will execute our <em>ps</em> command, for a given service name, and compare the count of running/matched process instances  to the defined thresholds (defined during service discovery).</p>
<h2>Building the Custom Process Monitor</h2>
<p>In this step, we will create a monitor, of the type that we just created: MyApp.Monitoring.MonitorType.ProcessCount</p>
<p><a rel="attachment wp-att-594" href="http://operatingquadrant.com/2011/03/24/operations-manager-%e2%80%93-extending-unixlinux-monitoring-with-mp-authoring-%e2%80%93-part-ii/monitorservice-2/"><img class="alignnone size-medium wp-image-594" title="Service Monitor" src="http://operatingquadrant.files.wordpress.com/2011/03/monitorservice1-e1300737092706.png?w=400&#038;h=397" alt="" width="400" height="397" /></a></p>
<div>As for the monitor configuration, the service name, and minimum and maximum thresholds were discovered in the service discovery rule, so we can simply provide those target parameters to the monitor configuration.</div>
<pre>&lt;Configuration&gt;
&lt;Interval&gt;180&lt;/Interval&gt;
&lt;TargetSystem&gt;
 $Target/Host/Host/Property[Type="MicrosoftUnixLibrary!
     Microsoft.Unix.Computer"]/NetworkName$
&lt;/TargetSystem&gt;
&lt;ProcessName&gt;
 $Target/Property[Type="MyApp.Monitoring.Service"]/Name$
&lt;/ProcessName&gt;
&lt;MinCount&gt;
 $Target/Property[Type="MyApp.Monitoring.Service"]/MinRunning$
&lt;/MinCount&gt;
&lt;MaxCount&gt;
 $Target/Property[Type="MyApp.Monitoring.Service"]/MaxRunning$
&lt;/MaxCount&gt;
&lt;/Configuration&gt;</pre>
<div>For the actual alert, we can embed the parameters from the configuration and shell script output, to create an alert message detailing the current count of running processes as well as the minimum and maximum expected range.</div>
<blockquote>
<div><em>The MyApp Service: $Target/Property[Type="MyApp.Monitoring.Service"]/Name$, currently has too many or too few processes running. </em></div>
<div><em>Current process count:  $Data/Context///*[local-name()="StdOut"]$. </em></div>
<div><em>Expected range: </em><br />
<em>$Target/Property[Type="MyApp.Monitoring.Service"]/MinRunning$ &#8211; $Target/Property[Type="MyApp.Monitoring.Service"]/MaxRunning$.</em></div>
</blockquote>
<h3>Stay tuned for more in this series&#8230;</h3>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/operatingquadrant.wordpress.com/589/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/operatingquadrant.wordpress.com/589/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/operatingquadrant.wordpress.com/589/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/operatingquadrant.wordpress.com/589/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/operatingquadrant.wordpress.com/589/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/operatingquadrant.wordpress.com/589/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/operatingquadrant.wordpress.com/589/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/operatingquadrant.wordpress.com/589/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/operatingquadrant.wordpress.com/589/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/operatingquadrant.wordpress.com/589/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/operatingquadrant.wordpress.com/589/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/operatingquadrant.wordpress.com/589/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/operatingquadrant.wordpress.com/589/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/operatingquadrant.wordpress.com/589/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=operatingquadrant.com&amp;blog=8969466&amp;post=589&amp;subd=operatingquadrant&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://operatingquadrant.com/2011/03/24/operations-manager-%e2%80%93-extending-unixlinux-monitoring-with-mp-authoring-%e2%80%93-part-ii/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/26f47dda05ea2d756f1f83f1164605aa?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">KB</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2011/03/service-e1300736559901.png?w=348" medium="image">
			<media:title type="html">Service</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2011/03/monitorservice1-e1300737092706.png?w=400" medium="image">
			<media:title type="html">Service Monitor</media:title>
		</media:content>
	</item>
		<item>
		<title>Operations Manager &#8211; Extending UNIX/Linux Monitoring with MP Authoring &#8211; Part I</title>
		<link>http://operatingquadrant.com/2011/03/23/operations-manager-extending-unixlinux-monitoring-with-mp-authoring-part-i/</link>
		<comments>http://operatingquadrant.com/2011/03/23/operations-manager-extending-unixlinux-monitoring-with-mp-authoring-part-i/#comments</comments>
		<pubDate>Wed, 23 Mar 2011 16:11:56 +0000</pubDate>
		<dc:creator>Kristopher Bash</dc:creator>
				<category><![CDATA[Management Packs]]></category>
		<category><![CDATA[SCX]]></category>
		<category><![CDATA[System Center Operations Manager]]></category>
		<category><![CDATA[UNIX]]></category>

		<guid isPermaLink="false">http://operatingquadrant.com/?p=575</guid>
		<description><![CDATA[Introduction The OpsMgr UNIX and Linux monitoring implementation can be extended through MP authoring to implement robust system and application monitoring for UNIX/Linux servers.   The most direct mechanism of extension comes in the form of the script provider, accessed with WSMan Invoke modules.   The WSMan Invoke modules support three methods of invoking actions: ExecuteCommand – [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=operatingquadrant.com&amp;blog=8969466&amp;post=575&amp;subd=operatingquadrant&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h1>Introduction</h1>
<p>The OpsMgr UNIX and Linux monitoring implementation can be extended through MP authoring to implement robust system and application monitoring for UNIX/Linux servers.   The most direct mechanism of extension comes in the form of the script provider, accessed with WSMan Invoke modules.   The WSMan Invoke modules support three methods of invoking actions:</p>
<ul>
<li>ExecuteCommand – execute a command (e.g. a script already on the file system ) and return the results</li>
<li>ExecuteShellCommand – execute a command through sh (with pipeline support) and return the results</li>
<li>ExecuteScript  &#8211; download and execute an embedded script and return the results</li>
</ul>
<p>Of these three methods, I prefer to use ExecuteShellCommand in most cases, as it allows for the use of complex one-liner shell commands, embedded in the MP.</p>
<p>In a series of posts, I will describe the creation of an example Management Pack for monitoring an application, featuring dynamic application discovery, discovery of multiple log files, and advanced monitoring implementations.</p>
<h2><strong>Example Application Details</strong></h2>
<p>The example MP described in these blog posts implements monitoring for a hypothetical application (MyApp).  The application involves a daemon, a set of log files, and application performance counters where the metrics are accessible as the contents of files.</p>
<h1>Part I &#8211; Discovering an Application</h1>
<h2>Setting up the MP</h2>
<p>I am a big fan of the R2 Authoring Console and will be using it to create this example MP.   The first step then is to create a new MP in the Authoring Console (ID:  MyApp.Monitoring).    Once the MP is created and saved, references are needed.   References I am adding are:</p>
<ul>
<li>Microsoft.Unix.Library – contains UNIX/Linux classes and modules</li>
<li>Microsoft.SystemCenter.DataWarehouse.Library – required for publishing performance data to the DW</li>
<li>System.Image.Library – contains icon images referenced in class definition</li>
</ul>
<p><a rel="attachment wp-att-576" href="http://operatingquadrant.com/2011/03/23/operations-manager-extending-unixlinux-monitoring-with-mp-authoring-part-i/ref/"><img class="alignnone size-medium wp-image-576" title="References" src="http://operatingquadrant.files.wordpress.com/2011/03/ref-e1300730156221.jpg?w=400&#038;h=255" alt="" width="400" height="255" /></a></p>
<h2>Configuring the Base Composite Modules<br />
<span id="more-575"></span></h2>
<p>Most monitoring and discovery workflows used in this MP example will involve the execution of a shell command through the Microsoft.Unix.WSMan.Invoke.ProbeAction ExecuteShellCommand method.   Therefore, setting up a new composite probe action and a couple of base data sources will make further module implementation much simpler.</p>
<h3>Probe Action:  MyApp.Monitoring.ProbeAction.ShellCommand</h3>
<p>This probe action simply wraps the Microsoft.Unix.WSMan.Invoke.ProbeAction in a way that makes it easier to use for shell command execution.</p>
<h5>Configuration Parameters:</h5>
<ul>
<li>TargetSystem (string)  – the UNIX/Linux agent computer that will execute the command</li>
<li>ShellCommand (string) – the shell command to execute</li>
<li>Timeout (integer) – the command timeout, in seconds</li>
</ul>
<h5>Member Modules:</h5>
<p>This probe action will only include one member module:  Microsoft.Unix.WSMan.Invoke.ProbeAction.  The configuration of the module looks like:</p>
<pre>&lt;TargetSystem&gt;$Config/TargetSystem$&lt;/TargetSystem&gt;
&lt;Uri&gt;

http://schemas.microsoft.com/wbem/wscim/1/cim-schema/2/

 SCX_OperatingSystem?__cimnamespace=root/scx
&lt;/Uri&gt;
&lt;Selector/&gt;
&lt;InvokeAction&gt;ExecuteShellCommand&lt;/InvokeAction&gt;
&lt;Input&gt;
&lt;p:ExecuteShellCommand_INPUT xmlns:p="http://schemas.
 microsoft.com/wbem/wscim/1/cim-schema/2/SCX_OperatingSystem"&gt;
&lt;p:command&gt;$Config/ShellCommand$&lt;/p:command&gt;
&lt;p:timeout&gt;$Config/Timeout$&lt;/p:timeout&gt;
&lt;/p:ExecuteShellCommand_INPUT&gt;
&lt;/Input&gt;</pre>
<p>Note that the configuration parameters for ShellCommand and Timeout are embedded in the “Input” parameter XML fragment.</p>
<h3>Data Source: MyApp.Monitoring.DataSource.ShellCommandMonitoring</h3>
<p>The probe action created in the previous step will be used in a number of monitoring workflows, so creating a data source that combines the probe action with a scheduler will make monitoring workflow configuration simpler.</p>
<h5>Configuration Parameters:</h5>
<ul>
<li>Interval (integer) – timer interval in seconds</li>
<li>TargetSystem (string)  – passed to the probe action module</li>
<li>ShellCommand (string) – passed to the probe action module</li>
<li>Timeout (integer) – passed to the probe action module</li>
</ul>
<h5>Member Modules:</h5>
<p>The first module in this composite data source is a System.Scheduler module, with a basic configuration:</p>
<pre>&lt;Scheduler&gt;
&lt;SimpleReccuringSchedule&gt;
&lt;Interval&gt;$Config/Interval$&lt;/Interval&gt;
&lt;SyncTime/&gt;
&lt;/SimpleReccuringSchedule&gt;
&lt;ExcludeDates/&gt;
&lt;/Scheduler&gt;</pre>
<p>This scheduler module is followed by the ShellComand probe action, with the configuration:</p>
<pre>&lt;TargetSystem&gt;$Config/TargetSystem$&lt;/TargetSystem&gt;
&lt;ShellCommand&gt;$Config/ShellCommand$&lt;/ShellCommand&gt;
&lt;Timeout&gt;$Config/Timeout$&lt;/Timeout&gt;</pre>
<h3>Data Source: MyApp.Monitoring.DataSource.ShellCommandDiscovery</h3>
<p>This data source is identical to the MyApp.Monitoring.DataSource.ShellCommandMonitoring data source, except it features a System.Discovery.Scheduler scheduler module instead of a System.Scheduler module.  Discovery workflows must use a Discovery scheduler in order to prevent problems with cookdown (i.e. discovery workflows ‘cooking-down’ along with monitoring workflows).   So this data source combines the ShellCommand probe action with a Discovery scheduler.</p>
<p>Additionally, I have added a System.ExpressionFilter module to the ShellCommandDiscovery data source to prevent the discovery workflows from continuing if an error is encountered (either WSMan error or ShellCommand StdErr output).   The ExpressionFilter configuration is:</p>
<pre>&lt;Expression&gt;
&lt;And&gt;
&lt;Expression&gt;
&lt;RegExExpression&gt;
&lt;ValueExpression&gt;
 &lt;XPathQuery&gt;//*[local-name()="StdErr"]&lt;/XPathQuery&gt;
&lt;/ValueExpression&gt;
 &lt;Operator&gt;DoesNotMatchRegularExpression&lt;/Operator&gt;
 &lt;Pattern&gt;^.+&lt;/Pattern&gt;
 &lt;/RegExExpression&gt;
 &lt;/Expression&gt;
&lt;Expression&gt;
&lt;Not&gt;&lt;Expression&gt;&lt;Exists&gt;
&lt;ValueExpression&gt;
 &lt;XPathQuery&gt;WsManData/ErrorCode&lt;/XPathQuery&gt;
&lt;/ValueExpression&gt;
&lt;/Exists&gt; &lt;/Expression&gt; &lt;/Not&gt;
&lt;/Expression&gt;
&lt;/And&gt;
&lt;/Expression&gt;</pre>
<h2>Class Definition</h2>
<p>With the base composite modules configured, we can move on to the actual application discovery, starting with the definition of the application class.  The Microsoft.Unix.LocalApplication is an ideal base class for the application class, and already has a hosting relationship defined so that Microsoft.Unix.Computer hosts Microsoft.Unix.LocalApplication.</p>
<p><a rel="attachment wp-att-577" href="http://operatingquadrant.com/2011/03/23/operations-manager-extending-unixlinux-monitoring-with-mp-authoring-part-i/classdefinition/"></a></p>
<p><a rel="attachment wp-att-578" href="http://operatingquadrant.com/2011/03/23/operations-manager-extending-unixlinux-monitoring-with-mp-authoring-part-i/classdefinition-2/"><img class="alignnone size-medium wp-image-578" title="Class Definition" src="http://operatingquadrant.files.wordpress.com/2011/03/classdefinition1-e1300730705273.jpg?w=400&#038;h=397" alt="" width="400" height="397" /></a></p>
<h5>Class Definition:</h5>
<ul>
<li>ID:  MyApp.Monitoring.MyApp</li>
<li>Base Class:  Microsoft.Unix.LocalApplication</li>
<li>Name:  MyApp</li>
</ul>
<h5>Properties:</h5>
<ul>
<li>Name (String) – <em>Key</em></li>
<li>InstallPath (String)</li>
</ul>
<h2>Discovering the Application</h2>
<p>When discovering a Windows application in OpsMgr, we would typically use a registry probe.  In UNIX/Linux application discovery, probing the existence or contents of a file is typically the most effective way to identify the instance of an application.   In this example, the MyApp application has a configuration file named: myapp.conf in the installation path of /opt/myapp.  Thus, a shell command:  ls /opt/myapp/myapp.conf | wc –l would return a 1 if the file exists, or 0 if the file doesn’t exist.   We can use this logic in the application discovery.</p>
<h3>Discovery Data Source: MyApp.Monitoring.DataSource.MyAppDiscovery</h3>
<p>To implement this application discovery, I will create a new data source, building on the ShellCommandDiscovery data source previously created.</p>
<h5>Configuration Parameters:</h5>
<ul>
<li>Interval (integer):  Scheduler interval in seconds</li>
<li>TargetSystem (string):  UNIX/Linux agent computer to execute the discovery</li>
<li>AppPath (string):  File system path to the application, overrideable</li>
</ul>
<h5>Member Modules:</h5>
<p>The first module in this data source is the ShellCommandDiscovery data source (MyApp.Monitoring.DataSource.ShellCommandDiscovery).   This will be used to query the file system for the application configuration file, to determine if the app is present.  The configuration for this module is:</p>
<pre>&lt;Interval&gt;$Config/Interval$&lt;/Interval&gt;
&lt;TargetSystem&gt;$Config/TargetSystem$&lt;/TargetSystem&gt;
&lt;ShellCommand&gt;
 ls $Config/AppPath$/myapp.conf | wc -l
&lt;/ShellCommand&gt;
&lt;Timeout&gt;120&lt;/Timeout&gt;</pre>
<p>In order to return discovery data from this data source, a Discovery Mapper module is required.   In this case, I will use a System.Discovery.FilteredClassSnapshotDataMapper module to filter the results (only return discovery data if the app is found).   An output of 1 from the shell command indicates that the configuration file was found, while an output of 0 indicates that the configuration file was not found.  The configuration for the FilteredClassSnapShotDataMapperModule would be:</p>
<pre>&lt;Expression&gt;
&lt;SimpleExpression&gt;
&lt;ValueExpression&gt;
 &lt;XPathQuery Type="String"&gt;
  //*[local-name()="StdOut"]
 &lt;/XPathQuery&gt;
&lt;/ValueExpression&gt;
&lt;Operator&gt;Equal&lt;/Operator&gt;
&lt;ValueExpression&gt;
 &lt;Value Type="String"&gt;1&lt;/Value&gt;
&lt;/ValueExpression&gt;
&lt;/SimpleExpression&gt;
&lt;/Expression&gt;
&lt;ClassId&gt;
 $MPElement[Name='MyApp.Monitoring.MyApp']$
&lt;/ClassId&gt;
&lt;InstanceSettings&gt;
&lt;Settings&gt;
&lt;Setting&gt;
&lt;Name&gt;
$MPElement[Name='MyApp.Monitoring.MyApp']/Name$
&lt;/Name&gt;
&lt;Value&gt;MyApp&lt;/Value&gt;
&lt;/Setting&gt;
&lt;Setting&gt;
&lt;Name&gt;
 $MPElement[Name='MyApp.Monitoring.MyApp']/InstallPath$
&lt;/Name&gt;
&lt;Value&gt;$Config/AppPath$&lt;/Value&gt;
&lt;/Setting&gt;
&lt;Setting&gt;
&lt;Name&gt;
 $MPElement[Name='System!System.Entity']/DisplayName$
&lt;/Name&gt;
&lt;Value&gt;MyApp - $Config/TargetSystem$&lt;/Value&gt;
&lt;/Setting&gt;
&lt;Setting&gt;
&lt;Name&gt;
 $MPElement[Name='MicrosoftUnixLibrary!
 Microsoft.Unix.Computer']/PrincipalName$
&lt;/Name&gt;
&lt;Value&gt;$Config/TargetSystem$&lt;/Value&gt;
&lt;/Setting&gt;
&lt;/Settings&gt;
&lt;/InstanceSettings&gt;</pre>
<p>Note that the Key Property (PrincipalName) for the hosting Microsoft.Unix.Computer object is included in the DiscoveryData.</p>
<h3>Discovery Rule:  MyApp.Monitoring.Discovery.MyApp</h3>
<p>With the discovery data source implemented, finishing the discovery just requires creation of the discovery rule, which targets Microsoft.Unix.Computer objects.</p>
<p><a rel="attachment wp-att-579" href="http://operatingquadrant.com/2011/03/23/operations-manager-extending-unixlinux-monitoring-with-mp-authoring-part-i/myappdiscovery/"><img class="alignnone size-medium wp-image-579" title="MyApp Discovery" src="http://operatingquadrant.files.wordpress.com/2011/03/myappdiscovery-e1300731095833.png?w=400&#038;h=396" alt="" width="400" height="396" /></a></p>
<h5>Data Source Configuration:</h5>
<ul>
<li>Interval:  14400</li>
<li>TargetSystem: $Target/Property[Type="MicrosoftUnixLibrary!Microsoft.Unix.Computer"]/PrincipalName$</li>
<li>AppPath: /opt/myapp</li>
</ul>
<p>This is a good time to create the MP’s presentation folder and a state view targeting MyApp objects.   Once the discovery has executed, discovered instances of the app can be viewed in the state view or Discovered Inventory view:</p>
<p><a rel="attachment wp-att-580" href="http://operatingquadrant.com/2011/03/23/operations-manager-extending-unixlinux-monitoring-with-mp-authoring-part-i/stateview/"><img class="alignnone size-medium wp-image-580" title="State View" src="http://operatingquadrant.files.wordpress.com/2011/03/stateview-e1300731358443.jpg?w=337&#038;h=339" alt="" width="337" height="339" /></a></p>
<p><em>Stay tuned for more posts on completing this example Management Pack</em></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/operatingquadrant.wordpress.com/575/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/operatingquadrant.wordpress.com/575/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/operatingquadrant.wordpress.com/575/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/operatingquadrant.wordpress.com/575/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/operatingquadrant.wordpress.com/575/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/operatingquadrant.wordpress.com/575/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/operatingquadrant.wordpress.com/575/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/operatingquadrant.wordpress.com/575/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/operatingquadrant.wordpress.com/575/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/operatingquadrant.wordpress.com/575/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/operatingquadrant.wordpress.com/575/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/operatingquadrant.wordpress.com/575/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/operatingquadrant.wordpress.com/575/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/operatingquadrant.wordpress.com/575/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=operatingquadrant.com&amp;blog=8969466&amp;post=575&amp;subd=operatingquadrant&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://operatingquadrant.com/2011/03/23/operations-manager-extending-unixlinux-monitoring-with-mp-authoring-part-i/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/26f47dda05ea2d756f1f83f1164605aa?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">KB</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2011/03/ref-e1300730156221.jpg?w=400" medium="image">
			<media:title type="html">References</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2011/03/classdefinition1-e1300730705273.jpg?w=400" medium="image">
			<media:title type="html">Class Definition</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2011/03/myappdiscovery-e1300731095833.png?w=400" medium="image">
			<media:title type="html">MyApp Discovery</media:title>
		</media:content>

		<media:content url="http://operatingquadrant.files.wordpress.com/2011/03/stateview-e1300731358443.jpg?w=400" medium="image">
			<media:title type="html">State View</media:title>
		</media:content>
	</item>
	</channel>
</rss>
