<?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>Uptime &#38; Performance Tips &#187; Website Monitoring</title>
	<atom:link href="http://blog.monitis.com/index.php/category/website-monitoring/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.monitis.com</link>
	<description>Tips for SysAdmin, Webmaster, Network Admin</description>
	<lastBuildDate>Fri, 10 Feb 2012 08:56:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>M3 Timers &#8211; improved server monitoring</title>
		<link>http://blog.monitis.com/index.php/2012/02/10/m3-timers-improved-server-monitoring/</link>
		<comments>http://blog.monitis.com/index.php/2012/02/10/m3-timers-improved-server-monitoring/#comments</comments>
		<pubDate>Fri, 10 Feb 2012 08:56:38 +0000</pubDate>
		<dc:creator>Dan Fruehauf</dc:creator>
				<category><![CDATA[101 Reasons To Choose Monitis]]></category>
		<category><![CDATA[Applications Monitoring]]></category>
		<category><![CDATA[Database Monitoring]]></category>
		<category><![CDATA[Linux Servers Monitoring]]></category>
		<category><![CDATA[Management Scripts]]></category>
		<category><![CDATA[Monitis API]]></category>
		<category><![CDATA[Monitoring Scripts]]></category>
		<category><![CDATA[Network Monitoring]]></category>
		<category><![CDATA[Performance Management]]></category>
		<category><![CDATA[Transactions Monitoring]]></category>
		<category><![CDATA[Uptime Monitoring]]></category>
		<category><![CDATA[Website Monitoring]]></category>
		<category><![CDATA[agent-based monitoring]]></category>
		<category><![CDATA[command-line tools]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[M3]]></category>
		<category><![CDATA[multi threading]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[timers]]></category>
		<category><![CDATA[uptime]]></category>
		<category><![CDATA[website monitoring]]></category>

		<guid isPermaLink="false">http://blog.monitis.com/?p=5099</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://blog.monitis.com/index.php/2012/02/10/m3-timers-improved-server-monitoring/' addthis:title='M3 Timers &#8211; improved server monitoring '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>Unleashing the power of M3 &#38; timers During the lifespan of M3 (Monitis Monitor Manager) there has always been something lacking – timers. M3 execution procedure was outlined in this previous article. The execution mentioned in the latter was a one-time-execution, whereas server monitoring requires periodic invocation of monitors in order to actually provide counters [...]]]></description>
			<content:encoded><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://blog.monitis.com/index.php/2012/02/10/m3-timers-improved-server-monitoring/' addthis:title='M3 Timers &#8211; improved server monitoring '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div><h3 id="internal-source-marker_0.6132884497837576">Unleashing the power of M3 &amp; timers</h3>
<p><a href="http://blog.monitis.com/wp-content/uploads/2012/01/M3TimersFlowChart.jpg"><img style="margin: 10px; float: right;" src="http://blog.monitis.com/wp-content/uploads/2012/01/M3TimersFlowChart.jpg" alt="" width="250" /></a><br />
During the lifespan of <a href="https://github.com/monitisexchange/Monitis-Linux-Scripts/tree/master/M3">M3 (Monitis Monitor Manager)</a> there has always been something lacking – timers.</p>
<p>M3 execution procedure was outlined in this <a href="../index.php/2011/11/11/the-simplicity-of-server-monitoring-monitis-m3/">previous article</a>.</p>
<p>The execution mentioned in the latter was a one-time-execution, whereas server monitoring requires periodic invocation of monitors in order to actually provide counters over time, graphing performance.</p>
<p>The periodic invocation method suggested up until today was to integrate M3 with <a href="http://en.wikipedia.org/wiki/Cron">crontab</a>.</p>
<p>Crontab, in a nutshell, is a Linux/Unix service for periodic invocation of executables. Implementing M3 with crontab properly meant M3 would run every X minutes, producing a Monitis counter update every X minutes, should everything run properly.</p>
<p>In the following article I&#8217;ll outline the changes done to support timers in M3.<span id="more-5099"></span></p>
<h3>Design &amp; implementation</h3>
<p>When assessing a programming task, I usually stick to the KISS simple &#8211; “<em>Keep it simple, stupid!</em>”.</p>
<p>I had a few ideas of how to implement timers in M3, eventually I went with the simplest one, yes, for sake of simplicity.</p>
<p>If we&#8217;ll go back to M3&#8242;s XML hierarchy, we&#8217;ll discover again that the top most level is an agent. Every agent can have a few monitors and every monitor can have a few counters (metrics).</p>
<p>The simplest idea I had in mind was to simply spawn every agent in a different thread.</p>
<p>Simply put, what M3 would do when invoked in timer mode is to spawn a thread for every agent defined in the XML. Every one of these new spawned threads will:</p>
<ol>
<li>Run all the monitors of the agent and update their data in Monitis</li>
<li>Sleep for X seconds (where X is the agent interval defined)</li>
<li>Loop back</li>
</ol>
<p>It&#8217;s true that if M3 is configured with dozens of agents, then dozens of threads would be spawned. If you are such a person using M3 with dozens of agents, please feel free to contact me and we&#8217;ll find a solution also for that.</p>
<p>Going to the beginning of the paragraph and mentioning dozens of spawned threads, I have to admit I was tempted to go with a single-threaded asynchronous design, but realized that implementing such a thing might take too long and cause too many bugs.</p>
<p>We at Monitis believe that monitoring your servers should be easy and never hamper performance. If you believe that the mentioned design of M3 might harm your performance, I&#8217;ll be more than happy to go forward with a single-threaded asynchronous implementation which would definitely yield better performance and a smaller memory footprint.</p>
<h3>Usage</h3>
<p>M3’s usage is still very simple. If you have M3 checked out, simply update it and you&#8217;ll find:</p>
<ul>
<li>TimerRun.pl</li>
<li>TimerDryRun.pl</li>
</ul>
<p>The former will invoke M3 in a loop, running monitors and updating counters. The latter will do exactly the same without updating counters.</p>
<p>Both executions can be terminated using ^C, which would terminate all threads cleanly. Be patient while terminating.</p>
<p>Invocation stayed the same. For the sake of simplicity we can use the <a href="https://github.com/monitisexchange/Monitis-Linux-Scripts/blob/master/M3/etc_file_monitor.xml">etc_file_monitor.xml</a> configuration file which is configured with an interval of 300 seconds (5 minutes). Invocation will be as follows:</p>
<pre style="padding-left: 30px; padding-bottom: 1em;"><code> # TimerRun.pl etc_file_monitor.xml </code></pre>
<p>That&#8217;s it, go have lunch. M3 will do the rest for you!</p>
<h3>Backward Compatibility</h3>
<p>In case you wonder about backward compatibility or if you are just happy to run M3 via crontab &#8211; then worry no more. M3 functionality as a stand-alone single-execution behavior is still functional. Timers came as an addition and not as a replacement.</p>
<p>Enjoy it and remember that feedback is always more than welcome!</p>
<p>Integrating software into the powerful <a href="http://www.monitis.com/">Monitis</a> has never been easier, now that you have M3!</p>
<p><a href="http://www.monitis.com/">Monitis</a> can monitor anything! Follow us also on<a href="http://twitter.com/#%21/monitis"> Twitter</a> and<a href="https://github.com/monitisexchange"> GitHub</a>.</p>
Share Now:<a rel="nofollow"   href="http://delicious.com/post?url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2012%2F02%2F10%2Fm3-timers-improved-server-monitoring%2F&amp;title=M3%20Timers%20-%20improved%20server%20monitoring&amp;notes=Unleashing%20the%20power%20of%20M3%20%26amp%3B%20timers%0D%0A%0D%0ADuring%20the%20lifespan%20of%20M3%20%28Monitis%20Monitor%20Manager%29%20there%20has%20always%20been%20something%20lacking%20%E2%80%93%20timers.%0D%0A%0D%0AM3%20execution%20procedure%20was%20outlined%20in%20this%20previous%20article.%0D%0A%0D%0AThe%20execution%20mentioned%20in%20the%20latt" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/delicious.png" class="sociable-img sociable-hovers" title="del.icio.us" alt="del.icio.us" /></a><a rel="nofollow"   href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2012%2F02%2F10%2Fm3-timers-improved-server-monitoring%2F&amp;title=M3%20Timers%20-%20improved%20server%20monitoring&amp;bodytext=Unleashing%20the%20power%20of%20M3%20%26amp%3B%20timers%0D%0A%0D%0ADuring%20the%20lifespan%20of%20M3%20%28Monitis%20Monitor%20Manager%29%20there%20has%20always%20been%20something%20lacking%20%E2%80%93%20timers.%0D%0A%0D%0AM3%20execution%20procedure%20was%20outlined%20in%20this%20previous%20article.%0D%0A%0D%0AThe%20execution%20mentioned%20in%20the%20latt" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/digg.png" class="sociable-img sociable-hovers" title="Digg" alt="Digg" /></a><a rel="nofollow"   href="http://www.facebook.com/share.php?u=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2012%2F02%2F10%2Fm3-timers-improved-server-monitoring%2F&amp;t=M3%20Timers%20-%20improved%20server%20monitoring" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/facebook.png" class="sociable-img sociable-hovers" title="Facebook" alt="Facebook" /></a><a rel="nofollow"   href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2012%2F02%2F10%2Fm3-timers-improved-server-monitoring%2F&amp;title=M3%20Timers%20-%20improved%20server%20monitoring&amp;source=Uptime+%26amp%3B+Performance+Tips+Tips+for+SysAdmin%2C+Webmaster%2C+Network+Admin&amp;summary=Unleashing%20the%20power%20of%20M3%20%26amp%3B%20timers%0D%0A%0D%0ADuring%20the%20lifespan%20of%20M3%20%28Monitis%20Monitor%20Manager%29%20there%20has%20always%20been%20something%20lacking%20%E2%80%93%20timers.%0D%0A%0D%0AM3%20execution%20procedure%20was%20outlined%20in%20this%20previous%20article.%0D%0A%0D%0AThe%20execution%20mentioned%20in%20the%20latt" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/linkedin.png" class="sociable-img sociable-hovers" title="LinkedIn" alt="LinkedIn" /></a><a rel="nofollow"   href="http://www.blinklist.com/index.php?Action=Blink/addblink.php&amp;Url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2012%2F02%2F10%2Fm3-timers-improved-server-monitoring%2F&amp;Title=M3%20Timers%20-%20improved%20server%20monitoring" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/blinklist.png" class="sociable-img sociable-hovers" title="BlinkList" alt="BlinkList" /></a><a rel="nofollow"   href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2012%2F02%2F10%2Fm3-timers-improved-server-monitoring%2F&amp;title=M3%20Timers%20-%20improved%20server%20monitoring" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/dzone.png" class="sociable-img sociable-hovers" title="DZone" alt="DZone" /></a><a rel="nofollow"   href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2012%2F02%2F10%2Fm3-timers-improved-server-monitoring%2F&amp;title=M3%20Timers%20-%20improved%20server%20monitoring&amp;annotation=Unleashing%20the%20power%20of%20M3%20%26amp%3B%20timers%0D%0A%0D%0ADuring%20the%20lifespan%20of%20M3%20%28Monitis%20Monitor%20Manager%29%20there%20has%20always%20been%20something%20lacking%20%E2%80%93%20timers.%0D%0A%0D%0AM3%20execution%20procedure%20was%20outlined%20in%20this%20previous%20article.%0D%0A%0D%0AThe%20execution%20mentioned%20in%20the%20latt" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/googlebookmark.png" class="sociable-img sociable-hovers" title="Google Bookmarks" alt="Google Bookmarks" /></a><a rel="nofollow"   href="http://reddit.com/submit?url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2012%2F02%2F10%2Fm3-timers-improved-server-monitoring%2F&amp;title=M3%20Timers%20-%20improved%20server%20monitoring" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/reddit.png" class="sociable-img sociable-hovers" title="Reddit" alt="Reddit" /></a><a rel="nofollow"   href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2012%2F02%2F10%2Fm3-timers-improved-server-monitoring%2F&amp;title=M3%20Timers%20-%20improved%20server%20monitoring" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/stumbleupon.png" class="sociable-img sociable-hovers" title="StumbleUpon" alt="StumbleUpon" /></a><a rel="nofollow"   href="http://twitter.com/home?status=M3%20Timers%20-%20improved%20server%20monitoring%20-%20http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2012%2F02%2F10%2Fm3-timers-improved-server-monitoring%2F" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/twitter.png" class="sociable-img sociable-hovers" title="Twitter" alt="Twitter" /></a><a rel="nofollow"   href="http://blog.monitis.com/index.php/feed/" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/rss.png" class="sociable-img sociable-hovers" title="RSS" alt="RSS" /></a><br/><br/>]]></content:encoded>
			<wfw:commentRss>http://blog.monitis.com/index.php/2012/02/10/m3-timers-improved-server-monitoring/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>M3 code refactor &amp; DBI support</title>
		<link>http://blog.monitis.com/index.php/2012/01/27/m3-code-refactor-dbi-support/</link>
		<comments>http://blog.monitis.com/index.php/2012/01/27/m3-code-refactor-dbi-support/#comments</comments>
		<pubDate>Fri, 27 Jan 2012 22:35:44 +0000</pubDate>
		<dc:creator>Dan Fruehauf</dc:creator>
				<category><![CDATA[101 Reasons To Choose Monitis]]></category>
		<category><![CDATA[Applications Monitoring]]></category>
		<category><![CDATA[Database Management]]></category>
		<category><![CDATA[Database Monitoring]]></category>
		<category><![CDATA[Management Scripts]]></category>
		<category><![CDATA[Monitis API]]></category>
		<category><![CDATA[Monitoring Scripts]]></category>
		<category><![CDATA[MS SQL Server Monitoring]]></category>
		<category><![CDATA[MySQL monitoring]]></category>
		<category><![CDATA[Network Monitoring]]></category>
		<category><![CDATA[Server Management]]></category>
		<category><![CDATA[Sysadmin Tools]]></category>
		<category><![CDATA[Uptime Monitoring]]></category>
		<category><![CDATA[Website Monitoring]]></category>
		<category><![CDATA[agent-based monitoring]]></category>
		<category><![CDATA[command-line tools]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[DBI]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[M3]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[systems administration]]></category>

		<guid isPermaLink="false">http://blog.monitis.com/?p=4833</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://blog.monitis.com/index.php/2012/01/27/m3-code-refactor-dbi-support/' addthis:title='M3 code refactor &#38; DBI support '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>Pluggable M3 (Monitis Monitor Manager) Framework Who needs an introduction about M3? &#8211; Perhaps no one! After gaining some reputation with M3, providing extra-easy integration of any monitor into Monitis it was time to take it to the next level. Generally speaking, the work flow of M3 was described in detail in this article. After [...]]]></description>
			<content:encoded><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://blog.monitis.com/index.php/2012/01/27/m3-code-refactor-dbi-support/' addthis:title='M3 code refactor &amp; DBI support '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div><p><a href="http://blog.monitis.com/wp-content/uploads/2012/01/PluggableM3FlowChart.jpg"><img style="margin: 10px; float: right;" src="http://blog.monitis.com/wp-content/uploads/2012/01/PluggableM3FlowChart.jpg" alt="" width="250" /></a></p>
<h3 id="internal-source-marker_0.17348082229178274">Pluggable M3 (Monitis Monitor Manager) Framework</h3>
<p>Who needs an introduction about M3? &#8211; Perhaps no one!<br />
After gaining some reputation with M3, providing extra-easy integration of any monitor into <a href="http://www.monitis.com/">Monitis</a> it was time to take it to the next level.</p>
<p>Generally speaking, the work flow of M3 was described in detail in <a href="../index.php/2011/11/11/the-simplicity-of-server-monitoring-monitis-m3/">this article</a>.</p>
<p>After some thought and design, we&#8217;ve decided it&#8217;d be best if M3 was pluggable. Pluggable in terms of being able to easily add execution and parsing plugins.<br />
The interface and behavior of M3 stayed exactly the same, however now it is much easier to obtain data from any source and parse the data the way you want it.<br />
Saying that, it was time to put the new design for a test. We tried to integrate the <a href="../index.php/2011/07/30/a-dbi-interface-for-monitis/">DBI support</a> into M3.<br />
Guess what – it was much easier than expected!<span id="more-4833"></span></p>
<h3>The general idea of DB integration with Monitis</h3>
<p>DB (as in Database) integration with <a href="http://www.monitis.com/">Monitis</a> has shown to be invaluable. Being able to extract application related data from a DB and load it to Monitis means you can graph anything going on in your database related application. Monitoring your DB is an integral part of server monitoring in today&#8217;s world.</p>
<p>Be it maximum number of users at peak hours, gathering statistics about record usage or just checking if your DB is serving requests quickly enough &#8211; graphing performance and uptime. Your imagination is the limit – considering your application is DB related of course.</p>
<h3>How it&#8217;s done – the technicalities beyond</h3>
<p>The sharp-eyed among you would notice that <a href="https://github.com/monitisexchange/Monitis-Linux-Scripts/tree/master/M3">M3</a> got beefed up with a directory named “Execution” and a directory named “Parsing”.<br />
These directories hold the plugins M3 uses for each.</p>
<p>All that I had to do to add DBI support is to create a new execution plugin called “DBI.pm” and fill it up with code from the <a href="../index.php/2011/07/30/a-dbi-interface-for-monitis/">Monitis DBI module</a> which already existed.</p>
<p>And that my friends, that, was easy. Mission accomplished – Pluggable M3 eases the job for us.</p>
<h3>Another way to integrate MySQL</h3>
<p>MySQL could have been integrated previously into <a href="https://github.com/monitisexchange/Monitis-Linux-Scripts/tree/master/M3">M3</a> by executing mysql and feeding it with a query, having something similar to:</p>
<pre style="padding-left: 30px; padding-bottom: 1em;"><code> &lt;exectemplate&gt;echo "select count(*) from mysql.user;" | mysql&lt;/exectemplate&gt; </code></pre>
<p>This form of execution will invoke the &#8216;mysql&#8217; executable, feeding it the above query. Execution of this will result in the response of the query being returned with some other useless output.</p>
<p>Please avoid this form of execution, as now DBI support is fully integrated into M3. In the next paragraph I&#8217;ll show how it should be done.</p>
<h3>Lets fetch</h3>
<p>While conveying ideas about M3, I decided to prefer to provide very simple examples of operation, however, I encourage you, the end user to let your imagination go wild, adding interesting counters which show how your application really perform and behave.</p>
<p>In <a href="https://github.com/monitisexchange/Monitis-Linux-Scripts/blob/master/M3/dbi_sample.xml">this example</a> we&#8217;ll just count the number of users in an installed MySQL database. An example anyone should be able to imitate and then scale to his own need.</p>
<p>We&#8217;ll examine the <a href="https://github.com/monitisexchange/Monitis-Linux-Scripts/blob/master/M3/dbi_sample.xml">following example</a>. I suggest opening the mentioned link in a new window while continuing the read.<br />
Looking at this example it is quite straight-forward to understand. The query to execute is over there, together with some other parameters which are mandatory to connect to a database, such as the database name, user name, password, etc.</p>
<p>An explanation should be provided however for the odd db_statistics parameter. Those of you who have read the <a href="../index.php/2011/09/27/http-extraction-with-monitis/">HTTP extraction article</a> about M3 would have probably remembered the <em>http_statistics</em> parameter. Then, the <em>db_statistics</em> one does more or less the same, providing some meta counters for the query:</p>
<ol>
<li>How long did the query take to process (in seconds)</li>
<li>The success/failure of the query (1 for success, 0 for failure)</li>
</ol>
<p>I encourage to do the parsing of query results, or actually the lack-of-parsing of query results in a way that takes the whole output returns from the query, hence the regular expression of <em>(.*)</em>.</p>
<p>If your query returns more than what you need, <strong>please tune your query better</strong>.<br />
Test your execution with:</p>
<pre style="padding-left: 30px; padding-bottom: 1em;"><code> # ./DryRun.pl dbi_sample.xml DB: 'root@DBI:mysql:mysql:localhost', Query: 'select count(*) from mysql.user;' at MonitisMonitorManager.pm line 223 Matched '(.*)'=&gt;'6' in '6' at MonitisMonitorManager.pm line 237 OK This is a dry run, data for monitor 'Sample MySQL Monitor' was not really updated. at ./DryRun.pl line 18 </code></pre>
<p>It should work. Then you can work your query to fit your own needs.</p>
<h3>Next in line</h3>
<p>We&#8217;re looking for some more new ideas to add as plugins for M3. If you have any idea about any plugin (execution or parsing plugin) that you would like to see in M3 – we want to hear you!</p>
<p>Integrating software into the powerful <a href="http://www.monitis.com/">Monitis</a> has never been easier, now that you have M3!</p>
<p><a href="http://www.monitis.com/">Monitis</a> can monitor anything! Follow us also on<a href="http://twitter.com/#%21/monitis"> Twitter</a> and<a href="https://github.com/monitisexchange"> GitHub</a>.</p>
Share Now:<a rel="nofollow"   href="http://delicious.com/post?url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2012%2F01%2F27%2Fm3-code-refactor-dbi-support%2F&amp;title=M3%20code%20refactor%20%26amp%3B%20DBI%20support&amp;notes=%0D%0APluggable%20M3%20%28Monitis%20Monitor%20Manager%29%20Framework%0D%0AWho%20needs%20an%20introduction%20about%20M3%3F%20-%20Perhaps%20no%20one%21%0D%0AAfter%20gaining%20some%20reputation%20with%20M3%2C%20providing%20extra-easy%20integration%20of%20any%20monitor%20into%20Monitis%20it%20was%20time%20to%20take%20it%20to%20the%20next%20level.%0D%0A" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/delicious.png" class="sociable-img sociable-hovers" title="del.icio.us" alt="del.icio.us" /></a><a rel="nofollow"   href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2012%2F01%2F27%2Fm3-code-refactor-dbi-support%2F&amp;title=M3%20code%20refactor%20%26amp%3B%20DBI%20support&amp;bodytext=%0D%0APluggable%20M3%20%28Monitis%20Monitor%20Manager%29%20Framework%0D%0AWho%20needs%20an%20introduction%20about%20M3%3F%20-%20Perhaps%20no%20one%21%0D%0AAfter%20gaining%20some%20reputation%20with%20M3%2C%20providing%20extra-easy%20integration%20of%20any%20monitor%20into%20Monitis%20it%20was%20time%20to%20take%20it%20to%20the%20next%20level.%0D%0A" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/digg.png" class="sociable-img sociable-hovers" title="Digg" alt="Digg" /></a><a rel="nofollow"   href="http://www.facebook.com/share.php?u=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2012%2F01%2F27%2Fm3-code-refactor-dbi-support%2F&amp;t=M3%20code%20refactor%20%26amp%3B%20DBI%20support" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/facebook.png" class="sociable-img sociable-hovers" title="Facebook" alt="Facebook" /></a><a rel="nofollow"   href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2012%2F01%2F27%2Fm3-code-refactor-dbi-support%2F&amp;title=M3%20code%20refactor%20%26amp%3B%20DBI%20support&amp;source=Uptime+%26amp%3B+Performance+Tips+Tips+for+SysAdmin%2C+Webmaster%2C+Network+Admin&amp;summary=%0D%0APluggable%20M3%20%28Monitis%20Monitor%20Manager%29%20Framework%0D%0AWho%20needs%20an%20introduction%20about%20M3%3F%20-%20Perhaps%20no%20one%21%0D%0AAfter%20gaining%20some%20reputation%20with%20M3%2C%20providing%20extra-easy%20integration%20of%20any%20monitor%20into%20Monitis%20it%20was%20time%20to%20take%20it%20to%20the%20next%20level.%0D%0A" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/linkedin.png" class="sociable-img sociable-hovers" title="LinkedIn" alt="LinkedIn" /></a><a rel="nofollow"   href="http://www.blinklist.com/index.php?Action=Blink/addblink.php&amp;Url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2012%2F01%2F27%2Fm3-code-refactor-dbi-support%2F&amp;Title=M3%20code%20refactor%20%26amp%3B%20DBI%20support" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/blinklist.png" class="sociable-img sociable-hovers" title="BlinkList" alt="BlinkList" /></a><a rel="nofollow"   href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2012%2F01%2F27%2Fm3-code-refactor-dbi-support%2F&amp;title=M3%20code%20refactor%20%26amp%3B%20DBI%20support" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/dzone.png" class="sociable-img sociable-hovers" title="DZone" alt="DZone" /></a><a rel="nofollow"   href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2012%2F01%2F27%2Fm3-code-refactor-dbi-support%2F&amp;title=M3%20code%20refactor%20%26amp%3B%20DBI%20support&amp;annotation=%0D%0APluggable%20M3%20%28Monitis%20Monitor%20Manager%29%20Framework%0D%0AWho%20needs%20an%20introduction%20about%20M3%3F%20-%20Perhaps%20no%20one%21%0D%0AAfter%20gaining%20some%20reputation%20with%20M3%2C%20providing%20extra-easy%20integration%20of%20any%20monitor%20into%20Monitis%20it%20was%20time%20to%20take%20it%20to%20the%20next%20level.%0D%0A" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/googlebookmark.png" class="sociable-img sociable-hovers" title="Google Bookmarks" alt="Google Bookmarks" /></a><a rel="nofollow"   href="http://reddit.com/submit?url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2012%2F01%2F27%2Fm3-code-refactor-dbi-support%2F&amp;title=M3%20code%20refactor%20%26amp%3B%20DBI%20support" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/reddit.png" class="sociable-img sociable-hovers" title="Reddit" alt="Reddit" /></a><a rel="nofollow"   href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2012%2F01%2F27%2Fm3-code-refactor-dbi-support%2F&amp;title=M3%20code%20refactor%20%26amp%3B%20DBI%20support" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/stumbleupon.png" class="sociable-img sociable-hovers" title="StumbleUpon" alt="StumbleUpon" /></a><a rel="nofollow"   href="http://twitter.com/home?status=M3%20code%20refactor%20%26amp%3B%20DBI%20support%20-%20http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2012%2F01%2F27%2Fm3-code-refactor-dbi-support%2F" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/twitter.png" class="sociable-img sociable-hovers" title="Twitter" alt="Twitter" /></a><a rel="nofollow"   href="http://blog.monitis.com/index.php/feed/" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/rss.png" class="sociable-img sociable-hovers" title="RSS" alt="RSS" /></a><br/><br/>]]></content:encoded>
			<wfw:commentRss>http://blog.monitis.com/index.php/2012/01/27/m3-code-refactor-dbi-support/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using Tomcat With a Database &#8211; Performance Optimization Tips</title>
		<link>http://blog.monitis.com/index.php/2012/01/24/using-tomcat-with-a-database-performance-optimization-tips/</link>
		<comments>http://blog.monitis.com/index.php/2012/01/24/using-tomcat-with-a-database-performance-optimization-tips/#comments</comments>
		<pubDate>Tue, 24 Jan 2012 08:30:43 +0000</pubDate>
		<dc:creator>Hovhannes Avoyan</dc:creator>
				<category><![CDATA[Java Monitoring]]></category>
		<category><![CDATA[MySQL monitoring]]></category>
		<category><![CDATA[Performance Management]]></category>
		<category><![CDATA[Website Monitoring]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[apache tomcat]]></category>
		<category><![CDATA[apache tuning]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[java servlet]]></category>
		<category><![CDATA[javaserver pages]]></category>
		<category><![CDATA[JSP]]></category>
		<category><![CDATA[tomcat]]></category>

		<guid isPermaLink="false">http://blog.monitis.com/?p=5120</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://blog.monitis.com/index.php/2012/01/24/using-tomcat-with-a-database-performance-optimization-tips/' addthis:title='Using Tomcat With a Database &#8211; Performance Optimization Tips '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>The Internet is a great resource, but it is sometimes too much to wade through hundreds of web pages looking for tips about using Tomcat with a database. So we at Monitis have done it for you! Below are some of the more useful tips found in various places on the Internet. Tip #1 – [...]]]></description>
			<content:encoded><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://blog.monitis.com/index.php/2012/01/24/using-tomcat-with-a-database-performance-optimization-tips/' addthis:title='Using Tomcat With a Database &#8211; Performance Optimization Tips '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div><p><img class="alignnone size-full wp-image-3372" style="float: right; padding: 10;" title="java_tomcat" src="http://blog.monitis.com/wp-content/uploads/2011/08/java_tomcat.jpg" alt="" width="150" /></p>
