<?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>DBA survival BLOG &#187; Oracle Application Server</title>
	<atom:link href="http://www.ludovicocaldara.net/dba/category/oracleias/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ludovicocaldara.net/dba</link>
	<description>Keep DBA job simple. Thanks.</description>
	<lastBuildDate>Thu, 27 Aug 2009 13:58:01 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How to collect Oracle Application Server performance data with DMS and RRDtool</title>
		<link>http://www.ludovicocaldara.net/dba/how-to-collect-oracle-application-server-performance-data-with-dms-and-rrdtool/</link>
		<comments>http://www.ludovicocaldara.net/dba/how-to-collect-oracle-application-server-performance-data-with-dms-and-rrdtool/#comments</comments>
		<pubDate>Mon, 02 Mar 2009 17:08:31 +0000</pubDate>
		<dc:creator>Ludovico</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Oracle Application Server]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Capacity Planning]]></category>
		<category><![CDATA[rrdtool]]></category>

		<guid isPermaLink="false">http://www.ludovicocaldara.net/dba/?p=56</guid>
		<description><![CDATA[RRDize everything, chapter 1
If you are managing some Application Server deployments you should have wondered how to check and collect performance data.
As stated in documentation, you can gather performance metrics with the dmstool utility.
AFAIK, this can be done from 9.0.2 release upwards, but i&#8217;m concerned DMS will not work on Weblogic.
Mainly, you should have an [...]]]></description>
			<content:encoded><![CDATA[<p><strong>RRDize everything, chapter 1</strong></p>
<p>If you are managing some Application Server deployments you should have wondered how to check and collect performance data.<br />
As stated in documentation, you can gather performance metrics with the dmstool utility.<br />
AFAIK, this can be done from 9.0.2 release upwards, but i&#8217;m concerned DMS will not work on Weblogic.</p>
<p>Mainly, you should have an external server that acts as collector (it could be a server in the Oracle AS farm as well): copy the dms.jar library from an Oracle AS installation to your collector and use it as you would use dmstool:</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">java -jar dms.jar [dmstool options]</pre></div></div>

<p>There are three basilar methods to get data:</p>
<p>Get all metrics at once:</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">java -jar dms.jar -dump -a &quot;youraddress://...&quot; [format=xml]</pre></div></div>

<p>Get only the interesting metrics:</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">java -jar dms.jar -a &quot;youraddress://...&quot; metric metric ...</pre></div></div>

<p>Get metrics included into specific DMS tables:</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">java -jar dms.jar -a &quot;youraddress://...&quot; -table table table ...</pre></div></div>

<p>What youraddress:// is, it depends on the component you are trying to connect:</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">opmn://asserver:6003
http://asserver:7200/dms0/Spy
ajp13://asserver:3301/dmsoc4j/Spy</pre></div></div>

<p>If you are trying to connect to the OHS (Apache), be careful to allow remote access from the collector by editing the dms.conf file.</p>
<p>Now that you can query dms data, you should store it somewhere.<br />
Personally, I did a first attempt with dmstool -dump format=xml. I wrote a parser in PHP with SimpleXML extension and I did a lot of inserts into a MySQL database. After a few months the whole data collected from tens of servers was too much to be mantained&#8230;<br />
To avoid the maintenance of a DWH-grade database I investigated and found RRDTool. Now I&#8217;m asking how could I live without it!</p>
<p>I then wrote a parser in awk that parse the output of the dms.jar call and invoke an rrdtool update command.<br />
I always use dms.jar -table command. The output has always the same format:</p>
<pre>###SOF

Mon Mar 02 17:01:19 CET 2009

---------------
TABLE1_Name
---------------

record1_metric1.name:     value       units
record1_metric2.name:     value       units
....

record2_metric1.name:     value       units
record2_metric2.name:     value       units
....

---
TABLE2_Name
---

record1_metric1.name:     value       units
record1_metric2.name:     value       units
....

record2_metric1.name:     value       units
record2_metric2.name:     value       units
....

##EOF</pre>
<p>So I written an awk file that works for me.<br />
use it this way:</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;"> java -jar dms.jar ... | awk -f parse_output.awk</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">####################</span>
<span style="color: #339933;"># parse_output.awk #</span>
<span style="color: #339933;">####################</span>
&nbsp;
<span style="color: #339933;">#function pl() replaces all non alphanumeric occurrences with an underscore</span>
<span style="color: #000000; font-weight: bold;">function</span> pl<span style="color: #009900;">&#40;</span>input<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">return</span> gensub<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;[^[:alnum:]_-]&quot;</span><span style="color: #339933;">,</span><span style="color: #ff0000;">&quot;_&quot;</span><span style="color: #339933;">,</span><span style="color: #ff0000;">&quot;G&quot;</span><span style="color: #339933;">,</span>input<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #339933;"># function get_rrd_path() returns a path where the rrd files should be placed</span>
<span style="color: #339933;"># I should rewrite a new path for each dms table... I'll skip many of them</span>
<span style="color: #000000; font-weight: bold;">function</span> get_rrd_path<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>table <span style="color: #339933;">==</span> <span style="color: #ff0000;">&quot;mod_oc4j_destination_metrics&quot;</span><span style="color: #009900;">&#41;</span>
                <span style="color: #b1b100;">return</span> sprintf<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;%s/%s/%s/%s.rrd&quot;</span><span style="color: #339933;">,</span> record<span style="color: #009900;">&#91;</span><span style="color: #ff0000;">&quot;Host&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
                    pl<span style="color: #009900;">&#40;</span>table<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> pl<span style="color: #009900;">&#40;</span>record<span style="color: #009900;">&#91;</span><span style="color: #ff0000;">&quot;Name.value&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> pl<span style="color: #009900;">&#40;</span>var<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>table <span style="color: #339933;">==</span> <span style="color: #ff0000;">&quot;mod_oc4j_mount_pt_metrics&quot;</span><span style="color: #009900;">&#41;</span>
                <span style="color: #b1b100;">return</span> sprintf<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;%s/%s/%s/%s/%s.rrd&quot;</span><span style="color: #339933;">,</span> record<span style="color: #009900;">&#91;</span><span style="color: #ff0000;">&quot;Host&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
                    pl<span style="color: #009900;">&#40;</span>table<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> pl<span style="color: #009900;">&#40;</span>record<span style="color: #009900;">&#91;</span><span style="color: #ff0000;">&quot;Destination.value&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> pl<span style="color: #009900;">&#40;</span>record<span style="color: #009900;">&#91;</span><span style="color: #ff0000;">&quot;Name.value&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> pl<span style="color: #009900;">&#40;</span>var<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>table <span style="color: #339933;">==</span> <span style="color: #ff0000;">&quot;ohs_server&quot;</span><span style="color: #009900;">&#41;</span>
                <span style="color: #b1b100;">return</span> sprintf<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;%s/%s/%s.rrd&quot;</span><span style="color: #339933;">,</span> record<span style="color: #009900;">&#91;</span><span style="color: #ff0000;">&quot;Host&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> pl<span style="color: #009900;">&#40;</span>table<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> pl<span style="color: #009900;">&#40;</span>var<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>table <span style="color: #339933;">==</span> <span style="color: #ff0000;">&quot;JVM&quot;</span><span style="color: #009900;">&#41;</span>
                <span style="color: #b1b100;">return</span> sprintf<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;%s/%s/%s/%s.rrd&quot;</span><span style="color: #339933;">,</span> record<span style="color: #009900;">&#91;</span><span style="color: #ff0000;">&quot;Host&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
                    pl<span style="color: #009900;">&#40;</span>table<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> pl<span style="color: #009900;">&#40;</span>record<span style="color: #009900;">&#91;</span><span style="color: #ff0000;">&quot;Process&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> pl<span style="color: #009900;">&#40;</span>var<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>table <span style="color: #339933;">==</span> <span style="color: #ff0000;">&quot;opmn_process&quot;</span><span style="color: #009900;">&#41;</span>
                <span style="color: #b1b100;">return</span> sprintf<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;%s/%s/%s/%s/%s/%s/%s/%s.rrd&quot;</span><span style="color: #339933;">,</span> record<span style="color: #009900;">&#91;</span><span style="color: #ff0000;">&quot;Host&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> pl<span style="color: #009900;">&#40;</span>table<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
                  pl<span style="color: #009900;">&#40;</span>record<span style="color: #009900;">&#91;</span><span style="color: #ff0000;">&quot;iasInstance.value&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> pl<span style="color: #009900;">&#40;</span>record<span style="color: #009900;">&#91;</span><span style="color: #ff0000;">&quot;opmn_ias_component&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
                  pl<span style="color: #009900;">&#40;</span>record<span style="color: #009900;">&#91;</span><span style="color: #ff0000;">&quot;opmn_process_type&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>pl<span style="color: #009900;">&#40;</span>record<span style="color: #009900;">&#91;</span><span style="color: #ff0000;">&quot;opmn_process_set&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
                  pl<span style="color: #009900;">&#40;</span>record<span style="color: #009900;">&#91;</span><span style="color: #ff0000;">&quot;Name&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> pl<span style="color: #009900;">&#40;</span>var<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #b1b100;">return</span> sprintf<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;%s/%s/%s.rrd&quot;</span><span style="color: #339933;">,</span> record<span style="color: #009900;">&#91;</span><span style="color: #ff0000;">&quot;Host&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> pl<span style="color: #009900;">&#40;</span>table<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> pl<span style="color: #009900;">&#40;</span>var<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #339933;"># function process_record actually does the dirty work of invoking the update script</span>
<span style="color: #000000; font-weight: bold;">function</span> process_record<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #339933;">#every record has a timeStamp.ts metric that I should use to update my rrd</span>
        ts<span style="color: #339933;">=</span>substr<span style="color: #009900;">&#40;</span>record<span style="color: #009900;">&#91;</span><span style="color: #ff0000;">&quot;timeStamp.ts&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><span style="color: #0000dd;">0</span><span style="color: #339933;">,</span><span style="color: #0000dd;">10</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span> var in record <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> var <span style="color: #339933;">!=</span> <span style="color: #ff0000;">&quot;timeStamp.ts&quot;</span> <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;&amp;</span>amp<span style="color: #339933;">;</span> record<span style="color: #009900;">&#91;</span>var<span style="color: #009900;">&#93;</span> ~ <span style="color: #339933;">/^</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#91;</span><span style="color: #339933;">:</span>digit<span style="color: #339933;">:</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">+</span>$<span style="color: #339933;">/</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> var ~ <span style="color: #339933;">/</span>\.<span style="color: #009900;">&#40;</span>count<span style="color: #339933;">|</span>completed<span style="color: #339933;">|</span>time<span style="color: #009900;">&#41;</span>$<span style="color: #339933;">/</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                dstype<span style="color: #339933;">=</span><span style="color: #ff0000;">&quot;DERIVE&quot;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> var <span style="color: #339933;">==</span> <span style="color: #ff0000;">&quot;responseSize.value&quot;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                    dstype<span style="color: #339933;">=</span><span style="color: #ff0000;">&quot;DERIVE&quot;</span><span style="color: #339933;">;</span>
                <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
                    dstype<span style="color: #339933;">=</span><span style="color: #ff0000;">&quot;GAUGE&quot;</span><span style="color: #339933;">;</span>
                <span style="color: #009900;">&#125;</span>
            <span style="color: #009900;">&#125;</span>
            rrdFile<span style="color: #339933;">=</span>sprintf<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;/path_to_data/%s&quot;</span><span style="color: #339933;">,</span>get_rrd_path<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #339933;">#### update_metric_rrd is a shell script listed below!!!!!</span>
            cmd<span style="color: #339933;">=</span>sprintf<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;/path_to_scripts/update_metric_rrd %s %s %d %d&quot;</span><span style="color: #339933;">,</span>
                rrdFile<span style="color: #339933;">,</span>dstype<span style="color: #339933;">,</span>ts<span style="color: #339933;">,</span>record<span style="color: #009900;">&#91;</span>var<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            system<span style="color: #009900;">&#40;</span>cmd<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #339933;"># parse_record() populates an hash array</span>
<span style="color: #339933;"># with all metrics belonging to the table record</span>
<span style="color: #000000; font-weight: bold;">function</span> parse_record<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #339933;">#print &quot;RRRR -  START OF RECORD (table &quot; table &quot;)&quot;</span>
    delete record
    <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span> <span style="color: #339933;">/^</span>$<span style="color: #339933;">/</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #339933;"># I'm parsing the record as far I'm in this while statement</span>
        <span style="color: #339933;"># the array hash is the name of the dms metric basename.</span>
        <span style="color: #339933;"># $1 is the metric name but I have to trim the final &quot;:&quot;</span>
        key<span style="color: #339933;">=</span>substr<span style="color: #009900;">&#40;</span>$<span style="color: #0000dd;">1</span><span style="color: #339933;">,</span><span style="color: #0000dd;">0</span><span style="color: #339933;">,</span>length<span style="color: #009900;">&#40;</span>$<span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span>
        record<span style="color: #009900;">&#91;</span>key<span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span>$<span style="color: #0000dd;">2</span>
        getline
    <span style="color: #009900;">&#125;</span>
    <span style="color: #339933;"># this function is included in funcions.awk:</span>
    <span style="color: #339933;"># I invoke it to process the record I've just parsed</span>
    process_record<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
BEGIN <span style="color: #009900;">&#123;</span>
    <span style="color: #339933;"># as far as started is 0, I've never reached the first table</span>
    started<span style="color: #339933;">=</span><span style="color: #0000dd;">0</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #339933;">#MAIN</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #339933;"># I jump over the first lines until I reach the first table</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>started<span style="color: #339933;">==</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span> <span style="color: #339933;">/^---/</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
           getline
        <span style="color: #009900;">&#125;</span>
        started<span style="color: #339933;">=</span><span style="color: #0000dd;">1</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #339933;"># looking for the next occurrence of a table</span>
    <span style="color: #339933;"># all tables start with:</span>
    <span style="color: #339933;"># ----------</span>
    <span style="color: #339933;"># table_name</span>
    <span style="color: #339933;"># ----------</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">/^---/</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #339933;"># first table reached: the next row is my table name,</span>
        <span style="color: #339933;"># then I reach again a dashed line -----</span>
        getline table
        getline trash
        <span style="color: #339933;">#print &quot;&quot;</span>
        <span style="color: #339933;">#print &quot;##########################&quot;</span>
        print <span style="color: #ff0000;">&quot;  TABELLA &quot;</span> table
        <span style="color: #339933;">#print &quot;##########################&quot;</span>
        next
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span> <span style="color: #339933;">/^</span>$<span style="color: #339933;">/</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #339933;"># reached an empty line: could be the end of a record or the and of a table</span>
        <span style="color: #339933;"># since a new table is threated in previous &quot;if&quot; statement, I'm starting a new record.</span>
        parse_record<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span>
&nbsp;
END <span style="color: #009900;">&#123;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>And this is the code for update_metric_rrd:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #007800;">RRDFILE</span>=$<span style="color: #000000;">1</span>
<span style="color: #007800;">DSTYPE</span>=$<span style="color: #000000;">2</span>
<span style="color: #007800;">TS</span>=$<span style="color: #000000;">3</span>
<span style="color: #007800;">VALUE</span>=$<span style="color: #000000;">4</span>
&nbsp;
rrdtool update <span style="color: #007800;">$RRDFILE</span> <span style="color: #800000;">${TS}</span>:<span style="color: #800000;">${VALUE}</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$?</span> <span style="color: #660033;">-ne</span> <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #007800;">DIR</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">dirname</span> <span style="color: #007800;">$RRDFILE</span><span style="color: #000000; font-weight: bold;">`</span>
&nbsp;
        <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-d</span> <span style="color: #007800;">$DIR</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> <span style="color: #007800;">$DIR</span>
        <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-f</span> <span style="color: #007800;">$RRDFILE</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">||</span> rrdtool create <span style="color: #007800;">$RRDFILE</span> <span style="color: #660033;">-b</span> <span style="color: #ff0000;">&quot;now-1month&quot;</span> <span style="color: #660033;">-s</span> <span style="color: #000000;">1800</span> \
                DS:metric:<span style="color: #800000;">${DSTYPE}</span>:<span style="color: #000000;">7200</span>:<span style="color: #000000;">0</span>:U \
                RRA:AVERAGE:<span style="color: #000000;">0.5</span>:<span style="color: #000000;">1</span>:<span style="color: #000000;">672</span> \
                RRA:AVERAGE:<span style="color: #000000;">0.5</span>:<span style="color: #000000;">4</span>:<span style="color: #000000;">1080</span> \
                RRA:AVERAGE:<span style="color: #000000;">0.5</span>:<span style="color: #000000;">12</span>:<span style="color: #000000;">1460</span> \
                RRA:AVERAGE:<span style="color: #000000;">0.5</span>:<span style="color: #000000;">48</span>:<span style="color: #000000;">1095</span> \
                RRA:MAX:<span style="color: #000000;">0.5</span>:<span style="color: #000000;">4</span>:<span style="color: #000000;">1080</span> \
                RRA:MAX:<span style="color: #000000;">0.5</span>:<span style="color: #000000;">12</span>:<span style="color: #000000;">1460</span> \
                RRA:MAX:<span style="color: #000000;">0.5</span>:<span style="color: #000000;">48</span>:<span style="color: #000000;">1095</span> \
                RRA:LAST:<span style="color: #000000;">0.5</span>:<span style="color: #000000;">1</span>:<span style="color: #000000;">672</span>
        rrdtool update <span style="color: #007800;">$RRDFILE</span> <span style="color: #800000;">${TS}</span>:<span style="color: #800000;">${VALUE}</span>
<span style="color: #000000; font-weight: bold;">fi</span></pre></div></div>

<p>Once you have all your rrd files populated, it&#8217;s easy to script automatic reporting. You would probably want a graph with the request count served by your Apache cluster, along with its linear regression:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">rrdtool graph - <span style="color: #660033;">-s</span> <span style="color: #ff0000;">&quot;end-<span style="color: #007800;">${hours}</span>hours&quot;</span> <span style="color: #660033;">-e</span> <span style="color: #007800;">$end</span> \
                <span style="color: #660033;">-v</span> <span style="color: #ff0000;">&quot;Requests Completed/sec&quot;</span> \
        <span style="color: #660033;">-w</span> <span style="color: #000000;">640</span> <span style="color: #660033;">-h</span> <span style="color: #000000;">240</span> <span style="color: #660033;">--slope-mode</span> \
                <span style="color: #660033;">-t</span> <span style="color: #ff0000;">&quot;HTTP Requests for www.ludovicocaldara.net&quot;</span> \
                DEF:<span style="color: #000000;">1</span><span style="color: #007800;">request_completed</span>=<span style="color: #000000; font-weight: bold;">/</span>data<span style="color: #000000; font-weight: bold;">/</span>wwwserver1<span style="color: #000000; font-weight: bold;">/</span>ohs_server<span style="color: #000000; font-weight: bold;">/</span>request_completed.rrd:metric:AVERAGE \
                DEF:<span style="color: #000000;">2</span><span style="color: #007800;">request_completed</span>=<span style="color: #000000; font-weight: bold;">/</span>data<span style="color: #000000; font-weight: bold;">/</span>wwwserver2<span style="color: #000000; font-weight: bold;">/</span>ohs_server<span style="color: #000000; font-weight: bold;">/</span>request_completed.rrd:metric:AVERAGE \
                CDEF:<span style="color: #007800;">request_completed</span>=1request_completed,2request_completed,+ \
                VDEF:<span style="color: #007800;">slope</span>=request_completed,LSLSLOPE \
                VDEF:<span style="color: #007800;">lslint</span>=request_completed,LSLINT \
                CDEF:<span style="color: #007800;">reg</span>=request_completed,POP,slope,COUNT,<span style="color: #000000; font-weight: bold;">*</span>,lslint,+ \
                LINE1:reg<span style="color: #666666; font-style: italic;">#666666:&quot;Regression&quot; \</span>
                AREA:1request_completed<span style="color: #666666; font-style: italic;">#4040AA:&quot;wwwserver1&quot;  \</span>
                AREA:2request_completed<span style="color: #666666; font-style: italic;">#6666FF:&quot;wwwserver1&quot;:STACK  \</span>
        <span style="color: #000000; font-weight: bold;">&amp;</span>gt; mygraph.png</pre></div></div>

<p>This is the result:<br />
<img src="http://www.ludovicocaldara.net/images/dba/dms_ohs_requests.png" alt="OHS request completed" /><br />
<strong>OHHHHHHHHHHHH!!!! COOL!!!!</strong></p>
<p>That&#8217;s all for DMS capacity planning. Stay tuned, more about rrdtool is coming!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ludovicocaldara.net/dba/how-to-collect-oracle-application-server-performance-data-with-dms-and-rrdtool/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
