<?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/"
	>

<channel>
	<title>Keebler/Blog &#187; processes</title>
	<atom:link href="http://www.keebler.net/blog/tag/processes/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.keebler.net/blog</link>
	<description></description>
	<lastBuildDate>Wed, 24 Feb 2010 17:09:26 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>.NET: Monitoring Windows processes from ASPX webpage</title>
		<link>http://www.keebler.net/blog/2009/01/03/net-monitoring-windows-processes-from-aspx-webpage/</link>
		<comments>http://www.keebler.net/blog/2009/01/03/net-monitoring-windows-processes-from-aspx-webpage/#comments</comments>
		<pubDate>Sat, 03 Jan 2009 16:40:27 +0000</pubDate>
		<dc:creator>Jonathan</dc:creator>
				<category><![CDATA[My Releases]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[ASPX]]></category>
		<category><![CDATA[processes]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.keebler.net/blog/?p=4572</guid>
		<description><![CDATA[
I was recently working on some ScribbleLive features that require asynchronous processes to be running in the background on Windows.  Since I want to make sure they keep running, I wanted Pingdom to be able to monitor (and alert) on them.


I was happy to find that in .NET, a web application can access the [...]


Related posts:<ol><li><a href='http://www.keebler.net/blog/2009/03/23/adding-sl-to-windows-web-app-g/' rel='bookmark' title='Permanent Link: Adding SL to Windows Web App G&#8230;'>Adding SL to Windows Web App G&#8230;</a> <small>Adding SL to Windows Web App Gallery. No, not really....</small></li>
<li><a href='http://www.keebler.net/blog/2009/03/22/improving-response-times/' rel='bookmark' title='Permanent Link: Improving Response Times'>Improving Response Times</a> <small> Just so you guys know, we really are complete...</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>
I was recently working on some <a href="http://www.scribblelive.com">ScribbleLive</a> features that require asynchronous processes to be running in the background on Windows.  Since I want to make sure they keep running, I wanted <a href="http://www.pingdom.com">Pingdom</a> to be able to monitor (and alert) on them.
</p>
<p>
I was happy to find that in .NET, a web application can access the processes running on the host server.  I whipped up this little bit of C# (which will be on an ASPX page) to check for the processes, and report if they are &#8220;UP&#8221; or &#8220;DOWN&#8221;.  Pingdom will then check for the word &#8220;DOWN&#8221; on a request to the page and let me know if it finds one.
</p>
<p>
Here are the using statements that you have to have for this code to run:
</p>
<pre class="syntax-highlight:c#">
using System.Diagnostics;
using System.Collections.ObjectModel;
</pre>
<p>
Then here&#8217;s the bulk of it:
</p>
<pre class="syntax-highlight:c">
Collection&lt;string&gt; RunningProcesses = new Collection&lt;string&gt;();
RunningProcesses.Add( &quot;Program1&quot; );
RunningProcesses.Add( &quot;Program2&quot; );

Response.ContentType = &quot;text/plain&quot;;

foreach ( Process proc in Process.GetProcesses() )
{
    if ( RunningProcesses.Contains( proc.ProcessName ) )
    {
        Response.Write( proc.ProcessName + &quot;: UP&quot; + System.Environment.NewLine );
        RunningProcesses.Remove( proc.ProcessName );
    }
}

foreach ( string s in RunningProcesses )
{
    Response.Write( s + &quot;: DOWN&quot; + System.Environment.NewLine );
}
</pre>
<p>
When I have a bit more time, I&#8217;m going to add a call to Process.Start(&#8230;) to restart and processes that have gone down.  You know, at some point this code will probably make me unnecessary <img src='http://www.keebler.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p>


<p>Related posts:<ol><li><a href='http://www.keebler.net/blog/2009/03/23/adding-sl-to-windows-web-app-g/' rel='bookmark' title='Permanent Link: Adding SL to Windows Web App G&#8230;'>Adding SL to Windows Web App G&#8230;</a> <small>Adding SL to Windows Web App Gallery. No, not really....</small></li>
<li><a href='http://www.keebler.net/blog/2009/03/22/improving-response-times/' rel='bookmark' title='Permanent Link: Improving Response Times'>Improving Response Times</a> <small> Just so you guys know, we really are complete...</small></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.keebler.net/blog/2009/01/03/net-monitoring-windows-processes-from-aspx-webpage/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