<p>The Internet is a great resource, but it is sometimes too much to wade through hundreds of web pages looking for tips about using Tomcat with a database. So we at Monitis have done it for you! Below are some of the more useful tips found in various places on the Internet.</p>
<h3><span id="more-5120"></span>Tip #1 – Don’t Ignore Database Performance</h3>
<p>Webapps typically use databases. So, you have to tune the webapp along with the database if you want optimal performance. Take our advice. Performance test the database and define an appropriate database connection pool (maxActive, maxIdle, and maxWait in the Resource element).</p>
<h3>Tip #2 – Determine the Cause of Database Connection Timeouts</h3>
<p>Simply increasing maxWait in the resource element may not be the best way to deal with database connection timeouts. The timeouts may be the result of garbage collection.</p>
<p>Garbage collection requires that all running processes in the Java virtual machine be temporarily suspended. If garbage collection takes too long, the database connections will time out. The timeout here is not because of some problem in the application. It is simply because garbage collection is taking too long.</p>
<p>The more frequently garbage is collected, the less garbage there will be to collect each time. Configure garbage collection so it does not take more than one second.</p>
<h3>Tip #3 – Share Database Connections</h3>
<p>If every application opens and closes its own database connections, all applications run slower. Instead, if applications share connections by returning them to a common pool rather than closing them, all applications run faster.</p>
<p>Tomcat can be configured for this type of connection pooling. Simply set maxActive and maxIdle to appropriate values in the resource element.</p>
<h3>Tip #4 – Return Database Connections to the Pool Properly</h3>
<p>Do not close database connections twice. When using connection pooling, the first time you close you return the connection to the pool, and the second time you close, you could inadvertently close the connection after another application has started using it. If you are experiencing “Connection Closed” exceptions, this may be the cause. So, don’t do that!</p>
<h3>Tip #5 – Configure Your Database as a Global Naming Resource or For a Single Context</h3>
<p>Identify the Java Database Connectivity (JDBC) database in a resource element in the context.xml file if you want the resource to be available to one application only. Identify the JDBC resource in a resource element in the server.xml file if you want the resource to be available to all applications.</p>
<p>If multiple applications need access to a database, the database resource can be created globally in the server.xml file or each application can create its own resource in its own context.xml file. You need to decide which is best.</p>
<p>Making databases available to one application only (in context.xml) creates the resource when the application starts. Making databases available globally (in server.xml) creates the resource when the server starts, which means restarting the server every time you make changes to the resource configuration.</p>
<p>Configuring the database resource in the context.xml file once for each application is recommended because it makes the application more portable.</p>
<p>If different applications have different access levels and those access levels are determined by the database user id, then the database resource must be configured in each application’s context.xml file.</p>
<h3>Tip #6 – Do Not Use the JDBC-ODBC Bridge</h3>
<p>The JDBC-ODBC (Open Database Connectivity) Bridge bundled with Tomcat’s Java Development Kit (JDK) was never intended for a production environment. Use a third-party driver instead.</p>
<p>Using Tomcat with a database is easy. All you have to know are some good tips to keep your database performing trouble-free. Monitis is happy to provide you with this knowledge and advice. Read more about Tomcat here!</p>
<p>More about <a title="Tomcat performance " href="http://blog.monitis.com/index.php/tag/tomcat/">Apache Tomcat performance optimization</a> tips here.</p>
Share Now:<a rel="nofollow"   href="http://delicious.com/post?url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2012%2F01%2F24%2Fusing-tomcat-with-a-database-performance-optimization-tips%2F&amp;title=Using%20Tomcat%20With%20a%20Database%20-%20Performance%20Optimization%20Tips&amp;notes=%0D%0A%0D%0AThe%20Internet%20is%20a%20great%20resource%2C%20but%20it%20is%20sometimes%20too%20much%20to%20wade%20through%20hundreds%20of%20web%20pages%20looking%20for%20tips%20about%20using%20Tomcat%20with%20a%20database.%20So%20we%20at%20Monitis%20have%20done%20it%20for%20you%21%20Below%20are%20some%20of%20the%20more%20useful%20tips%20found%20in%20vario" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/delicious.png" class="sociable-img sociable-hovers" title="del.icio.us" alt="del.icio.us" /></a><a rel="nofollow"   href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2012%2F01%2F24%2Fusing-tomcat-with-a-database-performance-optimization-tips%2F&amp;title=Using%20Tomcat%20With%20a%20Database%20-%20Performance%20Optimization%20Tips&amp;bodytext=%0D%0A%0D%0AThe%20Internet%20is%20a%20great%20resource%2C%20but%20it%20is%20sometimes%20too%20much%20to%20wade%20through%20hundreds%20of%20web%20pages%20looking%20for%20tips%20about%20using%20Tomcat%20with%20a%20database.%20So%20we%20at%20Monitis%20have%20done%20it%20for%20you%21%20Below%20are%20some%20of%20the%20more%20useful%20tips%20found%20in%20vario" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/digg.png" class="sociable-img sociable-hovers" title="Digg" alt="Digg" /></a><a rel="nofollow"   href="http://www.facebook.com/share.php?u=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2012%2F01%2F24%2Fusing-tomcat-with-a-database-performance-optimization-tips%2F&amp;t=Using%20Tomcat%20With%20a%20Database%20-%20Performance%20Optimization%20Tips" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/facebook.png" class="sociable-img sociable-hovers" title="Facebook" alt="Facebook" /></a><a rel="nofollow"   href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2012%2F01%2F24%2Fusing-tomcat-with-a-database-performance-optimization-tips%2F&amp;title=Using%20Tomcat%20With%20a%20Database%20-%20Performance%20Optimization%20Tips&amp;source=Uptime+%26amp%3B+Performance+Tips+Tips+for+SysAdmin%2C+Webmaster%2C+Network+Admin&amp;summary=%0D%0A%0D%0AThe%20Internet%20is%20a%20great%20resource%2C%20but%20it%20is%20sometimes%20too%20much%20to%20wade%20through%20hundreds%20of%20web%20pages%20looking%20for%20tips%20about%20using%20Tomcat%20with%20a%20database.%20So%20we%20at%20Monitis%20have%20done%20it%20for%20you%21%20Below%20are%20some%20of%20the%20more%20useful%20tips%20found%20in%20vario" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/linkedin.png" class="sociable-img sociable-hovers" title="LinkedIn" alt="LinkedIn" /></a><a rel="nofollow"   href="http://www.blinklist.com/index.php?Action=Blink/addblink.php&amp;Url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2012%2F01%2F24%2Fusing-tomcat-with-a-database-performance-optimization-tips%2F&amp;Title=Using%20Tomcat%20With%20a%20Database%20-%20Performance%20Optimization%20Tips" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/blinklist.png" class="sociable-img sociable-hovers" title="BlinkList" alt="BlinkList" /></a><a rel="nofollow"   href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2012%2F01%2F24%2Fusing-tomcat-with-a-database-performance-optimization-tips%2F&amp;title=Using%20Tomcat%20With%20a%20Database%20-%20Performance%20Optimization%20Tips" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/dzone.png" class="sociable-img sociable-hovers" title="DZone" alt="DZone" /></a><a rel="nofollow"   href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2012%2F01%2F24%2Fusing-tomcat-with-a-database-performance-optimization-tips%2F&amp;title=Using%20Tomcat%20With%20a%20Database%20-%20Performance%20Optimization%20Tips&amp;annotation=%0D%0A%0D%0AThe%20Internet%20is%20a%20great%20resource%2C%20but%20it%20is%20sometimes%20too%20much%20to%20wade%20through%20hundreds%20of%20web%20pages%20looking%20for%20tips%20about%20using%20Tomcat%20with%20a%20database.%20So%20we%20at%20Monitis%20have%20done%20it%20for%20you%21%20Below%20are%20some%20of%20the%20more%20useful%20tips%20found%20in%20vario" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/googlebookmark.png" class="sociable-img sociable-hovers" title="Google Bookmarks" alt="Google Bookmarks" /></a><a rel="nofollow"   href="http://reddit.com/submit?url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2012%2F01%2F24%2Fusing-tomcat-with-a-database-performance-optimization-tips%2F&amp;title=Using%20Tomcat%20With%20a%20Database%20-%20Performance%20Optimization%20Tips" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/reddit.png" class="sociable-img sociable-hovers" title="Reddit" alt="Reddit" /></a><a rel="nofollow"   href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2012%2F01%2F24%2Fusing-tomcat-with-a-database-performance-optimization-tips%2F&amp;title=Using%20Tomcat%20With%20a%20Database%20-%20Performance%20Optimization%20Tips" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/stumbleupon.png" class="sociable-img sociable-hovers" title="StumbleUpon" alt="StumbleUpon" /></a><a rel="nofollow"   href="http://twitter.com/home?status=Using%20Tomcat%20With%20a%20Database%20-%20Performance%20Optimization%20Tips%20-%20http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2012%2F01%2F24%2Fusing-tomcat-with-a-database-performance-optimization-tips%2F" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/twitter.png" class="sociable-img sociable-hovers" title="Twitter" alt="Twitter" /></a><a rel="nofollow"   href="http://blog.monitis.com/index.php/feed/" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/rss.png" class="sociable-img sociable-hovers" title="RSS" alt="RSS" /></a><br/><br/>]]></content:encoded>
			<wfw:commentRss>http://blog.monitis.com/index.php/2012/01/24/using-tomcat-with-a-database-performance-optimization-tips/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Integrate NGINX Monitoring into Monitis.com</title>
		<link>http://blog.monitis.com/index.php/2012/01/23/integrate-nginx-monitoring-into-monitis-com/</link>
		<comments>http://blog.monitis.com/index.php/2012/01/23/integrate-nginx-monitoring-into-monitis-com/#comments</comments>
		<pubDate>Mon, 23 Jan 2012 09:33:26 +0000</pubDate>
		<dc:creator>glenn.chen</dc:creator>
				<category><![CDATA[Management Scripts]]></category>
		<category><![CDATA[Monitoring Scripts]]></category>
		<category><![CDATA[Performance Management]]></category>
		<category><![CDATA[Sysadmin Tools]]></category>
		<category><![CDATA[Web Server Monitoring]]></category>
		<category><![CDATA[Website Monitoring]]></category>
		<category><![CDATA[Nginx]]></category>

		<guid isPermaLink="false">http://blog.monitis.com/?p=4962</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://blog.monitis.com/index.php/2012/01/23/integrate-nginx-monitoring-into-monitis-com/' addthis:title='Integrate NGINX Monitoring into Monitis.com '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>&#160; &#160; NGINX is the new rising star among other web servers. In fact, NGINX is now the 2nd most widely used web server (22 million websites) in the world. NGINX fanboys will tell you no one can top their love of NGINX, because it succeeds in efforts to achieve high performance with small memory [...]]]></description>
			<content:encoded><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://blog.monitis.com/index.php/2012/01/23/integrate-nginx-monitoring-into-monitis-com/' addthis:title='Integrate NGINX Monitoring into Monitis.com '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div><div>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>NGINX is the new rising star among <a href="http://blog.monitis.com/wp-content/uploads/2012/02/NGINX1.jpg"><img class="size-full wp-image-5017 alignright" src="http://blog.monitis.com/wp-content/uploads/2012/02/NGINX1.jpg" alt="NGINX's logo" width="290" height="76" /></a>other web servers. In fact, NGINX is now <a title="NGINX takes 2nd place in Web Servers" href="http://news.netcraft.com/archives/2012/01/03/january-2012-web-server-survey.html">the 2nd most widely used </a><a title="NGINX takes 2nd place in Web Servers" href="http://news.netcraft.com/archives/2012/01/03/january-2012-web-server-survey.html">web server</a> (22 million websites) in the world. NGINX fanboys will tell you no one can top their love of NGINX, because it succeeds in efforts to achieve high performance with small memory footprint. It makes NGINX suitable to deliver static content, to work as a reverse proxy, or even to run as a load balancer, all of the above in a fast and scalable way. Several well-known companies pick NGINX to power their sites, including <a title="wordpress" href="http://wordpress.com/" target="_blank">WordPress</a> and <a title="github" href="https://github.com/" target="_blank">Github</a>.<span id="more-4962"></span></p>
<p>Konwningly NGINX is lightweight and powerful, a good system administrator will not simply install NGINX and hope for the best. Yes, a good systemadmin has an option to turn on NGINX&#8217;s <a href="http://wiki.nginx.org/NginxHttpStubStatusModule" target="_blank">stub_staus</a> module, so that she can monitor NGINX servers and, make sure everything is running nice and smooth. The statistics include active connections, requests handled, keep-alive connections and more. Here is an example output from the stub_status module:</p>
<pre>Active connections: 291
server accepts handled requests
16630948 16630948 31070465
Reading: 6 Writing: 179 Waiting: 106</pre>
<p>&nbsp;</p>
<p>However, the NGINX statistics above is not reader friendly. Can we do better? With <a title="monitis" href="http://portal.monitis.com/" target="_blank">Monitis</a>&#8216; support, the answer is yes. Last time we showed you <a title="Permanent Link to Integrate Apache Monitoring into Monitis.com" href="../index.php/2011/07/03/integrate-apache-monitoring-into-monitis-com/" rel="bookmark">how to Integrate Apache Monitoring into Monitis.com</a>; today we will show you how to integrate Monitis with NGINX. Let&#8217;s turn the cryptic data above into an eye-candy report in five simple steps:</p>
<p>&nbsp;</p>
<h2>Collect NGINX Statistics to Your Monitis account:</h2>
<p>&nbsp;</p>
</div>
<p><a href="http://blog.monitis.com/wp-content/uploads/2012/02/nginxgraph.png"><img class="alignleft size-full wp-image-5025" src="http://blog.monitis.com/wp-content/uploads/2012/02/nginxgraph.png" alt="" width="400" height="224" /></a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><em>Figure 1: Monitis shows a nice graph for NGINX Stub Staus.</em></p>
<p><a href="http://blog.monitis.com/wp-content/uploads/2012/02/nginxstat.png"><img class="alignleft size-full wp-image-5026" src="http://blog.monitis.com/wp-content/uploads/2012/02/nginxstat.png" alt="" width="400" height="223" /></a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><em>Figure 2: Monitis provides a cleaner output for NGINX Ser</em><em>ver Stats</em>.</p>
<p>In a nutshell, the example here simply fetch your NGINX stats, and send them to your Monitis account periodically:</p>
<h3>1. Install NGINX stub_status module.</h3>
<h3>2. Edit your nginx.conf.</h3>
<pre>   Here we use port <em>80</em>, and listen on <em>localhost</em> with address of <em>nginx_status</em>.
   server {
          listen               80;
          server_name   localhost;
          location /nginx_status {
          stub_status         on;
          access_log         off;
          allow        127.0.0.1;
          deny               all;
          }
   }
   That is, with the configuration above, you can view the original
   NGINX stats @ http://localhost/nginx_status</pre>
<h3>3. Start your NGINX Server.</h3>
<h3>4. <a href="https://github.com/monitisexchange/Monitis-Linux-Scripts/tree/master/nginx/csharp/monitis_nginx_stats/sample" target="_blank">Download</a> the code and run the program.</h3>
<pre>   On your windows command line, run the program like this:</pre>
<pre>   monitis_nigix_stats.exe "[apikey]" "[secretkey]"
   "[monitorname]" "[minitortag]" "[nginx stub status url]"<em> </em></pre>
<pre>   For example, assume you already have a Monitis account:</pre>
<pre>   monitis_nginx_stats.exe "14NAC40PIMSUEEBQFJOQL18T5U"  
   "74H6U7A2DG71JU80QR48FEOPAL"  "Nginx  Monitor"
   "Nginx+Stub+Status" "http://localhost/nginx_status"</pre>
<h3>5. Log in to your Monitis account and start monitoring.</h3>
<pre>   You can see a new custom monitor ready to be added.
   (Monitors-&gt;Manage Monitors-&gt;Custom Monitors).
   Check and add your new monitor to your dashboard.

  <a href="http://3.bp.blogspot.com/-VPggR06bLUU/TxIeMXc5YxI/AAAAAAAABI8/CUyLnPZdNMY/s1600/addmonitor.png"><img src="http://3.bp.blogspot.com/-VPggR06bLUU/TxIeMXc5YxI/AAAAAAAABI8/CUyLnPZdNMY/s400/addmonitor.png" alt="" width="400" height="225" border="0" /></a></pre>
<p>&nbsp;</p>
<h2>Conclusion:</h2>
<p>In this article, we demonstrate an enterprise solution in NGINX monitoring. In five steps, Monitis is able to organize the statistics into columns; you can also track data continuously with a nice graph. Furthermore, you can add as many custom monitors as you like, all in your Monitis dashboard. Get your <a href="https://www.monitis.com/free_signup.jsp" target="_blank">free registration here</a>, and monitor your NGINX servers effectively.</p>
<p>Happy NGINX monitoring!</p>
<p>The Monitis Team<br />
&#8212;</p>
<p><a href="https://www.monitis.com/free_signup.jsp?utm_source=blog&amp;utm_medium=banner&amp;utm_campaign=apache1"><img src="http://blog.monitis.com/wp-content/uploads/2011/07/Banner-468-x-60.jpg" alt="Monitis Monitoring Platform" width="468" height="60" /></a></p>
<p>External Scripts:</p>
<p>NGINX Monitoring in C#<br />
<a href="https://github.com/monitisexchange/Monitis-Linux-Scripts/tree/master/nginx/csharp" target="_blank">https://github.com/monitisexchange/Monitis-Linux-Scripts/tree/master/nginx/csharp</a></p>
<p>NGINX Monitoring in Python<br />
<a href="https://github.com/monitisexchange/Monitis-Linux-Scripts/tree/master/nginx/python" target="_blank">https://github.com/monitisexchange/Monitis-Linux-Scripts/tree/master/nginx/python</a></p>
<p>External Links for further information:<br />
<a href="http://monitis.com/api/api.html#addCustomMonitor">http://monitis.com/api/api.html#addCustomMonitor</a><br />
<a href="https://www.monitis.com/free_signup.jsp">https://www.monitis.com/free_signup.jsp</a></p>
Share Now:<a rel="nofollow"   href="http://delicious.com/post?url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2012%2F01%2F23%2Fintegrate-nginx-monitoring-into-monitis-com%2F&amp;title=Integrate%20NGINX%20Monitoring%20into%20Monitis.com%20&amp;notes=%0D%0A%0D%0A%26nbsp%3B%0D%0A%0D%0A%26nbsp%3B%0D%0A%0D%0ANGINX%20is%20the%20new%20rising%20star%20among%20other%20web%20servers.%20In%20fact%2C%20NGINX%20is%20now%20the%202nd%20most%20widely%20used%20web%20server%20%2822%20million%20websites%29%20in%20the%20world.%20NGINX%20fanboys%20will%20tell%20you%20no%20one%20can%20top%20their%20love%20of%20NGINX%2C%20because%20it%20suc" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/delicious.png" class="sociable-img sociable-hovers" title="del.icio.us" alt="del.icio.us" /></a><a rel="nofollow"   href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2012%2F01%2F23%2Fintegrate-nginx-monitoring-into-monitis-com%2F&amp;title=Integrate%20NGINX%20Monitoring%20into%20Monitis.com%20&amp;bodytext=%0D%0A%0D%0A%26nbsp%3B%0D%0A%0D%0A%26nbsp%3B%0D%0A%0D%0ANGINX%20is%20the%20new%20rising%20star%20among%20other%20web%20servers.%20In%20fact%2C%20NGINX%20is%20now%20the%202nd%20most%20widely%20used%20web%20server%20%2822%20million%20websites%29%20in%20the%20world.%20NGINX%20fanboys%20will%20tell%20you%20no%20one%20can%20top%20their%20love%20of%20NGINX%2C%20because%20it%20suc" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/digg.png" class="sociable-img sociable-hovers" title="Digg" alt="Digg" /></a><a rel="nofollow"   href="http://www.facebook.com/share.php?u=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2012%2F01%2F23%2Fintegrate-nginx-monitoring-into-monitis-com%2F&amp;t=Integrate%20NGINX%20Monitoring%20into%20Monitis.com%20" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/facebook.png" class="sociable-img sociable-hovers" title="Facebook" alt="Facebook" /></a><a rel="nofollow"   href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2012%2F01%2F23%2Fintegrate-nginx-monitoring-into-monitis-com%2F&amp;title=Integrate%20NGINX%20Monitoring%20into%20Monitis.com%20&amp;source=Uptime+%26amp%3B+Performance+Tips+Tips+for+SysAdmin%2C+Webmaster%2C+Network+Admin&amp;summary=%0D%0A%0D%0A%26nbsp%3B%0D%0A%0D%0A%26nbsp%3B%0D%0A%0D%0ANGINX%20is%20the%20new%20rising%20star%20among%20other%20web%20servers.%20In%20fact%2C%20NGINX%20is%20now%20the%202nd%20most%20widely%20used%20web%20server%20%2822%20million%20websites%29%20in%20the%20world.%20NGINX%20fanboys%20will%20tell%20you%20no%20one%20can%20top%20their%20love%20of%20NGINX%2C%20because%20it%20suc" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/linkedin.png" class="sociable-img sociable-hovers" title="LinkedIn" alt="LinkedIn" /></a><a rel="nofollow"   href="http://www.blinklist.com/index.php?Action=Blink/addblink.php&amp;Url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2012%2F01%2F23%2Fintegrate-nginx-monitoring-into-monitis-com%2F&amp;Title=Integrate%20NGINX%20Monitoring%20into%20Monitis.com%20" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/blinklist.png" class="sociable-img sociable-hovers" title="BlinkList" alt="BlinkList" /></a><a rel="nofollow"   href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2012%2F01%2F23%2Fintegrate-nginx-monitoring-into-monitis-com%2F&amp;title=Integrate%20NGINX%20Monitoring%20into%20Monitis.com%20" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/dzone.png" class="sociable-img sociable-hovers" title="DZone" alt="DZone" /></a><a rel="nofollow"   href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2012%2F01%2F23%2Fintegrate-nginx-monitoring-into-monitis-com%2F&amp;title=Integrate%20NGINX%20Monitoring%20into%20Monitis.com%20&amp;annotation=%0D%0A%0D%0A%26nbsp%3B%0D%0A%0D%0A%26nbsp%3B%0D%0A%0D%0ANGINX%20is%20the%20new%20rising%20star%20among%20other%20web%20servers.%20In%20fact%2C%20NGINX%20is%20now%20the%202nd%20most%20widely%20used%20web%20server%20%2822%20million%20websites%29%20in%20the%20world.%20NGINX%20fanboys%20will%20tell%20you%20no%20one%20can%20top%20their%20love%20of%20NGINX%2C%20because%20it%20suc" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/googlebookmark.png" class="sociable-img sociable-hovers" title="Google Bookmarks" alt="Google Bookmarks" /></a><a rel="nofollow"   href="http://reddit.com/submit?url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2012%2F01%2F23%2Fintegrate-nginx-monitoring-into-monitis-com%2F&amp;title=Integrate%20NGINX%20Monitoring%20into%20Monitis.com%20" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/reddit.png" class="sociable-img sociable-hovers" title="Reddit" alt="Reddit" /></a><a rel="nofollow"   href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2012%2F01%2F23%2Fintegrate-nginx-monitoring-into-monitis-com%2F&amp;title=Integrate%20NGINX%20Monitoring%20into%20Monitis.com%20" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/stumbleupon.png" class="sociable-img sociable-hovers" title="StumbleUpon" alt="StumbleUpon" /></a><a rel="nofollow"   href="http://twitter.com/home?status=Integrate%20NGINX%20Monitoring%20into%20Monitis.com%20%20-%20http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2012%2F01%2F23%2Fintegrate-nginx-monitoring-into-monitis-com%2F" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/twitter.png" class="sociable-img sociable-hovers" title="Twitter" alt="Twitter" /></a><a rel="nofollow"   href="http://blog.monitis.com/index.php/feed/" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/rss.png" class="sociable-img sociable-hovers" title="RSS" alt="RSS" /></a><br/><br/>]]></content:encoded>
			<wfw:commentRss>http://blog.monitis.com/index.php/2012/01/23/integrate-nginx-monitoring-into-monitis-com/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>21 Apache Tomcat Configuration Tips</title>
		<link>http://blog.monitis.com/index.php/2011/12/14/21-apache-tomcat-configuration-tips/</link>
		<comments>http://blog.monitis.com/index.php/2011/12/14/21-apache-tomcat-configuration-tips/#comments</comments>
		<pubDate>Thu, 15 Dec 2011 07:57:06 +0000</pubDate>
		<dc:creator>Hovhannes Avoyan</dc:creator>
				<category><![CDATA[Performance Management]]></category>
		<category><![CDATA[Web Server Monitoring]]></category>
		<category><![CDATA[Website Monitoring]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[apache tomcat]]></category>
		<category><![CDATA[apache tuning]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[java servlet]]></category>
		<category><![CDATA[javaserver pages]]></category>
		<category><![CDATA[JSP]]></category>
		<category><![CDATA[tomcat]]></category>

		<guid isPermaLink="false">http://blog.monitis.com/?p=4701</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://blog.monitis.com/index.php/2011/12/14/21-apache-tomcat-configuration-tips/' addthis:title='21 Apache Tomcat Configuration Tips '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>Monitis is pleased to present the following tips for configuring Apache Tomcat for maximum performance. Apache Tomcat is an open source software implementation of the Java Servlet and JavaServer Pages technologies. Apache Tomcat powers numerous large-scale, mission-critical web applications across a diverse range of industries and organizations. Tip #1 &#8211; Watch Out for White Space [...]]]></description>
			<content:encoded><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://blog.monitis.com/index.php/2011/12/14/21-apache-tomcat-configuration-tips/' addthis:title='21 Apache Tomcat Configuration Tips '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div><p><img class="alignnone size-full wp-image-3372" style="float: right; padding: 10;" title="java_tomcat" src="http://blog.monitis.com/wp-content/uploads/2011/08/java_tomcat.jpg" alt="" width="150" />Monitis is pleased to present the following tips for configuring Apache Tomcat for maximum performance. Apache Tomcat is an open source software implementation of the Java Servlet and JavaServer Pages technologies. Apache Tomcat powers numerous large-scale, mission-critical web applications across a diverse range of industries and organizations.</p>
<h3><span id="more-4701"></span>Tip #1 &#8211; Watch Out for White Space</h3>
<p>When installing Tomcat under Windows, the path to the installation directory should not contain white space. The default (c:/Program Files) is not acceptable, because it contains a white space character. Installing under &#8220;C:/ProgramFiles&#8221; is acceptable because this path does not contain any white space characters.</p>
<h3>Tip #2 &#8211; Check The System Variables</h3>
<p>Regardless of the operating system that Tomcat is installed under, the installer should check the system variables to make sure they are set correctly. In particular, CATALINA_HOME should be set to Tomcat&#8217;s installation directory.</p>
<h3>Tip #3 &#8211; Set Username and Password for Tomcat Manager</h3>
<p>If you are using the Tomcat Manager, set a username and password. Set this username&#8217;s role to &#8220;manager,tomcat&#8221;.</p>
<h3>Tip #4 &#8211; Read the Log Files</h3>
<p>By default, Tomcat&#8217;s log files are stored in the CATALINA_HOME/log directory. Use them to solve a myriad of problems.</p>
<h3>Tip #5 &#8211; Configuring the Admin Web Application</h3>
<p>If you are using the admin webapp that comes with Tomcat, make sure the path specified in the docBase attribute of the Context element is absolute, not relative. The admin context can be specified in admin.xml (for auto deployment) or server.xml.</p>
<p>If you are not using the admin webapp, delete admin.xml.</p>
<h3>Tip #6 &#8211; The Admin Webapp vs. the Manager Webapp</h3>
<p>The manager webapp that comes with Tomcat is a scaled-down, simplified version of the admin webapp. The Manager webapp lets you install new webapps on a non-persistent basis for testing, and also allows you to stop, reload, remove, or undeploy webapps. For better security, use manager rather than admin wherever possible.</p>
<h3>Tip #7 &#8211; Two Options For Deploying a WAR File</h3>
<p>If you have a WAR file, you can deploy it by simply copying it into CATALINA_BASE/webapps. When Tomcat notices the new WAR file sitting there, it will unpack the file into the appropriate subdirectory and create a context for it. The context it creates is defined in the DefaultContext element in server.xml.</p>
<p>If it is not appropriate to use the default context, create a context fragment for the webapp, put it in a file named x.xml (where x is the name of your webapp), and put the file into CATALINA_BASE/webapps. The webapp itself can then be stored anywhere on the filesystem.</p>
<p>In either case, you can deploy your webapp without editing server.xml and without restarting Tomcat. One caveat: Do not turn off liveDeploy.</p>
<h3>Tip #8 &#8211; Configure Virtual Hosts in server.xml</h3>
<p>Your test environment can be set up as a virtual host by adding a host element to the engine element in server.xml. Don&#8217;t forget to create the appropriate DNS entry, too.</p>
<h3>Tip #9 &#8211; When Usage Increases, Balance the Load</h3>
<p>Tomcat provides several load balancing techniques that allow requests to be spread across multiple servers. See also the following link: <a href="http://people.apache.org/~markt/presentations/2009-04-01-TomcatTuning.pdf">http://people.apache.org/~markt/presentations/2009-04-01-TomcatTuning.pdf</a></p>
<h3>Tip #10 &#8211; Implement Custom Error Pages</h3>
<p>Default error pages do not give the end users useful information. Create your own error pages and give the end users meaningful messages.</p>
<h3>Tip #11 &#8211; Use a Logging Toolkit</h3>
<p>Eliminate System.err and System.out from application code. Use a logging toolkit (e.g., Log4J) instead.</p>
<h3>Tip #12 &#8211; Create Users to Access the Manager Webapp</h3>
<p>If you plan to use the manager webapp, the default configuration won&#8217;t help you much because there are no users with the manager role. Add the manager role and at least one user who has the manager role in CATALINA_HOME/conf/tomcat-users.xml.</p>
<h3>Tip #13 &#8211; Filter by IP or Host</h3>
<p>If only certain machines are allowed to access your webapp, create a valve to let only those machines in. Specify the machines by IP address or hostname.</p>
<h3>Tip #14 &#8211; Strip Down server.xml</h3>
<p>Remove comments, connectors, and any other components you don&#8217;t need from server.xml to make the file more readable. However, since comments can be important, keep a copy of the original file around for future reference.</p>
<p>Remove</p>
<p>&lt;Connector port=&#8221;8009&#8243; enableLookups=&#8221;false&#8221; redirectPort=&#8221;8443&#8243; protocol=&#8221;AJP/1.3&#8243;&gt;&lt;/Connector&gt;</p>
<p>from server.xml if you are using standalone Tomcat (i.e., without the Apache server).</p>
<h3>Tip #15 &#8211; Thread Pool</h3>
<p>If using multiple CPUs, raising the thread pool above the default 250 may prove beneficial. On the other hand, reducing the thread count may be beneficial if your server is running slowly.</p>
<h3>Tip #16 &#8211; Compress Network Traffic</h3>
<p>Use the compression and compressableMimeType attributes of the connector element to configure GZIP compression and to specify the MIME types that should be compressed.</p>
<h3>Tip #17 &#8211; Production Logging</h3>
<p>Tomcat&#8217;s default configuration creates duplicate log files. Remove duplicate logging in .handlers (in logging.properties).</p>
<h3>Tip #18 &#8211; Rotate The Tomcat Log Files</h3>
<p>This example rotates log files. Adjust the values to suit your environment.</p>
<p>1catalina.java.util.logging.FileHandler.pattern = ${catalina.base}/logs/catalina.%g.log</p>
<p>1catalina.java.util.logging.FileHandler.limit = 20000000</p>
<p>1catalina.java.util.logging.FileHandler.count = 5</p>
<h3>Tip #19 &#8211; Use Clustering With Load Balancing</h3>
<p>When balancing the load between multiple Tomcat instances, if an instance fails, another instance can seamlessly take over its sessions if clustering is configured. Without clustering, a failing instance&#8217;s sessions will crash.</p>
<h3>Tip #20 &#8211; Disable the Shutdown Port</h3>
<p>Turn off Tomcat&#8217;s default shutdown port by setting the port attribute to -1 in the server element. This makes it impossible to shut down Tomcat via IP:port. Shutdown will only be possible by a kill command issued by the user who owns the Tomcat instance.</p>
<h3>Tip #21 &#8211; Ignore Interfaces That Are Not Required</h3>
<p>Connectors listen to all interfaces by default. Use the address attribute of the connector element to force the connector to ignore all interfaces that are not used by your webapp.</p>
<p>See also <a title="Permanent Link to 18 Java Tomcat Application Optimization Tips" href="http://blog.monitis.com/index.php/2011/08/06/18-java-tomcat-application-optimization-tips/" rel="bookmark">18 Java Tomcat Application Optimization Tips</a> blog post.</p>
<p><em>Monitis offers real browser load testing and synthetic end-user monitoring services to ensure the website are operable 24/7. Without such monitoring, the investment in implementing an online application will not only bring little revenue but may also affect the overall company’s brand image and reputation.</em></p>
<p><strong>For more information on Monitis please visit our website: <a href="http://www.monitis.com/">www.monitis.com</a> or signup for 15-days free trial at <a title="free monitis signup" href="https://www.monitis.com/free_signup.jsp">https://www.monitis.com/free_signup.jsp</a>.</strong></p>
Share Now:<a rel="nofollow"   href="http://delicious.com/post?url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2011%2F12%2F14%2F21-apache-tomcat-configuration-tips%2F&amp;title=21%20Apache%20Tomcat%20Configuration%20Tips&amp;notes=Monitis%20is%20pleased%20to%20present%20the%20following%20tips%20for%20configuring%20Apache%20Tomcat%20for%20maximum%20performance.%20Apache%20Tomcat%20is%20an%20open%20source%20software%20implementation%20of%20the%20Java%20Servlet%20and%20JavaServer%20Pages%20technologies.%20Apache%20Tomcat%20powers%20numerous%20large" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/delicious.png" class="sociable-img sociable-hovers" title="del.icio.us" alt="del.icio.us" /></a><a rel="nofollow"   href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2011%2F12%2F14%2F21-apache-tomcat-configuration-tips%2F&amp;title=21%20Apache%20Tomcat%20Configuration%20Tips&amp;bodytext=Monitis%20is%20pleased%20to%20present%20the%20following%20tips%20for%20configuring%20Apache%20Tomcat%20for%20maximum%20performance.%20Apache%20Tomcat%20is%20an%20open%20source%20software%20implementation%20of%20the%20Java%20Servlet%20and%20JavaServer%20Pages%20technologies.%20Apache%20Tomcat%20powers%20numerous%20large" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/digg.png" class="sociable-img sociable-hovers" title="Digg" alt="Digg" /></a><a rel="nofollow"   href="http://www.facebook.com/share.php?u=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2011%2F12%2F14%2F21-apache-tomcat-configuration-tips%2F&amp;t=21%20Apache%20Tomcat%20Configuration%20Tips" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/facebook.png" class="sociable-img sociable-hovers" title="Facebook" alt="Facebook" /></a><a rel="nofollow"   href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2011%2F12%2F14%2F21-apache-tomcat-configuration-tips%2F&amp;title=21%20Apache%20Tomcat%20Configuration%20Tips&amp;source=Uptime+%26amp%3B+Performance+Tips+Tips+for+SysAdmin%2C+Webmaster%2C+Network+Admin&amp;summary=Monitis%20is%20pleased%20to%20present%20the%20following%20tips%20for%20configuring%20Apache%20Tomcat%20for%20maximum%20performance.%20Apache%20Tomcat%20is%20an%20open%20source%20software%20implementation%20of%20the%20Java%20Servlet%20and%20JavaServer%20Pages%20technologies.%20Apache%20Tomcat%20powers%20numerous%20large" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/linkedin.png" class="sociable-img sociable-hovers" title="LinkedIn" alt="LinkedIn" /></a><a rel="nofollow"   href="http://www.blinklist.com/index.php?Action=Blink/addblink.php&amp;Url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2011%2F12%2F14%2F21-apache-tomcat-configuration-tips%2F&amp;Title=21%20Apache%20Tomcat%20Configuration%20Tips" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/blinklist.png" class="sociable-img sociable-hovers" title="BlinkList" alt="BlinkList" /></a><a rel="nofollow"   href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2011%2F12%2F14%2F21-apache-tomcat-configuration-tips%2F&amp;title=21%20Apache%20Tomcat%20Configuration%20Tips" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/dzone.png" class="sociable-img sociable-hovers" title="DZone" alt="DZone" /></a><a rel="nofollow"   href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2011%2F12%2F14%2F21-apache-tomcat-configuration-tips%2F&amp;title=21%20Apache%20Tomcat%20Configuration%20Tips&amp;annotation=Monitis%20is%20pleased%20to%20present%20the%20following%20tips%20for%20configuring%20Apache%20Tomcat%20for%20maximum%20performance.%20Apache%20Tomcat%20is%20an%20open%20source%20software%20implementation%20of%20the%20Java%20Servlet%20and%20JavaServer%20Pages%20technologies.%20Apache%20Tomcat%20powers%20numerous%20large" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/googlebookmark.png" class="sociable-img sociable-hovers" title="Google Bookmarks" alt="Google Bookmarks" /></a><a rel="nofollow"   href="http://reddit.com/submit?url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2011%2F12%2F14%2F21-apache-tomcat-configuration-tips%2F&amp;title=21%20Apache%20Tomcat%20Configuration%20Tips" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/reddit.png" class="sociable-img sociable-hovers" title="Reddit" alt="Reddit" /></a><a rel="nofollow"   href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2011%2F12%2F14%2F21-apache-tomcat-configuration-tips%2F&amp;title=21%20Apache%20Tomcat%20Configuration%20Tips" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/stumbleupon.png" class="sociable-img sociable-hovers" title="StumbleUpon" alt="StumbleUpon" /></a><a rel="nofollow"   href="http://twitter.com/home?status=21%20Apache%20Tomcat%20Configuration%20Tips%20-%20http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2011%2F12%2F14%2F21-apache-tomcat-configuration-tips%2F" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/twitter.png" class="sociable-img sociable-hovers" title="Twitter" alt="Twitter" /></a><a rel="nofollow"   href="http://blog.monitis.com/index.php/feed/" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/rss.png" class="sociable-img sociable-hovers" title="RSS" alt="RSS" /></a><br/><br/>]]></content:encoded>
			<wfw:commentRss>http://blog.monitis.com/index.php/2011/12/14/21-apache-tomcat-configuration-tips/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Monitis-Top… an open-source command-line interface for Monitis Agents and Monitors</title>
		<link>http://blog.monitis.com/index.php/2011/10/17/monitis-top-an-open-source-command-line-interface-for-monitis-agents-and-monitors/</link>
		<comments>http://blog.monitis.com/index.php/2011/10/17/monitis-top-an-open-source-command-line-interface-for-monitis-agents-and-monitors/#comments</comments>
		<pubDate>Mon, 17 Oct 2011 12:47:44 +0000</pubDate>
		<dc:creator>Ard-Jan Barnas</dc:creator>
				<category><![CDATA[Linux Servers Monitoring]]></category>
		<category><![CDATA[Management Scripts]]></category>
		<category><![CDATA[Monitis vs. Other services]]></category>
		<category><![CDATA[Monitoring Scripts]]></category>
		<category><![CDATA[Performance Management]]></category>
		<category><![CDATA[Sysadmin Tools]]></category>
		<category><![CDATA[Website Monitoring]]></category>
		<category><![CDATA[Windows Servers Monitoring]]></category>
		<category><![CDATA[command-line tools]]></category>
		<category><![CDATA[monitis-top]]></category>
		<category><![CDATA[VBScript]]></category>
		<category><![CDATA[vbscript scripts]]></category>

		<guid isPermaLink="false">http://blog.monitis.com/?p=4005</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://blog.monitis.com/index.php/2011/10/17/monitis-top-an-open-source-command-line-interface-for-monitis-agents-and-monitors/' addthis:title='Monitis-Top… an open-source command-line interface for Monitis Agents and Monitors '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div> In this article we’ll discuss creating a command line interface to query the Monitis Agents and Monitors you have activated for your systems. We’ll provide the source code for the utility in VBScript and we will also be working on a C# version.  We’ll keep things simple for now and start with VBScript and provide [...]]]></description>
			<content:encoded><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://blog.monitis.com/index.php/2011/10/17/monitis-top-an-open-source-command-line-interface-for-monitis-agents-and-monitors/' addthis:title='Monitis-Top… an open-source command-line interface for Monitis Agents and Monitors '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div><p><img style="float: right; padding: 15px;" title="VBSccript_icon" src="http://blog.monitis.com/wp-content/uploads/2011/10/VBSccript_icon.png" alt="" width="64" height="64" /> In this article we’ll discuss creating a command line interface to query the Monitis Agents and Monitors you have activated for your systems. We’ll provide the source code for the utility in VBScript and we will also be working on a C# version.  We’ll keep things simple for now and start with VBScript and provide a link to the complete source at the end of this article.</p>
<p>To get started we need to identify what information we want to display from our Monitors, what can be easily supported, and what is not supported.  The main parts are the different types of agents that Monitis offers, which are the Internal,<br />
External, and custom monitors.</p>
<p>In this article we’ll focus on the basic ‘framework’ of the utility that deals with the definition of some classes to make working with the various agents and monitors easier, accepting and processing command-line arguments, and a small function library to keep our main script very clean. We’ll introduce a neat little feature of VBScript showing you how to work with include files.<span id="more-4005"></span></p>
<p>Let’s take a look at the functionality and output we like to get from Monitis-Top.</p>
<h3>Querying Internal Monitors</h3>
<p>We want to be able to display the latest performance counters from our internal, external, and custom monitors by entering commands like:</p>
<p><em>MonitisTop /cmd:listagents /type:internal /monitor:all</em></p>
<p>Which would return the performance counters for all<br />
supported monitors of the internal agents, or</p>
<p><em>MonitisTop /cmd:listagents /type:internal /monitor:cpu,memory,drive</em></p>
<p>This returns the Cpu, Memory, and Drive monitors for the internal agents.</p>
<p><a href="http://blog.monitis.com/wp-content/uploads/2011/10/cm3.png"><img class="aligncenter size-full wp-image-4006" src="http://blog.monitis.com/wp-content/uploads/2011/10/cm3.png" alt="" width="640" height="237" /></a></p>
<h3></h3>
<h3>Querying Process Monitors</h3>
<p>We can enter query the process monitors that we’ve configured in our Monitis dashboard like so:</p>
<p><em>MonitisTop /cmd:listagents /type:int  /process:outlook,search</em></p>
<p>This will return any process monitors containing the phrases &#8216;outlook’ and ‘search’. MonitisTop will automatically wildcard any processes listed on the command line.</p>
<p><a href="http://blog.monitis.com/wp-content/uploads/2011/10/cmd4.png"><img class="aligncenter size-full wp-image-4007" src="http://blog.monitis.com/wp-content/uploads/2011/10/cmd4.png" alt="" width="637" height="190" /></a></p>
<h3>Querying External Monitors</h3>
<p>Monitis Top can also be used to query external monitors. You can specify the parameter <em>/type:ext</em> or <em>/type:all</em>, where <em>ext</em> will only return the external monitors and <em>all</em> returns both internal and external monitor results. For example, the command:</p>
<p><em>MonitisTop /cmd:listagents /type:all /monitor:cpu</em></p>
<p>will return both the internal CPU monitor result and the external monitors.</p>
<p><a href="http://blog.monitis.com/wp-content/uploads/2011/10/ExternalMonitors.png"><img class="aligncenter size-full wp-image-4076" src="http://blog.monitis.com/wp-content/uploads/2011/10/ExternalMonitors.png" alt="" width="637" height="467" /></a></p>
<p>The results will show by each location that you have specified for a monitor.</p>
<h3>Managing API and Secret Keys</h3>
<p>We want similar commands for the external and custom agents.  In addition, it would also be nice if there was some functionality to maintain our APIKeys, so we’ll add a function that allows you to set and display these keys by entering:</p>
<p><em>MonitisTop /cmd:setkeys  /apikey:&lt;yourapikey&gt; /secretkey:&lt;yoursecretkey&gt;</em></p>
<p>Similar, you can display the keys with the command:</p>
<p><em> </em><em>MonitisTop /cmd:getkeys</em></p>
<p>&nbsp;</p>
<h3>VBScript Include Files</h3>
<p>We’ll use VBScript to program the code for MonitisTop  initially. In the next phase of this project we’ll use C#. If you’re not  familiar with the possibility of using include files in VBScript, take a look  at the code snippet below.</p>
<div id="gist-1278782" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="k">Sub</span> <span class="nf">Include</span><span class="p">(</span><span class="n">strFilename</span><span class="p">)</span></div><div class='line' id='LC2'>	<span class="k">On</span> <span class="k">Error</span> <span class="k">Resume</span> <span class="k">Next</span></div><div class='line' id='LC3'>	<span class="k">Dim</span> <span class="n">oFSO</span><span class="p">,</span> <span class="n">f</span><span class="p">,</span> <span class="n">s</span></div><div class='line' id='LC4'><br/></div><div class='line' id='LC5'>	<span class="k">Set</span> <span class="n">oFSO</span> <span class="o">=</span> <span class="n">CreateObject</span><span class="p">(</span><span class="s">&quot;Scripting.FileSystemObject&quot;</span><span class="p">)</span></div><div class='line' id='LC6'>	<span class="k">If</span> <span class="n">oFSO</span><span class="p">.</span><span class="n">FileExists</span><span class="p">(</span><span class="n">strFilename</span><span class="p">)</span> <span class="k">Then</span></div><div class='line' id='LC7'>		<span class="k">Set</span> <span class="n">f</span> <span class="o">=</span> <span class="n">oFSO</span><span class="p">.</span><span class="n">OpenTextFile</span><span class="p">(</span><span class="n">strFilename</span><span class="p">)</span></div><div class='line' id='LC8'>		<span class="n">s</span> <span class="o">=</span> <span class="n">f</span><span class="p">.</span><span class="n">ReadAll</span></div><div class='line' id='LC9'>		<span class="n">f</span><span class="p">.</span><span class="n">Close</span></div><div class='line' id='LC10'>		<span class="n">ExecuteGlobal</span> <span class="n">s</span></div><div class='line' id='LC11'>	<span class="k">End</span> <span class="k">If</span></div><div class='line' id='LC12'><br/></div><div class='line' id='LC13'>	<span class="k">Set</span> <span class="n">oFSO</span> <span class="o">=</span> <span class="k">Nothing</span></div><div class='line' id='LC14'>	<span class="k">Set</span> <span class="n">f</span> <span class="o">=</span> <span class="k">Nothing</span></div><div class='line' id='LC15'>	<span class="k">On</span> <span class="k">Error</span> <span class="k">Goto</span> <span class="mi">0</span></div><div class='line' id='LC16'><span class="k">End</span> <span class="k">Sub</span></div><div class='line' id='LC17'><br/></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/1278782/8d7fc0456004349538f9fd80cd3669f42d16bd84/VBScriptInclude.vbs" style="float:right;">view raw</a>
            <a href="https://gist.github.com/1278782#file_vb_script_include.vbs" style="float:right;margin-right:10px;color:#666">VBScriptInclude.vbs</a>
            <a href="https://gist.github.com/1278782">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>

<h3>Class Definitions</h3>
<p>To make working with the various agents and monitors more manageable, we’ll create a few classes that we use to store the performance counter results we get back from the Monitis server. To start we’ll create a few classes; one for the agents, one for the monitors belonging to an agent, and one for the various metrics and values in a monitor. We want the Agent class to maintain a list of Monitors, and the Monitor class in its turn maintains a list of Metrics.</p>
<div id="gist-1282009" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="k">Class</span> <span class="nc">class_Metric</span></div><div class='line' id='LC2'>	<span class="k">Public</span> <span class="n">Name</span></div><div class='line' id='LC3'>	<span class="k">Public</span> <span class="n">Metric</span></div><div class='line' id='LC4'>	<span class="k">Public</span> <span class="n">Result</span></div><div class='line' id='LC5'>	<span class="k">Public</span> <span class="n">Suffix</span></div><div class='line' id='LC6'>	<span class="k">Public</span> <span class="n">Width</span></div><div class='line' id='LC7'><br/></div><div class='line' id='LC8'>	<span class="k">Private</span> <span class="k">Sub</span> <span class="nf">Class_Initialize</span></div><div class='line' id='LC9'>		<span class="n">Name</span> <span class="o">=</span> <span class="s">&quot;&quot;</span></div><div class='line' id='LC10'>		<span class="n">Metric</span> <span class="o">=</span> <span class="s">&quot;&quot;</span></div><div class='line' id='LC11'>		<span class="n">Result</span> <span class="o">=</span> <span class="s">&quot;&quot;</span></div><div class='line' id='LC12'>		<span class="n">Suffix</span> <span class="o">=</span> <span class="s">&quot;&quot;</span></div><div class='line' id='LC13'>		<span class="n">Width</span> <span class="o">=</span> <span class="mi">0</span></div><div class='line' id='LC14'>	<span class="k">End</span> <span class="k">Sub</span></div><div class='line' id='LC15'><span class="k">End</span> <span class="k">Class</span></div><div class='line' id='LC16'><br/></div><div class='line' id='LC17'><br/></div><div class='line' id='LC18'><span class="k">Class</span> <span class="nc">class_Monitor</span></div><div class='line' id='LC19'>	<span class="k">Public</span> <span class="n">Id</span></div><div class='line' id='LC20'>	<span class="k">Public</span> <span class="n">Name</span></div><div class='line' id='LC21'><br/></div><div class='line' id='LC22'>	<span class="k">Public</span> <span class="n">MetricList</span></div><div class='line' id='LC23'><br/></div><div class='line' id='LC24'>	<span class="k">Private</span> <span class="k">Sub</span> <span class="nf">Class_Initialize</span></div><div class='line' id='LC25'>		<span class="n">Id</span> <span class="o">=</span> <span class="s">&quot;&quot;</span></div><div class='line' id='LC26'>		<span class="n">Name</span> <span class="o">=</span> <span class="s">&quot;&quot;</span></div><div class='line' id='LC27'>		<span class="k">Set</span> <span class="n">MetricList</span> <span class="o">=</span> <span class="n">CreateObject</span><span class="p">(</span><span class="s">&quot;Scripting.Dictionary&quot;</span><span class="p">)</span></div><div class='line' id='LC28'>	<span class="k">End</span> <span class="k">Sub</span></div><div class='line' id='LC29'><br/></div><div class='line' id='LC30'>	<span class="k">Private</span> <span class="k">Sub</span> <span class="nf">Class_Terminate</span></div><div class='line' id='LC31'>		<span class="k">Set</span> <span class="n">MetricList</span> <span class="o">=</span> <span class="k">Nothing</span></div><div class='line' id='LC32'>	<span class="k">End</span> <span class="k">Sub</span></div><div class='line' id='LC33'><span class="k">End</span> <span class="k">Class</span></div><div class='line' id='LC34'><br/></div><div class='line' id='LC35'><br/></div><div class='line' id='LC36'><span class="k">Class</span> <span class="nc">class_InternalAgent</span></div><div class='line' id='LC37'>	<span class="k">Public</span> <span class="n">Id</span></div><div class='line' id='LC38'>	<span class="k">Public</span> <span class="n">Name</span></div><div class='line' id='LC39'>	<span class="k">Public</span> <span class="n">MonitorList</span></div><div class='line' id='LC40'><br/></div><div class='line' id='LC41'>	<span class="k">Private</span> <span class="k">Sub</span> <span class="nf">Class_Initialize</span></div><div class='line' id='LC42'>		<span class="k">Set</span> <span class="n">MonitorList</span> <span class="o">=</span> <span class="n">CreateObject</span><span class="p">(</span><span class="s">&quot;Scripting.Dictionary&quot;</span><span class="p">)</span></div><div class='line' id='LC43'>	<span class="k">End</span> <span class="k">Sub</span></div><div class='line' id='LC44'><br/></div><div class='line' id='LC45'>	<span class="k">Private</span> <span class="k">Sub</span> <span class="nf">Class_Terminate</span></div><div class='line' id='LC46'>		<span class="k">Set</span> <span class="n">MonitorList</span> <span class="o">=</span> <span class="k">Nothing</span></div><div class='line' id='LC47'>	<span class="k">End</span> <span class="k">Sub</span></div><div class='line' id='LC48'><span class="k">End</span> <span class="k">Class</span></div><div class='line' id='LC49'><br/></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/1282009/93f573fbf8e199b22853146fba2177cedd1182e8/MonitisTopClasses.vbs" style="float:right;">view raw</a>
            <a href="https://gist.github.com/1282009#file_monitis_top_classes.vbs" style="float:right;margin-right:10px;color:#666">MonitisTopClasses.vbs</a>
            <a href="https://gist.github.com/1282009">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>

<p>In the class_InternalAgent we create a list of monitor objects that is initialized in the constructor of the class. Notice that in VBScript the methods Class_Initialize and Class_Terminate are automatically called if they are defined and these methods compare to your C# constructor and Dispose methods<em>.</em></p>
<h3>Retrieving the Internal Agents</h3>
<p>Once we have parsed the list of monitors that we want to show (specified on the command line), we can call the function <em>GetInternalAgents</em>. In the function below aObjHttp, aShowMonitors, and aShowProcesses  are input values, while aObjAgents is an output value. It returns the list of internal agents retrieved from the API.</p>
<div id="gist-1282557" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="k">Function</span> <span class="nf">GetInternalAgents</span><span class="p">(</span><span class="n">aObjHttp</span><span class="p">,</span> <span class="n">aObjAgents</span><span class="p">,</span> <span class="n">aShowMonitors</span><span class="p">,</span> <span class="n">aShowProcesses</span><span class="p">)</span></div><div class='line' id='LC2'>	<span class="k">Dim</span> <span class="n">objAgents</span><span class="p">,</span> <span class="n">xmlAgents</span></div><div class='line' id='LC3'>	<span class="k">Set</span> <span class="n">objAgents</span> <span class="o">=</span> <span class="n">CreateObject</span><span class="p">(</span><span class="s">&quot;Scripting.Dictionary&quot;</span><span class="p">)</span></div><div class='line' id='LC4'><br/></div><div class='line' id='LC5'>	<span class="c">&#39;Retrieve the list of agents</span></div><div class='line' id='LC6'>	<span class="n">url</span> <span class="o">=</span> <span class="s">&quot;http://www.monitis.com/api?action=agents&amp;apikey=&quot;</span> <span class="o">+</span> <span class="n">apiKey</span> <span class="o">+</span> <span class="s">&quot;&amp;output=xml&quot;</span></div><div class='line' id='LC7'>	<span class="n">aObjHttp</span><span class="p">.</span><span class="n">open</span> <span class="s">&quot;GET&quot;</span><span class="p">,</span> <span class="n">url</span><span class="p">,</span> <span class="k">False</span></div><div class='line' id='LC8'>	<span class="n">aObjHttp</span><span class="p">.</span><span class="n">send</span></div><div class='line' id='LC9'><br/></div><div class='line' id='LC10'>	<span class="c">&#39;Parse response</span></div><div class='line' id='LC11'>	<span class="k">Set</span> <span class="n">xmlAgents</span> <span class="o">=</span> <span class="n">CreateObject</span><span class="p">(</span><span class="s">&quot;Microsoft.XMLDOM&quot;</span><span class="p">)</span></div><div class='line' id='LC12'>	<span class="n">xmlAgents</span><span class="p">.</span><span class="n">async</span> <span class="o">=</span> <span class="k">False</span></div><div class='line' id='LC13'>	<span class="n">xmlAgents</span><span class="p">.</span><span class="n">LoadXML</span><span class="p">(</span><span class="n">aObjHttp</span><span class="p">.</span><span class="n">responseText</span><span class="p">)</span></div><div class='line' id='LC14'>	<span class="k">If</span> <span class="n">xmlAgents</span><span class="p">.</span><span class="n">parseError</span><span class="p">.</span><span class="n">errorCode</span> <span class="o">&lt;&gt;</span> <span class="mi">0</span> <span class="k">Then</span>    </div><div class='line' id='LC15'>		<span class="n">wscript</span><span class="p">.</span><span class="n">Echo</span> <span class="n">xmlAgents</span><span class="p">.</span><span class="n">parseError</span><span class="p">.</span><span class="n">errorCode</span>    </div><div class='line' id='LC16'>		<span class="n">wscript</span><span class="p">.</span><span class="n">Echo</span> <span class="n">xmlAgents</span><span class="p">.</span><span class="n">parseError</span><span class="p">.</span><span class="n">reason</span>    </div><div class='line' id='LC17'>		<span class="n">wscript</span><span class="p">.</span><span class="n">Echo</span> <span class="n">xmlAgents</span><span class="p">.</span><span class="n">parseError</span><span class="p">.</span><span class="n">line</span></div><div class='line' id='LC18'>	<span class="k">End</span> <span class="k">If</span>  	</div><div class='line' id='LC19'><br/></div><div class='line' id='LC20'><br/></div><div class='line' id='LC21'>	<span class="c">&#39;Retrieve the agent information for each agent</span></div><div class='line' id='LC22'>	<span class="k">For</span> <span class="k">Each</span> <span class="n">agent</span> <span class="ow">in</span> <span class="n">xmlAgents</span><span class="p">.</span><span class="n">documentElement</span><span class="p">.</span><span class="n">childnodes</span></div><div class='line' id='LC23'><br/></div><div class='line' id='LC24'>		<span class="c">&#39;Create an InternalAgent Object	</span></div><div class='line' id='LC25'>		<span class="k">Set</span> <span class="n">IntAgent</span> <span class="o">=</span> <span class="k">New</span> <span class="n">class_InternalAgent</span></div><div class='line' id='LC26'>		<span class="n">IntAgent</span><span class="p">.</span><span class="n">Id</span> <span class="o">=</span> <span class="n">agent</span><span class="p">.</span><span class="n">selectSingleNode</span><span class="p">(</span><span class="s">&quot;id&quot;</span><span class="p">).</span><span class="n">text</span></div><div class='line' id='LC27'>		<span class="n">IntAgent</span><span class="p">.</span><span class="n">Name</span> <span class="o">=</span> <span class="n">agent</span><span class="p">.</span><span class="n">selectSingleNode</span><span class="p">(</span><span class="s">&quot;key&quot;</span><span class="p">).</span><span class="n">text</span></div><div class='line' id='LC28'><br/></div><div class='line' id='LC29'>		<span class="c">&#39;Retrieve the agent information </span></div><div class='line' id='LC30'>		<span class="n">url</span> <span class="o">=</span> <span class="s">&quot;http://www.monitis.com/api?action=agentInfo&amp;apikey=&quot;</span> <span class="o">+</span> <span class="n">apiKey</span> <span class="o">+</span> <span class="s">&quot;&amp;output=xml&amp;agentId=&quot;</span> <span class="o">+</span> <span class="n">IntAgent</span><span class="p">.</span><span class="n">Id</span> <span class="o">+</span> <span class="s">&quot;&amp;loadTests=true&quot;</span></div><div class='line' id='LC31'>		<span class="n">aObjHttp</span><span class="p">.</span><span class="n">open</span> <span class="s">&quot;GET&quot;</span><span class="p">,</span> <span class="n">url</span><span class="p">,</span> <span class="k">False</span></div><div class='line' id='LC32'>		<span class="n">aObjHttp</span><span class="p">.</span><span class="n">send</span></div><div class='line' id='LC33'><br/></div><div class='line' id='LC34'>		<span class="k">Set</span> <span class="n">xmlAgentInfo</span> <span class="o">=</span> <span class="n">CreateObject</span><span class="p">(</span><span class="s">&quot;Microsoft.XMLDOM&quot;</span><span class="p">)</span></div><div class='line' id='LC35'>		<span class="n">xmlAgentInfo</span><span class="p">.</span><span class="n">async</span> <span class="o">=</span> <span class="k">False</span></div><div class='line' id='LC36'>		<span class="n">xmlAgentInfo</span><span class="p">.</span><span class="n">LoadXML</span><span class="p">(</span><span class="n">aObjHttp</span><span class="p">.</span><span class="n">responseText</span><span class="p">)</span></div><div class='line' id='LC37'><br/></div><div class='line' id='LC38'>		<span class="k">For</span> <span class="k">Each</span> <span class="n">info</span> <span class="ow">in</span> <span class="n">xmlAgentInfo</span><span class="p">.</span><span class="n">documentElement</span><span class="p">.</span><span class="n">childnodes</span></div><div class='line' id='LC39'><br/></div><div class='line' id='LC40'>			<span class="k">If</span> <span class="n">aShowProcesses</span><span class="p">.</span><span class="n">Count</span> <span class="o">=</span> <span class="mi">0</span> <span class="k">Then</span></div><div class='line' id='LC41'>				<span class="n">GetGlobalMonitors</span> <span class="n">aObjHttp</span><span class="p">,</span> <span class="n">info</span><span class="p">.</span><span class="n">childnodes</span><span class="p">,</span> <span class="n">IntAgent</span><span class="p">,</span> <span class="n">aShowMonitors</span></div><div class='line' id='LC42'>			<span class="k">Else</span></div><div class='line' id='LC43'>				<span class="k">If</span> <span class="n">LCase</span><span class="p">(</span><span class="n">info</span><span class="p">.</span><span class="n">nodename</span><span class="p">)</span> <span class="o">=</span> <span class="s">&quot;processes&quot;</span> <span class="k">Then</span></div><div class='line' id='LC44'>					<span class="n">GetProcessMonitors</span> <span class="n">aObjHttp</span><span class="p">,</span> <span class="n">info</span><span class="p">.</span><span class="n">childnodes</span><span class="p">,</span> <span class="n">IntAgent</span><span class="p">,</span> <span class="n">aShowProcesses</span></div><div class='line' id='LC45'>				<span class="k">End</span> <span class="k">If</span></div><div class='line' id='LC46'>			<span class="k">End</span> <span class="k">If</span></div><div class='line' id='LC47'><br/></div><div class='line' id='LC48'>		<span class="k">Next</span></div><div class='line' id='LC49'><br/></div><div class='line' id='LC50'>		<span class="c">&#39;Add the agent object to the list of agents</span></div><div class='line' id='LC51'>		<span class="n">aObjAgents</span><span class="p">.</span><span class="n">Add</span> <span class="n">IntAgent</span><span class="p">.</span><span class="n">Id</span><span class="p">,</span> <span class="n">IntAgent</span></div><div class='line' id='LC52'>	<span class="k">Next</span></div><div class='line' id='LC53'><br/></div><div class='line' id='LC54'><span class="k">End</span> <span class="k">Function</span></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/1282557/a44e358f1c29dd9d19f92de3dead5cc3299f1358/getInternalAgents.vbs" style="float:right;">view raw</a>
            <a href="https://gist.github.com/1282557#file_get_internal_agents.vbs" style="float:right;margin-right:10px;color:#666">getInternalAgents.vbs</a>
            <a href="https://gist.github.com/1282557">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>

<p>The main part of this function is the creation of the Agent class, retrieving the ‘loadTests’ from the API and cycling through the list of returned Monitors for each Agent.</p>
<p>Because we want to build in support for querying process monitors as well as global drive, memory, and cpu monitors, we’ve included the list ‘<em>aShowProcesses’</em>. This list contains the processes entered on the command line that we want to query. If<br />
this list contains zero elements, the program defaults to collecting and returning the global monitors.</p>
<p>After <em>GetGlobalMonitors </em>(or <em>GetAgentProcessMonitors</em>) have returned, we’ll add the Internal Agent object to <em>aObjAgents</em>; the list of Internal Agents.</p>
<p>In the <em>GetAgentMonitors </em>function we’ll collect all the monitors of an agent and make a call to <em>GetResults</em> to retrieve all the metric<br />
values.</p>
<p><div id="gist-1282582" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="k">Function</span> <span class="nf">GetGlobalMonitors</span><span class="p">(</span><span class="n">aObjHttp</span><span class="p">,</span> <span class="n">oNames</span><span class="p">,</span> <span class="n">aObjAgent</span><span class="p">,</span> <span class="n">aShowMonitors</span><span class="p">)</span></div><div class='line' id='LC2'>	<span class="k">Dim</span> <span class="n">oName</span></div><div class='line' id='LC3'>&nbsp;&nbsp;</div><div class='line' id='LC4'>	<span class="k">For</span> <span class="k">Each</span> <span class="n">oName</span> <span class="ow">in</span> <span class="n">oNames</span></div><div class='line' id='LC5'><br/></div><div class='line' id='LC6'>&nbsp;&nbsp;&nbsp;&nbsp;	<span class="k">If</span> <span class="n">oName</span><span class="p">.</span><span class="n">NodeName</span> <span class="o">&lt;&gt;</span> <span class="s">&quot;#text&quot;</span> <span class="ow">And</span> <span class="n">oName</span><span class="p">.</span><span class="n">NodeName</span> <span class="o">&lt;&gt;</span> <span class="s">&quot;process&quot;</span> <span class="ow">And</span> <span class="n">_</span></div><div class='line' id='LC7'>		  <span class="n">SupportedMonitors</span><span class="p">.</span><span class="n">Exists</span><span class="p">(</span><span class="n">LCase</span><span class="p">(</span><span class="n">oName</span><span class="p">.</span><span class="n">NodeName</span><span class="p">))</span> <span class="ow">And</span> <span class="n">_</span></div><div class='line' id='LC8'>		  <span class="n">aShowMonitors</span><span class="p">.</span><span class="n">Exists</span><span class="p">(</span><span class="n">LCase</span><span class="p">(</span><span class="n">oName</span><span class="p">.</span><span class="n">NodeName</span><span class="p">))</span> <span class="k">Then</span></div><div class='line' id='LC9'>&nbsp;&nbsp;&nbsp;&nbsp;</div><div class='line' id='LC10'>&nbsp;&nbsp;&nbsp;&nbsp;		<span class="c">&#39; Create new monitor object</span></div><div class='line' id='LC11'>			<span class="k">Set</span> <span class="n">Monitor</span> <span class="o">=</span> <span class="k">New</span> <span class="n">class_Monitor</span></div><div class='line' id='LC12'>			<span class="n">Monitor</span><span class="p">.</span><span class="n">Name</span> <span class="o">=</span> <span class="n">GetMonitorName</span><span class="p">(</span><span class="n">oName</span><span class="p">.</span><span class="n">selectSingleNode</span><span class="p">(</span><span class="s">&quot;name&quot;</span><span class="p">).</span><span class="n">text</span><span class="p">)</span></div><div class='line' id='LC13'>		    <span class="n">strMonitorName</span> <span class="o">=</span> <span class="n">LCase</span><span class="p">(</span><span class="n">GetMonitorBaseName</span><span class="p">(</span><span class="n">Monitor</span><span class="p">.</span><span class="n">Name</span><span class="p">))</span></div><div class='line' id='LC14'>			<span class="n">Monitor</span><span class="p">.</span><span class="n">Id</span> <span class="o">=</span> <span class="n">UCase</span><span class="p">(</span><span class="n">oName</span><span class="p">.</span><span class="n">selectSingleNode</span><span class="p">(</span><span class="s">&quot;id&quot;</span><span class="p">).</span><span class="n">text</span><span class="p">)</span></div><div class='line' id='LC15'>			<span class="n">Monitor</span><span class="p">.</span><span class="n">DisplayName</span> <span class="o">=</span> <span class="n">UCase</span><span class="p">(</span><span class="n">Monitor</span><span class="p">.</span><span class="n">Name</span><span class="p">)</span></div><div class='line' id='LC16'><br/></div><div class='line' id='LC17'>			<span class="n">url</span> <span class="o">=</span> <span class="s">&quot;http://www.monitis.com/api?version=2&amp;apikey=&quot;</span> <span class="o">&amp;</span> <span class="n">apikey</span> <span class="o">&amp;</span> <span class="s">&quot;&amp;output=xml&amp;action=top&quot;</span> <span class="o">&amp;</span> <span class="n">strMonitorName</span> <span class="o">&amp;</span> <span class="s">&quot;&amp;limit=50&amp;detailedResults=true&quot;</span></div><div class='line' id='LC18'><br/></div><div class='line' id='LC19'>			<span class="n">aObjHttp</span><span class="p">.</span><span class="n">open</span> <span class="s">&quot;GET&quot;</span><span class="p">,</span> <span class="n">url</span><span class="p">,</span> <span class="k">False</span></div><div class='line' id='LC20'>			<span class="n">aObjHttp</span><span class="p">.</span><span class="n">send</span></div><div class='line' id='LC21'>			<span class="k">Set</span> <span class="n">oRes</span> <span class="o">=</span> <span class="n">CreateObject</span><span class="p">(</span><span class="s">&quot;Microsoft.XMLDOM&quot;</span><span class="p">)</span></div><div class='line' id='LC22'>			<span class="n">oRes</span><span class="p">.</span><span class="n">async</span> <span class="o">=</span> <span class="k">False</span></div><div class='line' id='LC23'>			<span class="n">oRes</span><span class="p">.</span><span class="n">LoadXML</span><span class="p">(</span><span class="n">aObjHttp</span><span class="p">.</span><span class="n">responseText</span><span class="p">)</span></div><div class='line' id='LC24'><br/></div><div class='line' id='LC25'>			<span class="k">Set</span> <span class="n">oNode</span> <span class="o">=</span> <span class="n">oRes</span><span class="p">.</span><span class="n">selectSingleNode</span><span class="p">(</span><span class="s">&quot;data/tests&quot;</span><span class="p">)</span></div><div class='line' id='LC26'>			<span class="k">If</span> <span class="k">Not</span> <span class="n">oNode</span> <span class="ow">Is</span> <span class="k">Nothing</span> <span class="k">Then</span></div><div class='line' id='LC27'>				<span class="k">For</span> <span class="k">Each</span> <span class="n">oCell</span> <span class="ow">In</span> <span class="n">oNode</span><span class="p">.</span><span class="n">childnodes</span></div><div class='line' id='LC28'>					<span class="n">GetResult</span> <span class="n">oCell</span><span class="p">,</span> <span class="n">Monitor</span><span class="p">,</span> <span class="n">SupportedMonitors</span><span class="p">(</span><span class="n">strMonitorName</span><span class="p">)</span></div><div class='line' id='LC29'>				<span class="k">Next</span></div><div class='line' id='LC30'>				<span class="n">aObjAgent</span><span class="p">.</span><span class="n">MonitorList</span><span class="p">.</span><span class="n">Add</span> <span class="n">Monitor</span><span class="p">.</span><span class="n">Name</span><span class="p">,</span> <span class="n">Monitor</span></div><div class='line' id='LC31'>			<span class="k">End</span> <span class="k">If</span></div><div class='line' id='LC32'>		<span class="k">End</span> <span class="k">If</span> </div><div class='line' id='LC33'><br/></div><div class='line' id='LC34'>	<span class="k">Next</span>  </div><div class='line' id='LC35'><span class="k">End</span> <span class="k">Function</span></div><div class='line' id='LC36'><br/></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/1282582/980e24e8a75914e8ad1874a02c2b15a1da9c3670/getGlobalMonitors.vbs" style="float:right;">view raw</a>
            <a href="https://gist.github.com/1282582#file_get_global_monitors.vbs" style="float:right;margin-right:10px;color:#666">getGlobalMonitors.vbs</a>
            <a href="https://gist.github.com/1282582">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>
</a></p>
<p>In <em>GetGlobalMonitors </em>we create a Monitor object for each required monitor we want to return and call the function GetResult to retrieve the metric values for each monitor.</p>
<div id="gist-1282593" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="k">Function</span> <span class="nf">GetProcessMonitors</span><span class="p">(</span><span class="n">aObjHttp</span><span class="p">,</span> <span class="n">oNames</span><span class="p">,</span> <span class="n">aObjAgent</span><span class="p">,</span> <span class="n">aShowProcesses</span><span class="p">)</span></div><div class='line' id='LC2'><br/></div><div class='line' id='LC3'>	<span class="n">url</span> <span class="o">=</span> <span class="s">&quot;http://www.monitis.com/api?version=2&amp;apikey=&quot;</span> <span class="o">&amp;</span> <span class="n">apikey</span> <span class="o">&amp;</span> <span class="s">&quot;&amp;output=xml&amp;action=topProcessByCPUUsage&amp;limit=50&amp;detailedResults=true&quot;</span></div><div class='line' id='LC4'><br/></div><div class='line' id='LC5'>	<span class="n">aObjHttp</span><span class="p">.</span><span class="n">open</span> <span class="s">&quot;GET&quot;</span><span class="p">,</span> <span class="n">url</span><span class="p">,</span> <span class="k">False</span></div><div class='line' id='LC6'>	<span class="n">aObjHttp</span><span class="p">.</span><span class="n">send</span></div><div class='line' id='LC7'>	<span class="k">Set</span> <span class="n">oRes</span> <span class="o">=</span> <span class="n">CreateObject</span><span class="p">(</span><span class="s">&quot;Microsoft.XMLDOM&quot;</span><span class="p">)</span></div><div class='line' id='LC8'>	<span class="n">oRes</span><span class="p">.</span><span class="n">async</span> <span class="o">=</span> <span class="k">False</span></div><div class='line' id='LC9'>	<span class="n">oRes</span><span class="p">.</span><span class="n">LoadXML</span><span class="p">(</span><span class="n">aObjHttp</span><span class="p">.</span><span class="n">responseText</span><span class="p">)</span></div><div class='line' id='LC10'><br/></div><div class='line' id='LC11'>	<span class="k">Set</span> <span class="n">oNode</span> <span class="o">=</span> <span class="n">oRes</span><span class="p">.</span><span class="n">selectSingleNode</span><span class="p">(</span><span class="s">&quot;data/tests&quot;</span><span class="p">)</span></div><div class='line' id='LC12'>	<span class="k">For</span> <span class="k">Each</span> <span class="n">t</span> <span class="ow">In</span> <span class="n">oNode</span><span class="p">.</span><span class="n">childnodes</span></div><div class='line' id='LC13'><br/></div><div class='line' id='LC14'>		<span class="k">Set</span> <span class="n">oTest</span> <span class="o">=</span> <span class="n">t</span><span class="p">.</span><span class="n">selectSingleNode</span><span class="p">(</span><span class="s">&quot;testName&quot;</span><span class="p">)</span></div><div class='line' id='LC15'>		<span class="k">If</span> <span class="k">Not</span> <span class="n">oTest</span> <span class="ow">Is</span> <span class="k">Nothing</span> <span class="k">Then</span></div><div class='line' id='LC16'><br/></div><div class='line' id='LC17'>			<span class="k">If</span> <span class="n">ShowThisProcess</span><span class="p">(</span><span class="n">oTest</span><span class="p">.</span><span class="n">text</span><span class="p">,</span> <span class="n">aShowProcesses</span><span class="p">)</span> <span class="k">Then</span></div><div class='line' id='LC18'><br/></div><div class='line' id='LC19'>				<span class="c">&#39;Create a new monitor object</span></div><div class='line' id='LC20'>				<span class="k">Set</span> <span class="n">Monitor</span> <span class="o">=</span> <span class="k">New</span> <span class="n">class_Monitor</span></div><div class='line' id='LC21'>				<span class="n">Monitor</span><span class="p">.</span><span class="n">Id</span> <span class="o">=</span> <span class="n">t</span><span class="p">.</span><span class="n">selectSingleNode</span><span class="p">(</span><span class="s">&quot;id&quot;</span><span class="p">).</span><span class="n">text</span></div><div class='line' id='LC22'>				<span class="n">Monitor</span><span class="p">.</span><span class="n">Name</span> <span class="o">=</span> <span class="n">t</span><span class="p">.</span><span class="n">selectSingleNode</span><span class="p">(</span><span class="s">&quot;testName&quot;</span><span class="p">).</span><span class="n">text</span></div><div class='line' id='LC23'>				<span class="n">Monitor</span><span class="p">.</span><span class="n">DisplayName</span> <span class="o">=</span> <span class="n">GetMonitorName</span><span class="p">(</span><span class="n">t</span><span class="p">.</span><span class="n">selectSingleNode</span><span class="p">(</span><span class="s">&quot;testName&quot;</span><span class="p">).</span><span class="n">text</span><span class="p">)</span></div><div class='line' id='LC24'><br/></div><div class='line' id='LC25'>				<span class="c">&#39;Retrieve the results for this monitor</span></div><div class='line' id='LC26'>				<span class="n">GetResult</span> <span class="n">t</span><span class="p">,</span> <span class="n">Monitor</span><span class="p">,</span> <span class="n">SupportedMonitors</span><span class="p">.</span><span class="n">Item</span><span class="p">(</span><span class="s">&quot;process&quot;</span><span class="p">)</span></div><div class='line' id='LC27'><br/></div><div class='line' id='LC28'>				<span class="c">&#39;Add the monitor to the list of agents</span></div><div class='line' id='LC29'>				<span class="n">aObjAgent</span><span class="p">.</span><span class="n">MonitorList</span><span class="p">.</span><span class="n">Add</span> <span class="n">Monitor</span><span class="p">.</span><span class="n">Id</span><span class="p">,</span> <span class="n">Monitor</span></div><div class='line' id='LC30'><br/></div><div class='line' id='LC31'>			<span class="k">End</span> <span class="k">If</span></div><div class='line' id='LC32'><br/></div><div class='line' id='LC33'>		<span class="k">End</span> <span class="k">If</span></div><div class='line' id='LC34'><br/></div><div class='line' id='LC35'>	<span class="k">Next</span></div><div class='line' id='LC36'><br/></div><div class='line' id='LC37'><span class="k">End</span> <span class="k">Function</span></div><div class='line' id='LC38'><br/></div><div class='line' id='LC39'><span class="c">&#39;-------------------------------------------------------------------</span></div><div class='line' id='LC40'><br/></div><div class='line' id='LC41'><span class="k">Function</span> <span class="nf">ShowThisProcess</span><span class="p">(</span><span class="n">aProcess</span><span class="p">,</span> <span class="n">aShowProcesses</span><span class="p">)</span></div><div class='line' id='LC42'>	<span class="n">ShowThisProcess</span> <span class="o">=</span> <span class="k">False</span></div><div class='line' id='LC43'>	<span class="k">For</span> <span class="k">Each</span> <span class="n">sp</span> <span class="ow">In</span> <span class="n">aShowProcesses</span></div><div class='line' id='LC44'>		<span class="k">If</span> <span class="p">(</span><span class="n">InStr</span><span class="p">(</span><span class="n">LCase</span><span class="p">(</span><span class="n">aProcess</span><span class="p">),</span> <span class="n">LCase</span><span class="p">(</span><span class="n">sp</span><span class="p">))</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">)</span> <span class="ow">Or</span> <span class="p">(</span><span class="n">sp</span> <span class="o">=</span> <span class="s">&quot;all&quot;</span><span class="p">)</span> <span class="k">Then</span></div><div class='line' id='LC45'>			<span class="n">ShowThisProcess</span> <span class="o">=</span> <span class="k">True</span></div><div class='line' id='LC46'>		<span class="k">End</span> <span class="k">If</span></div><div class='line' id='LC47'>	<span class="k">Next</span></div><div class='line' id='LC48'><span class="k">End</span> <span class="k">Function</span></div><div class='line' id='LC49'><br/></div><div class='line' id='LC50'><span class="c">&#39;-------------------------------------------------------------------</span></div><div class='line' id='LC51'><br/></div><div class='line' id='LC52'><span class="k">Function</span> <span class="nf">GetResult</span><span class="p">(</span><span class="n">aNode</span><span class="p">,</span> <span class="n">aMonitor</span><span class="p">,</span> <span class="n">aFields</span><span class="p">)</span></div><div class='line' id='LC53'>	<span class="n">arrValues</span> <span class="o">=</span> <span class="n">Split</span><span class="p">(</span><span class="n">aFields</span><span class="p">,</span> <span class="s">&quot;|&quot;</span><span class="p">)</span></div><div class='line' id='LC54'>	<span class="k">For</span> <span class="k">Each</span> <span class="n">value</span> <span class="ow">In</span> <span class="n">arrValues</span> </div><div class='line' id='LC55'><br/></div><div class='line' id='LC56'>		<span class="c">&#39;Split each value in the API field name and the suffix string </span></div><div class='line' id='LC57'>		<span class="n">arrDetails</span> <span class="o">=</span> <span class="n">Split</span><span class="p">(</span><span class="n">value</span><span class="p">,</span><span class="s">&quot;,&quot;</span><span class="p">)</span></div><div class='line' id='LC58'>		<span class="n">strValue</span> <span class="o">=</span> <span class="n">arrDetails</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span></div><div class='line' id='LC59'>		<span class="n">strSuffix</span> <span class="o">=</span> <span class="n">arrDetails</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span></div><div class='line' id='LC60'><br/></div><div class='line' id='LC61'>		<span class="c">&#39;Retrieve the result for the given counter</span></div><div class='line' id='LC62'>		<span class="k">Set</span> <span class="n">t</span> <span class="o">=</span> <span class="n">aNode</span><span class="p">.</span><span class="n">selectSingleNode</span><span class="p">(</span><span class="n">strValue</span><span class="p">)</span></div><div class='line' id='LC63'>		<span class="k">If</span> <span class="k">Not</span> <span class="n">t</span> <span class="ow">Is</span> <span class="k">Nothing</span> <span class="k">Then</span></div><div class='line' id='LC64'><br/></div><div class='line' id='LC65'>			<span class="c">&#39;Create a new metric object</span></div><div class='line' id='LC66'>			<span class="k">Set</span> <span class="n">Metric</span> <span class="o">=</span> <span class="k">New</span> <span class="n">class_Metric</span></div><div class='line' id='LC67'>			<span class="n">Metric</span><span class="p">.</span><span class="n">Name</span> <span class="o">=</span> <span class="n">strValue</span></div><div class='line' id='LC68'>			<span class="n">Metric</span><span class="p">.</span><span class="n">Result</span> <span class="o">=</span> <span class="n">t</span><span class="p">.</span><span class="n">text</span> <span class="o">&amp;</span> <span class="n">strSuffix</span></div><div class='line' id='LC69'><br/></div><div class='line' id='LC70'>			<span class="c">&#39;Add the metric object to the current monitor object</span></div><div class='line' id='LC71'>		 	<span class="n">aMonitor</span><span class="p">.</span><span class="n">MetricList</span><span class="p">.</span><span class="n">Add</span> <span class="n">Metric</span><span class="p">.</span><span class="n">Name</span><span class="p">,</span> <span class="n">Metric</span></div><div class='line' id='LC72'>		<span class="k">End</span> <span class="k">If</span></div><div class='line' id='LC73'><br/></div><div class='line' id='LC74'>	<span class="k">Next</span></div><div class='line' id='LC75'><span class="k">End</span> <span class="k">Function</span></div><div class='line' id='LC76'><br/></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/1282593/ee4f5ba90158ae27428ebaf29df6918c856e84bc/getProcessMonitor.vbs" style="float:right;">view raw</a>
            <a href="https://gist.github.com/1282593#file_get_process_monitor.vbs" style="float:right;margin-right:10px;color:#666">getProcessMonitor.vbs</a>
            <a href="https://gist.github.com/1282593">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>

<p>The <em>GetResult </em>function loops through all the result values of a monitor, creates a Metric object for each monitor and adds it to the Monitor object, and finally the function ShowInternalAgents writes all results to the screen.</p>
<div id="gist-1282602" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="k">Sub</span> <span class="nf">ShowInternalAgentsMonitors</span>	</div><div class='line' id='LC2'>	<span class="c">&#39;Write the list of agents to the screen	</span></div><div class='line' id='LC3'>	<span class="k">For</span> <span class="k">Each</span> <span class="n">agent</span> <span class="ow">In</span> <span class="n">InternalAgents</span><span class="p">.</span><span class="n">Items</span></div><div class='line' id='LC4'>		<span class="n">WScript</span><span class="p">.</span><span class="n">Echo</span> <span class="s">&quot;&quot;</span> </div><div class='line' id='LC5'>		<span class="n">WScript</span><span class="p">.</span><span class="n">Echo</span> <span class="s">&quot;-------------------------------------------------------------------------------&quot;</span></div><div class='line' id='LC6'>		<span class="n">WScript</span><span class="p">.</span><span class="n">Echo</span> <span class="s">&quot; AGENT: &quot;</span> <span class="o">&amp;</span> <span class="n">agent</span><span class="p">.</span><span class="n">Name</span></div><div class='line' id='LC7'>		<span class="n">WScript</span><span class="p">.</span><span class="n">Echo</span> <span class="s">&quot;-------------------------------------------------------------------------------&quot;</span></div><div class='line' id='LC8'><br/></div><div class='line' id='LC9'>		<span class="n">strHeader</span> <span class="o">=</span> <span class="s">&quot;&quot;</span></div><div class='line' id='LC10'>		<span class="n">strRow</span> <span class="o">=</span> <span class="s">&quot;&quot;</span></div><div class='line' id='LC11'><br/></div><div class='line' id='LC12'>		<span class="k">For</span> <span class="k">Each</span> <span class="n">monitor</span> <span class="ow">In</span> <span class="n">agent</span><span class="p">.</span><span class="n">MonitorList</span><span class="p">.</span><span class="n">Items</span></div><div class='line' id='LC13'><br/></div><div class='line' id='LC14'>			<span class="k">For</span> <span class="k">Each</span> <span class="n">objMetric</span> <span class="ow">In</span> <span class="n">Monitor</span><span class="p">.</span><span class="n">MetricList</span><span class="p">.</span><span class="n">Items</span></div><div class='line' id='LC15'>				<span class="n">strHeader</span> <span class="o">=</span> <span class="n">strHeader</span> <span class="o">&amp;</span> <span class="n">format</span><span class="p">(</span><span class="n">objMetric</span><span class="p">.</span><span class="n">Name</span><span class="p">,</span> <span class="n">objMetric</span><span class="p">.</span><span class="n">Width</span><span class="p">)</span></div><div class='line' id='LC16'>				<span class="n">strRow</span> <span class="o">=</span> <span class="n">strRow</span> <span class="o">&amp;</span> <span class="n">format</span><span class="p">(</span><span class="n">objMetric</span><span class="p">.</span><span class="n">Result</span> <span class="o">&amp;</span> <span class="n">objMetric</span><span class="p">.</span><span class="n">Suffix</span><span class="p">,</span> </div><div class='line' id='LC17'>				<span class="n">objMetric</span><span class="p">.</span><span class="n">Width</span><span class="p">)</span></div><div class='line' id='LC18'>			<span class="k">Next</span></div><div class='line' id='LC19'><br/></div><div class='line' id='LC20'>		<span class="k">Next</span></div><div class='line' id='LC21'><br/></div><div class='line' id='LC22'>		<span class="n">WScript</span><span class="p">.</span><span class="n">Echo</span> <span class="n">strHeader</span></div><div class='line' id='LC23'>		<span class="n">WScript</span><span class="p">.</span><span class="n">Echo</span> <span class="n">strRow</span></div><div class='line' id='LC24'>	<span class="k">Next</span></div><div class='line' id='LC25'><span class="k">End</span> <span class="k">Sub</span></div><div class='line' id='LC26'><br/></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/1282602/aae4a11b3918da4caa8cf72a8fb52c24be811c60/ShowInternalAgentsMonitors.vbs" style="float:right;">view raw</a>
            <a href="https://gist.github.com/1282602#file_show_internal_agents_monitors.vbs" style="float:right;margin-right:10px;color:#666">ShowInternalAgentsMonitors.vbs</a>
            <a href="https://gist.github.com/1282602">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>

<p>The function <em>GetExternalMonitors</em> gathers all the external monitors, the locations, and the monitor results.</p>
<div id="gist-1288393" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="k">Function</span> <span class="nf">GetExternalMonitors</span><span class="p">(</span><span class="n">aObjHttp</span><span class="p">,</span> <span class="n">aObjAgents</span><span class="p">,</span> <span class="n">aShowMonitors</span><span class="p">)</span></div><div class='line' id='LC2'>	<span class="k">Dim</span> <span class="n">objAgents</span><span class="p">,</span> <span class="n">xmlAgents</span></div><div class='line' id='LC3'>	<span class="k">Set</span> <span class="n">objAgents</span> <span class="o">=</span> <span class="n">CreateObject</span><span class="p">(</span><span class="s">&quot;Scripting.Dictionary&quot;</span><span class="p">)</span></div><div class='line' id='LC4'><br/></div><div class='line' id='LC5'>	<span class="c">&#39;Create the dummy Agent object</span></div><div class='line' id='LC6'>	<span class="k">Set</span> <span class="n">Agent</span> <span class="o">=</span> <span class="k">New</span> <span class="n">class_InternalAgent</span></div><div class='line' id='LC7'>	<span class="n">Agent</span><span class="p">.</span><span class="n">Id</span> <span class="o">=</span> <span class="s">&quot;&quot;</span></div><div class='line' id='LC8'>	<span class="n">Agent</span><span class="p">.</span><span class="n">Name</span> <span class="o">=</span> <span class="s">&quot;EXTERNAL&quot;</span></div><div class='line' id='LC9'><br/></div><div class='line' id='LC10'>	<span class="n">WScript</span><span class="p">.</span><span class="n">Echo</span> <span class="s">&quot;Acquiring external monitors...&quot;</span></div><div class='line' id='LC11'><br/></div><div class='line' id='LC12'>	<span class="c">&#39;Retrieve the list of agents</span></div><div class='line' id='LC13'>	<span class="n">url</span> <span class="o">=</span> <span class="s">&quot;http://www.monitis.com/api?apikey=&quot;</span> <span class="o">+</span> <span class="n">apiKey</span> <span class="o">+</span> <span class="s">&quot;&amp;output=xml&amp;version=2&amp;action=tests&quot;</span></div><div class='line' id='LC14'>	<span class="n">aObjHttp</span><span class="p">.</span><span class="n">open</span> <span class="s">&quot;GET&quot;</span><span class="p">,</span> <span class="n">url</span><span class="p">,</span> <span class="k">False</span></div><div class='line' id='LC15'>	<span class="n">aObjHttp</span><span class="p">.</span><span class="n">send</span></div><div class='line' id='LC16'><br/></div><div class='line' id='LC17'>	<span class="c">&#39;Parse response</span></div><div class='line' id='LC18'>	<span class="k">Set</span> <span class="n">xmlMonitors</span> <span class="o">=</span> <span class="n">CreateObject</span><span class="p">(</span><span class="s">&quot;Microsoft.XMLDOM&quot;</span><span class="p">)</span></div><div class='line' id='LC19'>	<span class="n">xmlMonitors</span><span class="p">.</span><span class="n">async</span> <span class="o">=</span> <span class="k">False</span></div><div class='line' id='LC20'>	<span class="n">xmlMonitors</span><span class="p">.</span><span class="n">LoadXML</span><span class="p">(</span><span class="n">aObjHttp</span><span class="p">.</span><span class="n">responseText</span><span class="p">)</span></div><div class='line' id='LC21'>	<span class="k">If</span> <span class="n">xmlMonitors</span><span class="p">.</span><span class="n">parseError</span><span class="p">.</span><span class="n">errorCode</span> <span class="o">&lt;&gt;</span> <span class="mi">0</span> <span class="k">Then</span>    </div><div class='line' id='LC22'>		<span class="n">wscript</span><span class="p">.</span><span class="n">Echo</span> <span class="n">xmlMonitors</span><span class="p">.</span><span class="n">parseError</span><span class="p">.</span><span class="n">errorCode</span>    </div><div class='line' id='LC23'>		<span class="n">wscript</span><span class="p">.</span><span class="n">Echo</span> <span class="n">xmlMonitors</span><span class="p">.</span><span class="n">parseError</span><span class="p">.</span><span class="n">reason</span>    </div><div class='line' id='LC24'>		<span class="n">wscript</span><span class="p">.</span><span class="n">Echo</span> <span class="n">xmlMonitors</span><span class="p">.</span><span class="n">parseError</span><span class="p">.</span><span class="n">line</span></div><div class='line' id='LC25'>	<span class="k">End</span> <span class="k">If</span>  	</div><div class='line' id='LC26'><br/></div><div class='line' id='LC27'><br/></div><div class='line' id='LC28'>	<span class="c">&#39;Retrieve the agent information for each agent</span></div><div class='line' id='LC29'>	<span class="k">For</span> <span class="k">Each</span> <span class="n">mon</span> <span class="ow">in</span> <span class="n">xmlMonitors</span><span class="p">.</span><span class="n">documentElement</span><span class="p">.</span><span class="n">childnodes</span></div><div class='line' id='LC30'><br/></div><div class='line' id='LC31'>		<span class="c">&#39;Create a Monitor Object	</span></div><div class='line' id='LC32'>		<span class="k">Set</span> <span class="n">Monitor</span> <span class="o">=</span> <span class="k">New</span> <span class="n">class_Monitor</span></div><div class='line' id='LC33'>		<span class="n">Monitor</span><span class="p">.</span><span class="n">Id</span> <span class="o">=</span> <span class="n">mon</span><span class="p">.</span><span class="n">Attributes</span><span class="p">.</span><span class="n">getNamedItem</span><span class="p">(</span><span class="s">&quot;id&quot;</span><span class="p">).</span><span class="n">text</span></div><div class='line' id='LC34'>		<span class="n">Monitor</span><span class="p">.</span><span class="n">Name</span> <span class="o">=</span> <span class="n">mon</span><span class="p">.</span><span class="n">text</span></div><div class='line' id='LC35'>		<span class="n">Monitor</span><span class="p">.</span><span class="n">DisplayName</span> <span class="o">=</span> <span class="n">mon</span><span class="p">.</span><span class="n">text</span></div><div class='line' id='LC36'><br/></div><div class='line' id='LC37'>		<span class="n">dt</span> <span class="o">=</span> <span class="n">DateSerial</span><span class="p">(</span><span class="n">year</span><span class="p">(</span><span class="n">now</span><span class="p">),</span> <span class="n">month</span><span class="p">(</span><span class="n">now</span><span class="p">),</span> <span class="n">day</span><span class="p">(</span><span class="n">now</span><span class="p">))</span></div><div class='line' id='LC38'>		<span class="n">url</span> <span class="o">=</span> <span class="s">&quot;http://www.monitis.com/api?action=testresult&amp;apikey=&quot;</span> <span class="o">+</span> <span class="n">apiKey</span> <span class="o">+</span> <span class="s">&quot;&amp;output=xml&amp;testId=&quot;</span> <span class="o">&amp;</span> <span class="n">Monitor</span><span class="p">.</span><span class="n">Id</span> <span class="o">+</span> <span class="s">&quot;&amp;timezone=&quot;</span> <span class="o">&amp;</span> <span class="n">timezone</span> <span class="o">&amp;</span> <span class="s">&quot;&amp;day=&quot;</span> <span class="o">&amp;</span> <span class="n">day</span><span class="p">(</span><span class="n">dt</span><span class="p">)</span> <span class="o">&amp;</span> <span class="s">&quot;&amp;month=&quot;</span> <span class="o">&amp;</span> <span class="n">month</span><span class="p">(</span><span class="n">dt</span><span class="p">)</span> <span class="o">&amp;</span> <span class="s">&quot;&amp;year=&quot;</span> <span class="o">&amp;</span> <span class="n">year</span><span class="p">(</span><span class="n">dt</span><span class="p">)</span></div><div class='line' id='LC39'>		<span class="n">aObjHttp</span><span class="p">.</span><span class="n">open</span> <span class="s">&quot;GET&quot;</span><span class="p">,</span> <span class="n">url</span><span class="p">,</span> <span class="k">False</span></div><div class='line' id='LC40'>		<span class="n">aObjHttp</span><span class="p">.</span><span class="n">send</span></div><div class='line' id='LC41'><br/></div><div class='line' id='LC42'>		<span class="k">Set</span> <span class="n">oRes</span> <span class="o">=</span> <span class="n">CreateObject</span><span class="p">(</span><span class="s">&quot;Microsoft.XMLDOM&quot;</span><span class="p">)</span></div><div class='line' id='LC43'>		<span class="n">oRes</span><span class="p">.</span><span class="n">async</span> <span class="o">=</span> <span class="k">False</span></div><div class='line' id='LC44'>		<span class="n">oRes</span><span class="p">.</span><span class="n">LoadXML</span><span class="p">(</span><span class="n">aObjHttp</span><span class="p">.</span><span class="n">responseText</span><span class="p">)</span></div><div class='line' id='LC45'><br/></div><div class='line' id='LC46'>		<span class="c">&#39;Loop throught the locations</span></div><div class='line' id='LC47'>		<span class="k">For</span> <span class="k">Each</span> <span class="n">t</span> <span class="ow">In</span> <span class="n">oRes</span><span class="p">.</span><span class="n">firstchild</span><span class="p">.</span><span class="n">childnodes</span></div><div class='line' id='LC48'>			<span class="k">If</span> <span class="n">t</span><span class="p">.</span><span class="n">nodeName</span> <span class="o">=</span> <span class="s">&quot;location&quot;</span> <span class="k">Then</span></div><div class='line' id='LC49'><br/></div><div class='line' id='LC50'>				<span class="k">Set</span> <span class="n">Metric</span> <span class="o">=</span> <span class="k">New</span> <span class="n">class_Metric</span></div><div class='line' id='LC51'>				<span class="n">Metric</span><span class="p">.</span><span class="n">Name</span> <span class="o">=</span> <span class="n">t</span><span class="p">.</span><span class="n">Attributes</span><span class="p">.</span><span class="n">GetNamedItem</span><span class="p">(</span><span class="s">&quot;name&quot;</span><span class="p">).</span><span class="n">text</span></div><div class='line' id='LC52'><br/></div><div class='line' id='LC53'>				<span class="c">&#39;Loop through the results for the current location</span></div><div class='line' id='LC54'>				<span class="k">For</span> <span class="k">Each</span> <span class="n">cell</span> <span class="ow">In</span> <span class="n">t</span><span class="p">.</span><span class="n">firstChild</span><span class="p">.</span><span class="n">childnodes</span></div><div class='line' id='LC55'>					<span class="k">If</span> <span class="n">LCase</span><span class="p">(</span><span class="n">cell</span><span class="p">.</span><span class="n">nodename</span><span class="p">)</span> <span class="o">=</span> <span class="s">&quot;cell&quot;</span> <span class="k">Then</span></div><div class='line' id='LC56'>						<span class="n">Metric</span><span class="p">.</span><span class="n">Result</span> <span class="o">=</span> <span class="n">cell</span><span class="p">.</span><span class="n">text</span>	</div><div class='line' id='LC57'>					<span class="k">End</span> <span class="k">If</span></div><div class='line' id='LC58'>				<span class="k">Next</span></div><div class='line' id='LC59'><br/></div><div class='line' id='LC60'>				<span class="c">&#39;Add the Metric object to the Monitor List</span></div><div class='line' id='LC61'>				<span class="n">Monitor</span><span class="p">.</span><span class="n">MetricList</span><span class="p">.</span><span class="n">Add</span> <span class="n">Metric</span><span class="p">.</span><span class="n">Name</span><span class="p">,</span> <span class="n">Metric</span></div><div class='line' id='LC62'>			<span class="k">End</span> <span class="k">If</span></div><div class='line' id='LC63'>		<span class="k">Next</span></div><div class='line' id='LC64'><br/></div><div class='line' id='LC65'>		<span class="c">&#39;Add the agent object to the list of agents</span></div><div class='line' id='LC66'>		<span class="n">Agent</span><span class="p">.</span><span class="n">MonitorList</span><span class="p">.</span><span class="n">Add</span> <span class="n">Monitor</span><span class="p">.</span><span class="n">Id</span><span class="p">,</span> <span class="n">Monitor</span></div><div class='line' id='LC67'>	<span class="k">Next</span></div><div class='line' id='LC68'><br/></div><div class='line' id='LC69'><br/></div><div class='line' id='LC70'>	<span class="n">aObjAgents</span><span class="p">.</span><span class="n">Add</span> <span class="n">Agent</span><span class="p">.</span><span class="n">Id</span><span class="p">,</span> <span class="n">Agent</span></div><div class='line' id='LC71'><span class="k">End</span> <span class="k">Function</span></div><div class='line' id='LC72'><br/></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/1288393/17daf67efb08d79fbfd48ff0a79e90c7898e11bd/funcExternalMonitors.vbs" style="float:right;">view raw</a>
            <a href="https://gist.github.com/1288393#file_func_external_monitors.vbs" style="float:right;margin-right:10px;color:#666">funcExternalMonitors.vbs</a>
            <a href="https://gist.github.com/1288393">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>

<p>The complete code of this article is available for<a href="https://github.com/monitisexchange/Windows-Monitoring-Scripts/tree/master/vbscript"> download at GitHub.</a></p>
Share Now:<a rel="nofollow"   href="http://delicious.com/post?url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2011%2F10%2F17%2Fmonitis-top-an-open-source-command-line-interface-for-monitis-agents-and-monitors%2F&amp;title=Monitis-Top%E2%80%A6%20an%20open-source%20command-line%20interface%20for%20Monitis%20Agents%20and%20Monitors&amp;notes=%C2%A0In%20this%20article%20we%E2%80%99ll%20discuss%20creating%20a%20command%20line%20interface%20to%20query%20the%20Monitis%20Agents%20and%20Monitors%20you%20have%20activated%20for%20your%20systems.%20We%E2%80%99ll%20provide%20the%20source%20code%20for%20the%20utility%20in%20VBScript%20and%20we%20will%20also%20be%20working%20on%20a%20C%23%20version." ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/delicious.png" class="sociable-img sociable-hovers" title="del.icio.us" alt="del.icio.us" /></a><a rel="nofollow"   href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2011%2F10%2F17%2Fmonitis-top-an-open-source-command-line-interface-for-monitis-agents-and-monitors%2F&amp;title=Monitis-Top%E2%80%A6%20an%20open-source%20command-line%20interface%20for%20Monitis%20Agents%20and%20Monitors&amp;bodytext=%C2%A0In%20this%20article%20we%E2%80%99ll%20discuss%20creating%20a%20command%20line%20interface%20to%20query%20the%20Monitis%20Agents%20and%20Monitors%20you%20have%20activated%20for%20your%20systems.%20We%E2%80%99ll%20provide%20the%20source%20code%20for%20the%20utility%20in%20VBScript%20and%20we%20will%20also%20be%20working%20on%20a%20C%23%20version." ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/digg.png" class="sociable-img sociable-hovers" title="Digg" alt="Digg" /></a><a rel="nofollow"   href="http://www.facebook.com/share.php?u=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2011%2F10%2F17%2Fmonitis-top-an-open-source-command-line-interface-for-monitis-agents-and-monitors%2F&amp;t=Monitis-Top%E2%80%A6%20an%20open-source%20command-line%20interface%20for%20Monitis%20Agents%20and%20Monitors" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/facebook.png" class="sociable-img sociable-hovers" title="Facebook" alt="Facebook" /></a><a rel="nofollow"   href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2011%2F10%2F17%2Fmonitis-top-an-open-source-command-line-interface-for-monitis-agents-and-monitors%2F&amp;title=Monitis-Top%E2%80%A6%20an%20open-source%20command-line%20interface%20for%20Monitis%20Agents%20and%20Monitors&amp;source=Uptime+%26amp%3B+Performance+Tips+Tips+for+SysAdmin%2C+Webmaster%2C+Network+Admin&amp;summary=%C2%A0In%20this%20article%20we%E2%80%99ll%20discuss%20creating%20a%20command%20line%20interface%20to%20query%20the%20Monitis%20Agents%20and%20Monitors%20you%20have%20activated%20for%20your%20systems.%20We%E2%80%99ll%20provide%20the%20source%20code%20for%20the%20utility%20in%20VBScript%20and%20we%20will%20also%20be%20working%20on%20a%20C%23%20version." ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/linkedin.png" class="sociable-img sociable-hovers" title="LinkedIn" alt="LinkedIn" /></a><a rel="nofollow"   href="http://www.blinklist.com/index.php?Action=Blink/addblink.php&amp;Url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2011%2F10%2F17%2Fmonitis-top-an-open-source-command-line-interface-for-monitis-agents-and-monitors%2F&amp;Title=Monitis-Top%E2%80%A6%20an%20open-source%20command-line%20interface%20for%20Monitis%20Agents%20and%20Monitors" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/blinklist.png" class="sociable-img sociable-hovers" title="BlinkList" alt="BlinkList" /></a><a rel="nofollow"   href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2011%2F10%2F17%2Fmonitis-top-an-open-source-command-line-interface-for-monitis-agents-and-monitors%2F&amp;title=Monitis-Top%E2%80%A6%20an%20open-source%20command-line%20interface%20for%20Monitis%20Agents%20and%20Monitors" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/dzone.png" class="sociable-img sociable-hovers" title="DZone" alt="DZone" /></a><a rel="nofollow"   href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2011%2F10%2F17%2Fmonitis-top-an-open-source-command-line-interface-for-monitis-agents-and-monitors%2F&amp;title=Monitis-Top%E2%80%A6%20an%20open-source%20command-line%20interface%20for%20Monitis%20Agents%20and%20Monitors&amp;annotation=%C2%A0In%20this%20article%20we%E2%80%99ll%20discuss%20creating%20a%20command%20line%20interface%20to%20query%20the%20Monitis%20Agents%20and%20Monitors%20you%20have%20activated%20for%20your%20systems.%20We%E2%80%99ll%20provide%20the%20source%20code%20for%20the%20utility%20in%20VBScript%20and%20we%20will%20also%20be%20working%20on%20a%20C%23%20version." ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/googlebookmark.png" class="sociable-img sociable-hovers" title="Google Bookmarks" alt="Google Bookmarks" /></a><a rel="nofollow"   href="http://reddit.com/submit?url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2011%2F10%2F17%2Fmonitis-top-an-open-source-command-line-interface-for-monitis-agents-and-monitors%2F&amp;title=Monitis-Top%E2%80%A6%20an%20open-source%20command-line%20interface%20for%20Monitis%20Agents%20and%20Monitors" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/reddit.png" class="sociable-img sociable-hovers" title="Reddit" alt="Reddit" /></a><a rel="nofollow"   href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2011%2F10%2F17%2Fmonitis-top-an-open-source-command-line-interface-for-monitis-agents-and-monitors%2F&amp;title=Monitis-Top%E2%80%A6%20an%20open-source%20command-line%20interface%20for%20Monitis%20Agents%20and%20Monitors" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/stumbleupon.png" class="sociable-img sociable-hovers" title="StumbleUpon" alt="StumbleUpon" /></a><a rel="nofollow"   href="http://twitter.com/home?status=Monitis-Top%E2%80%A6%20an%20open-source%20command-line%20interface%20for%20Monitis%20Agents%20and%20Monitors%20-%20http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2011%2F10%2F17%2Fmonitis-top-an-open-source-command-line-interface-for-monitis-agents-and-monitors%2F" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/twitter.png" class="sociable-img sociable-hovers" title="Twitter" alt="Twitter" /></a><a rel="nofollow"   href="http://blog.monitis.com/index.php/feed/" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/rss.png" class="sociable-img sociable-hovers" title="RSS" alt="RSS" /></a><br/><br/>]]></content:encoded>
			<wfw:commentRss>http://blog.monitis.com/index.php/2011/10/17/monitis-top-an-open-source-command-line-interface-for-monitis-agents-and-monitors/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Monitor Everything with Monitis – And do it easily with PowerShell – Part 5</title>
		<link>http://blog.monitis.com/index.php/2011/10/10/monitor-everything-with-monitis-and-do-it-easily-with-powershell-part-5/</link>
		<comments>http://blog.monitis.com/index.php/2011/10/10/monitor-everything-with-monitis-and-do-it-easily-with-powershell-part-5/#comments</comments>
		<pubDate>Mon, 10 Oct 2011 11:06:16 +0000</pubDate>
		<dc:creator>Hovhannes Avoyan</dc:creator>
				<category><![CDATA[Monitoring Scripts]]></category>
		<category><![CDATA[Sysadmin Tools]]></category>
		<category><![CDATA[Website Monitoring]]></category>
		<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://blog.monitis.com/?p=3992</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://blog.monitis.com/index.php/2011/10/10/monitor-everything-with-monitis-and-do-it-easily-with-powershell-part-5/' addthis:title='Monitor Everything with Monitis – And do it easily with PowerShell – Part 5 '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>Testing Web Content with Monitis, Excel, and PowerShell &#160; In the last few articles, we’ve shown you how easy it is to monitor anything with the open source Monitis PowerShell Module.  Last time, we covered how to interact with web applications, and before that, you got a small taste of how working in a real [...]]]></description>
			<content:encoded><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://blog.monitis.com/index.php/2011/10/10/monitor-everything-with-monitis-and-do-it-easily-with-powershell-part-5/' addthis:title='Monitor Everything with Monitis – And do it easily with PowerShell – Part 5 '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div><p><img class="alignnone size-full wp-image-3383" style="float: right;" title="powershell" src="http://blog.monitis.com/wp-content/uploads/2011/08/pshell.jpeg" alt="" width="204" height="204" /></p>
<h3>Testing Web Content with Monitis, Excel, and PowerShell</h3>
<p>&nbsp;</p>
<p>In the <a href="http://blog.monitis.com/index.php/2011/10/04/monitor-everything-with-monitis-and-do-it-easily-with-powershell-part-4/">last few articles</a>, we’ve shown you how easy it is to monitor anything with the o<a href="https://github.com/monitisexchange/Windows-Monitoring-Scripts/tree/master/powershell/Module">pen source Monitis PowerShell Module</a>.  Last time, we covered<a href="http://blog.monitis.com/index.php/2011/10/04/monitor-everything-with-monitis-and-do-it-easily-with-powershell-part-4/"> how to interact with web applications</a>, and before that, you got a small taste of how working in a real scripting language like PowerShell can make it miles easier to <a href="http://blog.monitis.com/index.php/2011/09/29/monitor-everything-with-monitis-and-do-it-easily-with-powershell-part3/">add batches of monitors</a>.</p>
<p>Today, we’re going to cover two more parameters of Add-MonitisExternalMonitor that makes it easy to build web content, and then we’re going to build a really simple way to make use an excel spreadsheet to create all of your web monitors in PowerShell.<span id="more-3992"></span></p>
<p>The two new parameters you’ll want to learn are:</p>
<ul>
<li><strong>ExpectedContentPattern</strong> – A regular expression you expect to find in the results</li>
<li><strong>RequiredResponseTime</strong> – the maximum amount of time it should take to get a response</li>
</ul>
<p>To start out with, create an excel spreadsheet, and make a few columns:</p>
<ul>
<li>Url</li>
<li>MonitorType</li>
<li>OperationType</li>
<li>Postdata</li>
<li>ExpectedContentPattern</li>
<li>RequiredResponseTime</li>
</ul>
<p>Now, row by row, fill in things you’d like to test.  These are going to be parameters of Add-MonitisExternalMonitor.  Only Url, MonitorType, and OperationType are required.  OperationType can be “Get”, “Post”, “Put” or “Delete”.   MonitorType can be any number of internet protocols, but you’ll probably use ping, http, and https.</p>
<p>Once you’ve filled in the spreadsheet, save it as a CSV.</p>
<p>At this point, you can use this CSV as a way to quickly recreate all of your monitors in two lines:</p>
<pre>Connect-Monitis -ApiKey $apiKey -SecretKey $secretKey</pre>
<pre>Import-Csv .\MyWebTest.csv | Add-MonitisExternalMonitor</pre>
<p>&nbsp;</p>
<p>The PowerShell trick that makes this work is the object pipeline.  We talked some about the pipeline a couple of days ago, when we introduced how to manage your monitors.  Almost all of the commands in the Monitis PowerShell module are aware of the object pipeline, and that means that when Import-CSV returns back a bunch of objects, those objects just work with Monitis.</p>
<p>This simple example should start to really give you a taste of what Monitis and PowerShell can do together, but we’re really just getting started.   Next time, we’re going to start looking at the coolest part of Monitis, custom monitors, and show you how you can use PowerShell to monitor absolutely anything with Monitis.</p>
<p><a href="http://portal.monitis.com"><img class="alignnone size-full wp-image-2531" title="Monitis Monitoring" src="http://blog.monitis.com/wp-content/uploads/2011/06/Banner-728-x-90.jpg" alt="Monitis Monitoring" width="728" height="90" /></a></p>
<p>See also</p>
<p><a title="Permanent Link to Monitor Everything with Monitis – And do it easily with PowerShell – Part 1" href="http://blog.monitis.com/index.php/2011/09/19/monitor-everything-with-monitis-and-do-it-easily-with-powershell-part-1/" rel="bookmark">Monitor Everything with Monitis – And do it easily with PowerShell – Part 1</a></p>
<p><a title="Permanent Link to Monitor Everything with Monitis – And do it easily with PowerShell – Part 2" href="http://blog.monitis.com/index.php/2011/09/22/monitor-everything-with-monitis-and-do-it-easily-with-powershell-part-2/" rel="bookmark">Monitor Everything with Monitis – And do it easily with PowerShell – Part 2</a></p>
<p><a title="Permanent Link to Monitor Everything with Monitis – And do it easily with PowerShell – Part 3" href="http://blog.monitis.com/index.php/2011/09/29/monitor-everything-with-monitis-and-do-it-easily-with-powershell-part3/" rel="bookmark">Monitor Everything with Monitis – And do it easily with PowerShell – Part 3</a></p>
<p><a title="Permanent Link to Monitor Everything with Monitis – And do it easily with PowerShell – Part 4" href="http://blog.monitis.com/index.php/2011/10/04/monitor-everything-with-monitis-and-do-it-easily-with-powershell-part-4/" rel="bookmark">Monitor Everything with Monitis – And do it easily with PowerShell – Part 4</a></p>
Share Now:<a rel="nofollow"   href="http://delicious.com/post?url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2011%2F10%2F10%2Fmonitor-everything-with-monitis-and-do-it-easily-with-powershell-part-5%2F&amp;title=Monitor%20Everything%20with%20Monitis%20%E2%80%93%20And%20do%20it%20easily%20with%20PowerShell%20%E2%80%93%20Part%205&amp;notes=%0D%0ATesting%20Web%20Content%20with%20Monitis%2C%20Excel%2C%20and%20PowerShell%0D%0A%26nbsp%3B%0D%0A%0D%0AIn%20the%20last%20few%20articles%2C%20we%E2%80%99ve%20shown%20you%20how%20easy%20it%20is%20to%20monitor%20anything%20with%20the%20open%20source%20Monitis%20PowerShell%20Module.%C2%A0%20Last%20time%2C%20we%20covered%20how%20to%20interact%20with%20web%20appli" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/delicious.png" class="sociable-img sociable-hovers" title="del.icio.us" alt="del.icio.us" /></a><a rel="nofollow"   href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2011%2F10%2F10%2Fmonitor-everything-with-monitis-and-do-it-easily-with-powershell-part-5%2F&amp;title=Monitor%20Everything%20with%20Monitis%20%E2%80%93%20And%20do%20it%20easily%20with%20PowerShell%20%E2%80%93%20Part%205&amp;bodytext=%0D%0ATesting%20Web%20Content%20with%20Monitis%2C%20Excel%2C%20and%20PowerShell%0D%0A%26nbsp%3B%0D%0A%0D%0AIn%20the%20last%20few%20articles%2C%20we%E2%80%99ve%20shown%20you%20how%20easy%20it%20is%20to%20monitor%20anything%20with%20the%20open%20source%20Monitis%20PowerShell%20Module.%C2%A0%20Last%20time%2C%20we%20covered%20how%20to%20interact%20with%20web%20appli" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/digg.png" class="sociable-img sociable-hovers" title="Digg" alt="Digg" /></a><a rel="nofollow"   href="http://www.facebook.com/share.php?u=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2011%2F10%2F10%2Fmonitor-everything-with-monitis-and-do-it-easily-with-powershell-part-5%2F&amp;t=Monitor%20Everything%20with%20Monitis%20%E2%80%93%20And%20do%20it%20easily%20with%20PowerShell%20%E2%80%93%20Part%205" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/facebook.png" class="sociable-img sociable-hovers" title="Facebook" alt="Facebook" /></a><a rel="nofollow"   href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2011%2F10%2F10%2Fmonitor-everything-with-monitis-and-do-it-easily-with-powershell-part-5%2F&amp;title=Monitor%20Everything%20with%20Monitis%20%E2%80%93%20And%20do%20it%20easily%20with%20PowerShell%20%E2%80%93%20Part%205&amp;source=Uptime+%26amp%3B+Performance+Tips+Tips+for+SysAdmin%2C+Webmaster%2C+Network+Admin&amp;summary=%0D%0ATesting%20Web%20Content%20with%20Monitis%2C%20Excel%2C%20and%20PowerShell%0D%0A%26nbsp%3B%0D%0A%0D%0AIn%20the%20last%20few%20articles%2C%20we%E2%80%99ve%20shown%20you%20how%20easy%20it%20is%20to%20monitor%20anything%20with%20the%20open%20source%20Monitis%20PowerShell%20Module.%C2%A0%20Last%20time%2C%20we%20covered%20how%20to%20interact%20with%20web%20appli" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/linkedin.png" class="sociable-img sociable-hovers" title="LinkedIn" alt="LinkedIn" /></a><a rel="nofollow"   href="http://www.blinklist.com/index.php?Action=Blink/addblink.php&amp;Url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2011%2F10%2F10%2Fmonitor-everything-with-monitis-and-do-it-easily-with-powershell-part-5%2F&amp;Title=Monitor%20Everything%20with%20Monitis%20%E2%80%93%20And%20do%20it%20easily%20with%20PowerShell%20%E2%80%93%20Part%205" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/blinklist.png" class="sociable-img sociable-hovers" title="BlinkList" alt="BlinkList" /></a><a rel="nofollow"   href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2011%2F10%2F10%2Fmonitor-everything-with-monitis-and-do-it-easily-with-powershell-part-5%2F&amp;title=Monitor%20Everything%20with%20Monitis%20%E2%80%93%20And%20do%20it%20easily%20with%20PowerShell%20%E2%80%93%20Part%205" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/dzone.png" class="sociable-img sociable-hovers" title="DZone" alt="DZone" /></a><a rel="nofollow"   href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2011%2F10%2F10%2Fmonitor-everything-with-monitis-and-do-it-easily-with-powershell-part-5%2F&amp;title=Monitor%20Everything%20with%20Monitis%20%E2%80%93%20And%20do%20it%20easily%20with%20PowerShell%20%E2%80%93%20Part%205&amp;annotation=%0D%0ATesting%20Web%20Content%20with%20Monitis%2C%20Excel%2C%20and%20PowerShell%0D%0A%26nbsp%3B%0D%0A%0D%0AIn%20the%20last%20few%20articles%2C%20we%E2%80%99ve%20shown%20you%20how%20easy%20it%20is%20to%20monitor%20anything%20with%20the%20open%20source%20Monitis%20PowerShell%20Module.%C2%A0%20Last%20time%2C%20we%20covered%20how%20to%20interact%20with%20web%20appli" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/googlebookmark.png" class="sociable-img sociable-hovers" title="Google Bookmarks" alt="Google Bookmarks" /></a><a rel="nofollow"   href="http://reddit.com/submit?url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2011%2F10%2F10%2Fmonitor-everything-with-monitis-and-do-it-easily-with-powershell-part-5%2F&amp;title=Monitor%20Everything%20with%20Monitis%20%E2%80%93%20And%20do%20it%20easily%20with%20PowerShell%20%E2%80%93%20Part%205" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/reddit.png" class="sociable-img sociable-hovers" title="Reddit" alt="Reddit" /></a><a rel="nofollow"   href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2011%2F10%2F10%2Fmonitor-everything-with-monitis-and-do-it-easily-with-powershell-part-5%2F&amp;title=Monitor%20Everything%20with%20Monitis%20%E2%80%93%20And%20do%20it%20easily%20with%20PowerShell%20%E2%80%93%20Part%205" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/stumbleupon.png" class="sociable-img sociable-hovers" title="StumbleUpon" alt="StumbleUpon" /></a><a rel="nofollow"   href="http://twitter.com/home?status=Monitor%20Everything%20with%20Monitis%20%E2%80%93%20And%20do%20it%20easily%20with%20PowerShell%20%E2%80%93%20Part%205%20-%20http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2011%2F10%2F10%2Fmonitor-everything-with-monitis-and-do-it-easily-with-powershell-part-5%2F" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/twitter.png" class="sociable-img sociable-hovers" title="Twitter" alt="Twitter" /></a><a rel="nofollow"   href="http://blog.monitis.com/index.php/feed/" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/rss.png" class="sociable-img sociable-hovers" title="RSS" alt="RSS" /></a><br/><br/>]]></content:encoded>
			<wfw:commentRss>http://blog.monitis.com/index.php/2011/10/10/monitor-everything-with-monitis-and-do-it-easily-with-powershell-part-5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Monitor Everything with Monitis – And do it easily with PowerShell – Part 4</title>
		<link>http://blog.monitis.com/index.php/2011/10/04/monitor-everything-with-monitis-and-do-it-easily-with-powershell-part-4/</link>
		<comments>http://blog.monitis.com/index.php/2011/10/04/monitor-everything-with-monitis-and-do-it-easily-with-powershell-part-4/#comments</comments>
		<pubDate>Tue, 04 Oct 2011 16:28:51 +0000</pubDate>
		<dc:creator>Hovhannes Avoyan</dc:creator>
				<category><![CDATA[Monitoring Scripts]]></category>
		<category><![CDATA[Website Monitoring]]></category>
		<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://blog.monitis.com/?p=3963</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://blog.monitis.com/index.php/2011/10/04/monitor-everything-with-monitis-and-do-it-easily-with-powershell-part-4/' addthis:title='Monitor Everything with Monitis – And do it easily with PowerShell – Part 4 '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>Monitoring Web Applications with Monitis We’ve been learning about a lot of cool things we can do with the Monitis PowerShell Module, which is built on top of the Monitis REST API.  Yesterday, we saw how we can use a simple script to monitor as many domains as we want.  The day before that, we [...]]]></description>
			<content:encoded><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://blog.monitis.com/index.php/2011/10/04/monitor-everything-with-monitis-and-do-it-easily-with-powershell-part-4/' addthis:title='Monitor Everything with Monitis – And do it easily with PowerShell – Part 4 '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div><p><img class="alignnone size-full wp-image-3383" style="float: right;" title="powershell" src="http://blog.monitis.com/wp-content/uploads/2011/08/pshell.jpeg" alt="" width="204" height="204" /></p>
<h3>Monitoring Web Applications with Monitis</h3>
<p>We’ve been learning about a lot of cool things we can do with the <a href="http://blog.monitis.com/index.php/2011/09/29/monitor-everything-with-monitis-and-do-it-easily-with-powershell-part3/">Monitis PowerShell Module</a>, which is built on top of the Monitis REST API.  Yesterday, we saw how we can use a simple script to monitor as many domains as we want.  The day before that, we saw how we can seamlessly manage all of our monitors.  Today, we’re going to cover monitoring web applications.</p>
<p>As a reminder, start out by running PowerShell, and running the command:  Import-Module Monitis.  Then use the Connect-Monitis command and your APIKey and SecretKey to connect.  From then on in, you’ll reuse your keep for every operation.<span id="more-3963"></span></p>
<p>To see how you can use Monitis to help you monitor your web applications, run:</p>
<pre style="word-wrap: break-word; white-space: pre-wrap; padding: 15px;">Get-Help Add-MonitisExternalMonitor –parameter PostData</pre>
<p>In PowerShell, every command and parameter has built in help and examples.  You can use this to explore the possibilities of what you can do with the command right on your desktop.</p>
<p>PostData sends additional data for the web request, and from this, you can test your web applications.  For instance, if you have a search page, you can use –PostData to send the appropriate information to the page.   Another parameter, -Credential allows you to store a credential for the request, and another –OverSsl, will force the request to occur over SSL.</p>
<p>By making the monitor use postdata, instead of just ping your site, you can ensure that your web sites  and services are properly functioning.   Here’s a quick example of a monitor for a custom search engine:</p>
<pre style="word-wrap: break-word; white-space: pre-wrap; padding: 15px;">Add-MonitisExternalMonitor -Name "SearchEngineMonitor" -Tag "MySites" -MonitorType http -PostData "q=hello+world" -url "a.searchengine.com"</pre>
<p>If it was a user update page, you might try something like:</p>
<pre style="word-wrap: break-word; white-space: pre-wrap; padding: 15px;">Add-MonitisExternalMonitor -Name "UserUpdateMonitor" -Tag "MySites" -MonitorType http -OperationType Post –Credential (Get-Credential) -OverSsl -Url "users.mydomain.com/update.aspx" -PostData "newPhoneNumber=8675309"</pre>
<p>Monitis keeps track of how long it takes to complete the request from several locations, so you can keep track of how your web application responds from anywhere within the world.</p>
<p>Today, we’ve learned how easy it is to monitor web applications with Monitis.  Next, we’ll talk about testing web content, and how you can use a nifty little command in PowerShell called Import-CSV to easily create lists of tests for your web application, and then keep track of how they perform in Monitis.</p>
<p>See also</p>
<p><a title="Permanent Link to Monitor Everything with Monitis – And do it easily with PowerShell – Part 1" href="http://blog.monitis.com/index.php/2011/09/19/monitor-everything-with-monitis-and-do-it-easily-with-powershell-part-1/" rel="bookmark">Monitor Everything with Monitis – And do it easily with PowerShell – Part 1</a></p>
<p><a title="Permanent Link to Monitor Everything with Monitis – And do it easily with PowerShell – Part 2" href="http://blog.monitis.com/index.php/2011/09/22/monitor-everything-with-monitis-and-do-it-easily-with-powershell-part-2/" rel="bookmark">Monitor Everything with Monitis – And do it easily with PowerShell – Part 2</a></p>
<p><a title="Permanent Link to Monitor Everything with Monitis – And do it easily with PowerShell – Part 3" href="http://blog.monitis.com/index.php/2011/09/29/monitor-everything-with-monitis-and-do-it-easily-with-powershell-part3/" rel="bookmark">Monitor Everything with Monitis – And do it easily with PowerShell – Part 3</a></p>
Share Now:<a rel="nofollow"   href="http://delicious.com/post?url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2011%2F10%2F04%2Fmonitor-everything-with-monitis-and-do-it-easily-with-powershell-part-4%2F&amp;title=Monitor%20Everything%20with%20Monitis%20%E2%80%93%20And%20do%20it%20easily%20with%20PowerShell%20%E2%80%93%20Part%204&amp;notes=%0D%0AMonitoring%20Web%20Applications%20with%20Monitis%0D%0AWe%E2%80%99ve%20been%20learning%20about%20a%20lot%20of%20cool%20things%20we%20can%20do%20with%20the%20Monitis%20PowerShell%20Module%2C%20which%20is%20built%20on%20top%20of%20the%20Monitis%20REST%20API.%C2%A0%20Yesterday%2C%20we%20saw%20how%20we%20can%20use%20a%20simple%20script%20to%20monitor%20as" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/delicious.png" class="sociable-img sociable-hovers" title="del.icio.us" alt="del.icio.us" /></a><a rel="nofollow"   href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2011%2F10%2F04%2Fmonitor-everything-with-monitis-and-do-it-easily-with-powershell-part-4%2F&amp;title=Monitor%20Everything%20with%20Monitis%20%E2%80%93%20And%20do%20it%20easily%20with%20PowerShell%20%E2%80%93%20Part%204&amp;bodytext=%0D%0AMonitoring%20Web%20Applications%20with%20Monitis%0D%0AWe%E2%80%99ve%20been%20learning%20about%20a%20lot%20of%20cool%20things%20we%20can%20do%20with%20the%20Monitis%20PowerShell%20Module%2C%20which%20is%20built%20on%20top%20of%20the%20Monitis%20REST%20API.%C2%A0%20Yesterday%2C%20we%20saw%20how%20we%20can%20use%20a%20simple%20script%20to%20monitor%20as" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/digg.png" class="sociable-img sociable-hovers" title="Digg" alt="Digg" /></a><a rel="nofollow"   href="http://www.facebook.com/share.php?u=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2011%2F10%2F04%2Fmonitor-everything-with-monitis-and-do-it-easily-with-powershell-part-4%2F&amp;t=Monitor%20Everything%20with%20Monitis%20%E2%80%93%20And%20do%20it%20easily%20with%20PowerShell%20%E2%80%93%20Part%204" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/facebook.png" class="sociable-img sociable-hovers" title="Facebook" alt="Facebook" /></a><a rel="nofollow"   href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2011%2F10%2F04%2Fmonitor-everything-with-monitis-and-do-it-easily-with-powershell-part-4%2F&amp;title=Monitor%20Everything%20with%20Monitis%20%E2%80%93%20And%20do%20it%20easily%20with%20PowerShell%20%E2%80%93%20Part%204&amp;source=Uptime+%26amp%3B+Performance+Tips+Tips+for+SysAdmin%2C+Webmaster%2C+Network+Admin&amp;summary=%0D%0AMonitoring%20Web%20Applications%20with%20Monitis%0D%0AWe%E2%80%99ve%20been%20learning%20about%20a%20lot%20of%20cool%20things%20we%20can%20do%20with%20the%20Monitis%20PowerShell%20Module%2C%20which%20is%20built%20on%20top%20of%20the%20Monitis%20REST%20API.%C2%A0%20Yesterday%2C%20we%20saw%20how%20we%20can%20use%20a%20simple%20script%20to%20monitor%20as" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/linkedin.png" class="sociable-img sociable-hovers" title="LinkedIn" alt="LinkedIn" /></a><a rel="nofollow"   href="http://www.blinklist.com/index.php?Action=Blink/addblink.php&amp;Url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2011%2F10%2F04%2Fmonitor-everything-with-monitis-and-do-it-easily-with-powershell-part-4%2F&amp;Title=Monitor%20Everything%20with%20Monitis%20%E2%80%93%20And%20do%20it%20easily%20with%20PowerShell%20%E2%80%93%20Part%204" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/blinklist.png" class="sociable-img sociable-hovers" title="BlinkList" alt="BlinkList" /></a><a rel="nofollow"   href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2011%2F10%2F04%2Fmonitor-everything-with-monitis-and-do-it-easily-with-powershell-part-4%2F&amp;title=Monitor%20Everything%20with%20Monitis%20%E2%80%93%20And%20do%20it%20easily%20with%20PowerShell%20%E2%80%93%20Part%204" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/dzone.png" class="sociable-img sociable-hovers" title="DZone" alt="DZone" /></a><a rel="nofollow"   href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2011%2F10%2F04%2Fmonitor-everything-with-monitis-and-do-it-easily-with-powershell-part-4%2F&amp;title=Monitor%20Everything%20with%20Monitis%20%E2%80%93%20And%20do%20it%20easily%20with%20PowerShell%20%E2%80%93%20Part%204&amp;annotation=%0D%0AMonitoring%20Web%20Applications%20with%20Monitis%0D%0AWe%E2%80%99ve%20been%20learning%20about%20a%20lot%20of%20cool%20things%20we%20can%20do%20with%20the%20Monitis%20PowerShell%20Module%2C%20which%20is%20built%20on%20top%20of%20the%20Monitis%20REST%20API.%C2%A0%20Yesterday%2C%20we%20saw%20how%20we%20can%20use%20a%20simple%20script%20to%20monitor%20as" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/googlebookmark.png" class="sociable-img sociable-hovers" title="Google Bookmarks" alt="Google Bookmarks" /></a><a rel="nofollow"   href="http://reddit.com/submit?url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2011%2F10%2F04%2Fmonitor-everything-with-monitis-and-do-it-easily-with-powershell-part-4%2F&amp;title=Monitor%20Everything%20with%20Monitis%20%E2%80%93%20And%20do%20it%20easily%20with%20PowerShell%20%E2%80%93%20Part%204" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/reddit.png" class="sociable-img sociable-hovers" title="Reddit" alt="Reddit" /></a><a rel="nofollow"   href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2011%2F10%2F04%2Fmonitor-everything-with-monitis-and-do-it-easily-with-powershell-part-4%2F&amp;title=Monitor%20Everything%20with%20Monitis%20%E2%80%93%20And%20do%20it%20easily%20with%20PowerShell%20%E2%80%93%20Part%204" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/stumbleupon.png" class="sociable-img sociable-hovers" title="StumbleUpon" alt="StumbleUpon" /></a><a rel="nofollow"   href="http://twitter.com/home?status=Monitor%20Everything%20with%20Monitis%20%E2%80%93%20And%20do%20it%20easily%20with%20PowerShell%20%E2%80%93%20Part%204%20-%20http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2011%2F10%2F04%2Fmonitor-everything-with-monitis-and-do-it-easily-with-powershell-part-4%2F" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/twitter.png" class="sociable-img sociable-hovers" title="Twitter" alt="Twitter" /></a><a rel="nofollow"   href="http://blog.monitis.com/index.php/feed/" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/rss.png" class="sociable-img sociable-hovers" title="RSS" alt="RSS" /></a><br/><br/>]]></content:encoded>
			<wfw:commentRss>http://blog.monitis.com/index.php/2011/10/04/monitor-everything-with-monitis-and-do-it-easily-with-powershell-part-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Monitor Everything with Monitis &#8211; And do it easily with PowerShell &#8211; Part 3</title>
		<link>http://blog.monitis.com/index.php/2011/09/29/monitor-everything-with-monitis-and-do-it-easily-with-powershell-part3/</link>
		<comments>http://blog.monitis.com/index.php/2011/09/29/monitor-everything-with-monitis-and-do-it-easily-with-powershell-part3/#comments</comments>
		<pubDate>Thu, 29 Sep 2011 23:25:28 +0000</pubDate>
		<dc:creator>Hovhannes Avoyan</dc:creator>
				<category><![CDATA[Monitoring Scripts]]></category>
		<category><![CDATA[Website Monitoring]]></category>
		<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://blog.monitis.com/?p=3919</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://blog.monitis.com/index.php/2011/09/29/monitor-everything-with-monitis-and-do-it-easily-with-powershell-part3/' addthis:title='Monitor Everything with Monitis &#8211; And do it easily with PowerShell &#8211; Part 3 '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>Mining External Monitor Results with Monitis and PowerShell In the last article, we walked thru some of the other commands related to external monitors.  Today, we’ll focus on the one you’ll probably use the most:  Get-MonitisMonitorResult. Before we get started, please remember to download the Monitis module from Monitis&#8217; github open source repository.  Download it to [...]]]></description>
			<content:encoded><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://blog.monitis.com/index.php/2011/09/29/monitor-everything-with-monitis-and-do-it-easily-with-powershell-part3/' addthis:title='Monitor Everything with Monitis &#8211; And do it easily with PowerShell &#8211; Part 3 '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div><p><img class="alignnone size-full wp-image-3383" style="float: right;" title="powershell" src="http://blog.monitis.com/wp-content/uploads/2011/08/pshell.jpeg" alt="" width="204" height="204" /></p>
<h3>Mining External Monitor Results with Monitis and PowerShell</h3>
<p>In the<a href="http://blog.monitis.com/index.php/2011/09/22/monitor-everything-with-monitis-and-do-it-easily-with-powershell-part-2/"> last article</a>, we walked thru some of the other commands related to external monitors.  Today, we’ll focus on the one you’ll probably use the most:  Get-MonitisMonitorResult.</p>
<p>Before we get started, please remember to download the Monitis module from <a href="https://github.com/monitisexchange/Windows-Monitoring-Scripts/tree/master/powershell/Module">Monitis&#8217; github</a> open source repository.  Download it to Documents\WindowsPowerShell\modules, and import it in PowerShell by running Import-Module Monitis.</p>
<p>Get-MonitisMonitorResult gives you results from any type of Monitor.  You use it by piping in the monitors you want.</p>
<p><span id="more-3919"></span><br />
For instance, this will show todays results from the current monitor:</p>
<pre>Get-MonitisExternalMonitor | Select-Object -First 1 | Get-MonitisMonitorResult</pre>
<p>for example:<br />
<a href="http://blog.monitis.com/wp-content/uploads/2011/09/Get-MonitisExternalMonitor1.png"><img class="alignnone size-full wp-image-3920" title="Get-MonitisExternalMonitor1" src="http://blog.monitis.com/wp-content/uploads/2011/09/Get-MonitisExternalMonitor1.png" alt="" width="600" height="397" /></a></p>
<p>Like everything else in the Monitis module, you have a few  different options when you get results.  Instead of just getting results for today, you can use the –Last parameter to get results for the last number 3 days:</p>
<pre>Get-MonitisExternalMonitor |</pre>
<pre>    Select-Object -First 1 |</pre>
<pre>    Get-MonitisMonitorResult -Last (New-TimeSpan -Days 3)</pre>
<p>You can also get results since a date</p>
<pre>Get-MonitisExternalMonitor |</pre>
<pre>    Select-Object -First 1 |</pre>
<pre>    Get-MonitisMonitorResult -Since 9/1/2011</pre>
<p>Or for a range of dates</p>
<pre>Get-MonitisExternalMonitor |</pre>
<pre>    Select-Object -First 1 |</pre>
<pre>    Get-MonitisMonitorResult -Start 9/1/2011 –End 9/10/2011</pre>
<p>By default you see a summary object from each location.  This tells you the location, and a number of different subproperties tell you what’s going on.</p>
<p><a href="http://blog.monitis.com/wp-content/uploads/2011/09/Get-MonitisExternalMonitor2.png"><img class="alignnone size-full wp-image-3921" title="Get-MonitisExternalMonitor2" src="http://blog.monitis.com/wp-content/uploads/2011/09/Get-MonitisExternalMonitor2.png" alt="" width="600" /></a></p>
<ul>
<li>Data contains each result</li>
<li>Trend contains trends from the day.</li>
<li>LocationName is where it was run.</li>
</ul>
<p>You might notice that Select-Object in the middle of the pipeline.  We’re using it to pick the first of your monitors, but you can use it for a lot more.  For instance, if you just want to see a summary of how things are on each day, you could use:</p>
<pre>Get-MonitisExternalMonitor |</pre>
<pre>    Select-Object -First 1 |</pre>
<pre>    Get-MonitisMonitorResult -Since 9/1/2011 |</pre>
<pre>    Select-Object -ExpandProperty Trend</pre>
<pre></pre>
<p>like: <a href="http://blog.monitis.com/wp-content/uploads/2011/09/Get-MonitisExternalMonitor3.png"><img class="alignnone size-full wp-image-3922" title="Get-MonitisExternalMonitor3" src="http://blog.monitis.com/wp-content/uploads/2011/09/Get-MonitisExternalMonitor3.png" alt="" width="600" height="124" /></a>Trend gives you an OK or not ok count.  If you can’t ping the box, or if a complex external monitor fails, you can use another built in PowerShell command to figure it out:  Where-Object.  Where-Object takes a filter, and, if the item in that filter returns an object which isn’t zero or a blank string, then Where-Object will output the original item.  This lets you filter anything in any way you’d like.  To find only the things in the last month that had trouble, use:</p>
<pre>Get-MonitisExternalMonitor |</pre>
<pre>    Select-Object -First 1 |</pre>
<pre>    Get-MonitisMonitorResult -Since 9/1/2011 |</pre>
<pre>    Where-Object {</pre>
<pre>        $_.Trend.NotOkCount</pre>
<pre>    }</pre>
<p>If that filter works, and your servers are working well, you should see nothing.    To prove it to yourself, go ahead and change NotOkCount to OkCount, and see only the locations with working results.  This is a good thing to be aware of.  In PowerShell, unless you’re getting data, no results are good results.  Meaning that if you see no output and no errors and it’s not a command that should return information to you, then your command just worked.</p>
<p>Now you know how make mincemeat of your results.  Next time, we’ll show you how generate a lot more results to manage, by monitoring web applications with Monitis.</p>
<p>See also</p>
<p style="padding-left: 30px;"><a title="Permanent Link to Monitor Everything with Monitis – And do it easily with PowerShell – Part 1" href="http://blog.monitis.com/index.php/2011/09/19/monitor-everything-with-monitis-and-do-it-easily-with-powershell-part-1/" rel="bookmark">Monitor Everything with Monitis – And do it easily with PowerShell – Part 1</a></p>
<p style="padding-left: 30px;"><a title="Permanent Link to Monitor Everything with Monitis – And do it easily with PowerShell – Part 2" href="http://blog.monitis.com/index.php/2011/09/22/monitor-everything-with-monitis-and-do-it-easily-with-powershell-part-2/" rel="bookmark">Monitor Everything with Monitis – And do it easily with PowerShell – Part 2</a></p>
Share Now:<a rel="nofollow"   href="http://delicious.com/post?url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2011%2F09%2F29%2Fmonitor-everything-with-monitis-and-do-it-easily-with-powershell-part3%2F&amp;title=Monitor%20Everything%20with%20Monitis%20-%20And%20do%20it%20easily%20with%20PowerShell%20-%20Part%203&amp;notes=%0D%0AMining%20External%20Monitor%20Results%20with%20Monitis%20and%20PowerShell%0D%0AIn%20the%20last%20article%2C%20we%20walked%20thru%20some%20of%20the%20other%20commands%20related%20to%20external%20monitors.%C2%A0%20Today%2C%20we%E2%80%99ll%20focus%20on%20the%20one%20you%E2%80%99ll%20probably%20use%20the%20most%3A%C2%A0%20Get-MonitisMonitorResult.%0D" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/delicious.png" class="sociable-img sociable-hovers" title="del.icio.us" alt="del.icio.us" /></a><a rel="nofollow"   href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2011%2F09%2F29%2Fmonitor-everything-with-monitis-and-do-it-easily-with-powershell-part3%2F&amp;title=Monitor%20Everything%20with%20Monitis%20-%20And%20do%20it%20easily%20with%20PowerShell%20-%20Part%203&amp;bodytext=%0D%0AMining%20External%20Monitor%20Results%20with%20Monitis%20and%20PowerShell%0D%0AIn%20the%20last%20article%2C%20we%20walked%20thru%20some%20of%20the%20other%20commands%20related%20to%20external%20monitors.%C2%A0%20Today%2C%20we%E2%80%99ll%20focus%20on%20the%20one%20you%E2%80%99ll%20probably%20use%20the%20most%3A%C2%A0%20Get-MonitisMonitorResult.%0D" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/digg.png" class="sociable-img sociable-hovers" title="Digg" alt="Digg" /></a><a rel="nofollow"   href="http://www.facebook.com/share.php?u=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2011%2F09%2F29%2Fmonitor-everything-with-monitis-and-do-it-easily-with-powershell-part3%2F&amp;t=Monitor%20Everything%20with%20Monitis%20-%20And%20do%20it%20easily%20with%20PowerShell%20-%20Part%203" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/facebook.png" class="sociable-img sociable-hovers" title="Facebook" alt="Facebook" /></a><a rel="nofollow"   href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2011%2F09%2F29%2Fmonitor-everything-with-monitis-and-do-it-easily-with-powershell-part3%2F&amp;title=Monitor%20Everything%20with%20Monitis%20-%20And%20do%20it%20easily%20with%20PowerShell%20-%20Part%203&amp;source=Uptime+%26amp%3B+Performance+Tips+Tips+for+SysAdmin%2C+Webmaster%2C+Network+Admin&amp;summary=%0D%0AMining%20External%20Monitor%20Results%20with%20Monitis%20and%20PowerShell%0D%0AIn%20the%20last%20article%2C%20we%20walked%20thru%20some%20of%20the%20other%20commands%20related%20to%20external%20monitors.%C2%A0%20Today%2C%20we%E2%80%99ll%20focus%20on%20the%20one%20you%E2%80%99ll%20probably%20use%20the%20most%3A%C2%A0%20Get-MonitisMonitorResult.%0D" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/linkedin.png" class="sociable-img sociable-hovers" title="LinkedIn" alt="LinkedIn" /></a><a rel="nofollow"   href="http://www.blinklist.com/index.php?Action=Blink/addblink.php&amp;Url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2011%2F09%2F29%2Fmonitor-everything-with-monitis-and-do-it-easily-with-powershell-part3%2F&amp;Title=Monitor%20Everything%20with%20Monitis%20-%20And%20do%20it%20easily%20with%20PowerShell%20-%20Part%203" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/blinklist.png" class="sociable-img sociable-hovers" title="BlinkList" alt="BlinkList" /></a><a rel="nofollow"   href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2011%2F09%2F29%2Fmonitor-everything-with-monitis-and-do-it-easily-with-powershell-part3%2F&amp;title=Monitor%20Everything%20with%20Monitis%20-%20And%20do%20it%20easily%20with%20PowerShell%20-%20Part%203" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/dzone.png" class="sociable-img sociable-hovers" title="DZone" alt="DZone" /></a><a rel="nofollow"   href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2011%2F09%2F29%2Fmonitor-everything-with-monitis-and-do-it-easily-with-powershell-part3%2F&amp;title=Monitor%20Everything%20with%20Monitis%20-%20And%20do%20it%20easily%20with%20PowerShell%20-%20Part%203&amp;annotation=%0D%0AMining%20External%20Monitor%20Results%20with%20Monitis%20and%20PowerShell%0D%0AIn%20the%20last%20article%2C%20we%20walked%20thru%20some%20of%20the%20other%20commands%20related%20to%20external%20monitors.%C2%A0%20Today%2C%20we%E2%80%99ll%20focus%20on%20the%20one%20you%E2%80%99ll%20probably%20use%20the%20most%3A%C2%A0%20Get-MonitisMonitorResult.%0D" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/googlebookmark.png" class="sociable-img sociable-hovers" title="Google Bookmarks" alt="Google Bookmarks" /></a><a rel="nofollow"   href="http://reddit.com/submit?url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2011%2F09%2F29%2Fmonitor-everything-with-monitis-and-do-it-easily-with-powershell-part3%2F&amp;title=Monitor%20Everything%20with%20Monitis%20-%20And%20do%20it%20easily%20with%20PowerShell%20-%20Part%203" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/reddit.png" class="sociable-img sociable-hovers" title="Reddit" alt="Reddit" /></a><a rel="nofollow"   href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2011%2F09%2F29%2Fmonitor-everything-with-monitis-and-do-it-easily-with-powershell-part3%2F&amp;title=Monitor%20Everything%20with%20Monitis%20-%20And%20do%20it%20easily%20with%20PowerShell%20-%20Part%203" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/stumbleupon.png" class="sociable-img sociable-hovers" title="StumbleUpon" alt="StumbleUpon" /></a><a rel="nofollow"   href="http://twitter.com/home?status=Monitor%20Everything%20with%20Monitis%20-%20And%20do%20it%20easily%20with%20PowerShell%20-%20Part%203%20-%20http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2011%2F09%2F29%2Fmonitor-everything-with-monitis-and-do-it-easily-with-powershell-part3%2F" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/twitter.png" class="sociable-img sociable-hovers" title="Twitter" alt="Twitter" /></a><a rel="nofollow"   href="http://blog.monitis.com/index.php/feed/" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/rss.png" class="sociable-img sociable-hovers" title="RSS" alt="RSS" /></a><br/><br/>]]></content:encoded>
			<wfw:commentRss>http://blog.monitis.com/index.php/2011/09/29/monitor-everything-with-monitis-and-do-it-easily-with-powershell-part3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTTP extraction with Monitis</title>
		<link>http://blog.monitis.com/index.php/2011/09/27/http-extraction-with-monitis/</link>
		<comments>http://blog.monitis.com/index.php/2011/09/27/http-extraction-with-monitis/#comments</comments>
		<pubDate>Tue, 27 Sep 2011 12:26:23 +0000</pubDate>
		<dc:creator>Dan Fruehauf</dc:creator>
				<category><![CDATA[101 Reasons To Choose Monitis]]></category>
		<category><![CDATA[Applications Monitoring]]></category>
		<category><![CDATA[Monitis API]]></category>
		<category><![CDATA[Monitoring Scripts]]></category>
		<category><![CDATA[Sysadmin Tools]]></category>
		<category><![CDATA[Web Server Monitoring]]></category>
		<category><![CDATA[Website Monitoring]]></category>
		<category><![CDATA[extraction]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[HTTP extraction]]></category>
		<category><![CDATA[M3]]></category>
		<category><![CDATA[REST]]></category>
		<category><![CDATA[SOAP]]></category>
		<category><![CDATA[web page monitoring]]></category>
		<category><![CDATA[website monitoring]]></category>

		<guid isPermaLink="false">http://blog.monitis.com/?p=3534</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://blog.monitis.com/index.php/2011/09/27/http-extraction-with-monitis/' addthis:title='HTTP extraction with Monitis '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>HTTP what? Yes, HTTP extraction. Imagine you have a web page you would like to probe for parameters. Such as the number of your twitter subscribers, or the temperature somewhere – and profile it in Monitis. Or another scenario could be to probe the responsiveness of your website – how fast is it? Was it [...]]]></description>
			<content:encoded><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://blog.monitis.com/index.php/2011/09/27/http-extraction-with-monitis/' addthis:title='HTTP extraction with Monitis '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div><h3>HTTP what?</h3>
<p><a href="http://blog.monitis.com/wp-content/uploads/2011/08/HumidityInWanaka.jpg"><img style="margin: 10px; float: right;" src="http://blog.monitis.com/wp-content/uploads/2011/08/HumidityInWanaka.jpg" alt="" width="250" /></a><br />
Yes, HTTP extraction. Imagine you have a web page you would like to probe for parameters. Such as the number of your twitter subscribers, or the temperature somewhere – and profile it in <a href="http://www.monitis.com/">Monitis</a>.<br />
Or another scenario could be to probe the responsiveness of your website – how fast is it?<br />
Was it compromised and defaced?<br />
I think you get the point – it is needed and important.<span id="more-3534"></span></p>
<h3>Infrastructure</h3>
<p>For a while I&#8217;m promoting <a href="../index.php/2011/07/21/m3-monitis-monitor-manager/">M3 &#8211; Monitis Monitor Manager</a> monitoring framework as the infrastructure for adding monitors and counters to <a href="http://www.monitis.com/">Monitis</a>.</p>
<p>M3 monitoring framework is a Perl based infrastructure for parameter extraction with template support.<br />
In order to implement HTTP parameter extraction, just slight modifications were required to get M3 do also this job.</p>
<h3>Different protocols</h3>
<p>M3 currently supports three ways of parameter extraction:</p>
<ol>
<li>Regular Expressions</li>
<li>JSON</li>
<li>XML (providing an xpath)</li>
</ol>
<p>Together with that, M3 monitoring framework can also provide you with various statistics regarding the responsiveness of the polled web page. Statistics such as delay, page size and more.<br />
Authentication of web pages is also supported – in case you need to provide a user and password to access the page.</p>
<h3>M3 Usage</h3>
<p>The quick checkout snippet is here to help you, as usual:</p>
<pre style="word-wrap: break-word; white-space: pre-wrap; padding: 15px;"><code> # mkdir -p /usr/share/monitisexchange &amp;&amp; cd /usr/share/monitisexchange # git clone git://github.com/monitisexchange/Monitis-Linux-Scripts.git # cd Monitis-Linux-Scripts/M3 </code></pre>
<p>For the self sufficient – the following files are sample files, intended to show you how M3 works with HTTP extraction:</p>
<ul>
<li><a href="https://github.com/monitisexchange/Monitis-Linux-Scripts/blob/master/M3/config_sample_json_extraction.xml">config_sample_json_extraction.xml</a></li>
<li><a href="https://github.com/monitisexchange/Monitis-Linux-Scripts/blob/master/M3/config_sample_regex_extraction.xml">config_sample_regex_extraction.xml</a></li>
<li><a href="https://github.com/monitisexchange/Monitis-Linux-Scripts/blob/master/M3/config_sample_xpath_extraction.xml">config_sample_xpath_extraction.xml</a></li>
</ul>
<p>For those of you who thrive for a live example, we&#8217;ll analyze the json extraction example:</p>
<pre style="word-wrap: break-word; white-space: pre-wrap; padding: 15px;"><code> &lt;?xml version="1.0"?&gt; &lt;config&gt; &lt;apicredentials apikey="XXX" secretkey="XXX"/&gt; &lt;agent name="Weather monitor" interval="5"&gt; &lt;monitor name="Weather in Sunnyvale"&gt; &lt;url&gt;http://weather.yahooapis.com/forecastjson?w=2502265&lt;/url&gt; &lt;http_statistics&gt;1&lt;/http_statistics&gt; &lt;metric name="Temperature"&gt; &lt;type&gt;integer&lt;/type&gt; &lt;uom&gt;F&lt;/uom&gt; &lt;json&gt;{'forecast'}[0]-&gt;{'low_temperature'}&lt;/json&gt; &lt;/metric&gt; &lt;/monitor&gt; &lt;/agent&gt; &lt;/config&gt; </code></pre>
<p>You&#8217;ll notice that we instruct M3 to fetch the URL  <a href="http://weather.yahooapis.com/forecastjson?w=2502265">http://weather.yahooapis.com/forecastjson?w=2502265</a><br />
Fetching it ourselves will show:</p>
<pre style="word-wrap: break-word; white-space: pre-wrap; padding: 15px;"><code> # curl -s <a href="http://weather.yahooapis.com/forecastjson?w=2502265">http://weather.yahooapis.com/forecastjson?w=2502265</a> { ... "forecast": [ { "day": "Today", "condition": "Partly Cloudy", "high_temperature": "75", "low_temperature": "57" }, { "day": "Tomorrow", "condition": "Partly Cloudy", "high_temperature": "79", "low_temperature": "59" } ] } </code></pre>
<p>Yes – I cheated a bit, I&#8217;ve used a <a href="http://archive.dojotoolkit.org/nightly/dojotoolkit/dojox/gfx/demos/beautify.html">JSON beautifier</a> to beautify the output – because otherwise it&#8217;s a one ugly non-readable one-liner. I&#8217;ve also omitted some of the uninteresting output from the JSON call.<br />
If you&#8217;ll follow the JSON path in the sample file – <strong>{&#8216;forecast&#8217;}[0]-&gt;{&#8216;low_temperature&#8217;}</strong> – you&#8217;ll see that it&#8217;ll bring us straight to the low_temperature of today&#8217;s in the JSON output.<br />
Quite easy, isn&#8217;t it?</p>
<h3>XML and regular expressions</h3>
<p>Regular expressions were <a href="../index.php/2011/07/21/m3-monitis-monitor-manager/">core functionality in M3</a> and there are also <a href="https://github.com/monitisexchange/Monitis-Linux-Scripts/blob/master/M3/config_sample.xml">other examples</a> showing the usage of them with M3.<br />
XML xpath extraction is as simple as the JSON extraction. I&#8217;ll tell you even another secret – the implementation of xpath and JSON matching is the same!</p>
<h3>HTTP statistics</h3>
<p>In addition to that &#8211; M3 can also load some HTTP statistics like latency, page size and HTTP code. In order to enable it, simply have a look at <a title="config_sample_json_extraction.xml" href="https://github.com/monitisexchange/Monitis-Linux-Scripts/blob/master/M3/config_sample_json_extraction.xml">config_sample_json_extraction.xml</a>. You&#8217;ll see the &lt;http_statistics&gt; attributes over there &#8211; and this is what will add the statistics.</p>
<h3>So&#8230; What now?</h3>
<p>The snapshot provided in the top is <a href="http://blog.monitis.com/wp-content/uploads/2011/08/HumidityInWanaka.jpg">graphing the temperature and humidity in Wanaka, New Zealand</a>. Pretty neat, isn&#8217;t it?</p>
<p><a href="http://blog.monitis.com/wp-content/uploads/2011/08/HumidityInWanaka.jpg"><img src="http://blog.monitis.com/wp-content/uploads/2011/08/HumidityInWanaka.jpg" alt="" width="500" /></a><br />
What now? &#8211; Now you should look for parameters you&#8217;d like to extract from web pages, use M3 to load them to <a href="http://www.monitis.com/">Monitis</a> – and set the proper alerts for them.</p>
<p>Liked it? Sign up for <a href="http://www.monitis.com/">Monitis</a> and try it now! Don’t forget to check also <a href="https://github.com/monitisexchange">monitisexchange</a> – our git-hub open source repository for some more surprises.</p>
Share Now:<a rel="nofollow"   href="http://delicious.com/post?url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2011%2F09%2F27%2Fhttp-extraction-with-monitis%2F&amp;title=HTTP%20extraction%20with%20Monitis&amp;notes=HTTP%20what%3F%0D%0A%0D%0AYes%2C%20HTTP%20extraction.%20Imagine%20you%20have%20a%20web%20page%20you%20would%20like%20to%20probe%20for%20parameters.%20Such%20as%20the%20number%20of%20your%20twitter%20subscribers%2C%20or%20the%20temperature%20somewhere%20%E2%80%93%20and%20profile%20it%20in%20Monitis.%0D%0AOr%20another%20scenario%20could%20be%20to%20probe" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/delicious.png" class="sociable-img sociable-hovers" title="del.icio.us" alt="del.icio.us" /></a><a rel="nofollow"   href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2011%2F09%2F27%2Fhttp-extraction-with-monitis%2F&amp;title=HTTP%20extraction%20with%20Monitis&amp;bodytext=HTTP%20what%3F%0D%0A%0D%0AYes%2C%20HTTP%20extraction.%20Imagine%20you%20have%20a%20web%20page%20you%20would%20like%20to%20probe%20for%20parameters.%20Such%20as%20the%20number%20of%20your%20twitter%20subscribers%2C%20or%20the%20temperature%20somewhere%20%E2%80%93%20and%20profile%20it%20in%20Monitis.%0D%0AOr%20another%20scenario%20could%20be%20to%20probe" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/digg.png" class="sociable-img sociable-hovers" title="Digg" alt="Digg" /></a><a rel="nofollow"   href="http://www.facebook.com/share.php?u=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2011%2F09%2F27%2Fhttp-extraction-with-monitis%2F&amp;t=HTTP%20extraction%20with%20Monitis" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/facebook.png" class="sociable-img sociable-hovers" title="Facebook" alt="Facebook" /></a><a rel="nofollow"   href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2011%2F09%2F27%2Fhttp-extraction-with-monitis%2F&amp;title=HTTP%20extraction%20with%20Monitis&amp;source=Uptime+%26amp%3B+Performance+Tips+Tips+for+SysAdmin%2C+Webmaster%2C+Network+Admin&amp;summary=HTTP%20what%3F%0D%0A%0D%0AYes%2C%20HTTP%20extraction.%20Imagine%20you%20have%20a%20web%20page%20you%20would%20like%20to%20probe%20for%20parameters.%20Such%20as%20the%20number%20of%20your%20twitter%20subscribers%2C%20or%20the%20temperature%20somewhere%20%E2%80%93%20and%20profile%20it%20in%20Monitis.%0D%0AOr%20another%20scenario%20could%20be%20to%20probe" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/linkedin.png" class="sociable-img sociable-hovers" title="LinkedIn" alt="LinkedIn" /></a><a rel="nofollow"   href="http://www.blinklist.com/index.php?Action=Blink/addblink.php&amp;Url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2011%2F09%2F27%2Fhttp-extraction-with-monitis%2F&amp;Title=HTTP%20extraction%20with%20Monitis" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/blinklist.png" class="sociable-img sociable-hovers" title="BlinkList" alt="BlinkList" /></a><a rel="nofollow"   href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2011%2F09%2F27%2Fhttp-extraction-with-monitis%2F&amp;title=HTTP%20extraction%20with%20Monitis" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/dzone.png" class="sociable-img sociable-hovers" title="DZone" alt="DZone" /></a><a rel="nofollow"   href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2011%2F09%2F27%2Fhttp-extraction-with-monitis%2F&amp;title=HTTP%20extraction%20with%20Monitis&amp;annotation=HTTP%20what%3F%0D%0A%0D%0AYes%2C%20HTTP%20extraction.%20Imagine%20you%20have%20a%20web%20page%20you%20would%20like%20to%20probe%20for%20parameters.%20Such%20as%20the%20number%20of%20your%20twitter%20subscribers%2C%20or%20the%20temperature%20somewhere%20%E2%80%93%20and%20profile%20it%20in%20Monitis.%0D%0AOr%20another%20scenario%20could%20be%20to%20probe" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/googlebookmark.png" class="sociable-img sociable-hovers" title="Google Bookmarks" alt="Google Bookmarks" /></a><a rel="nofollow"   href="http://reddit.com/submit?url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2011%2F09%2F27%2Fhttp-extraction-with-monitis%2F&amp;title=HTTP%20extraction%20with%20Monitis" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/reddit.png" class="sociable-img sociable-hovers" title="Reddit" alt="Reddit" /></a><a rel="nofollow"   href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2011%2F09%2F27%2Fhttp-extraction-with-monitis%2F&amp;title=HTTP%20extraction%20with%20Monitis" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/stumbleupon.png" class="sociable-img sociable-hovers" title="StumbleUpon" alt="StumbleUpon" /></a><a rel="nofollow"   href="http://twitter.com/home?status=HTTP%20extraction%20with%20Monitis%20-%20http%3A%2F%2Fblog.monitis.com%2Findex.php%2F2011%2F09%2F27%2Fhttp-extraction-with-monitis%2F" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/twitter.png" class="sociable-img sociable-hovers" title="Twitter" alt="Twitter" /></a><a rel="nofollow"   href="http://blog.monitis.com/index.php/feed/" ><img src="http://blog.monitis.com/wp-content/plugins/sociable-30/pro/images/handycons/32/rss.png" class="sociable-img sociable-hovers" title="RSS" alt="RSS" /></a><br/><br/>]]></content:encoded>
			<wfw:commentRss>http://blog.monitis.com/index.php/2011/09/27/http-extraction-with-monitis/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

