Data-Apache-mod_status

 view release on metacpan or  search on metacpan

examples/rrd/create  view on Meta::CPAN

        $RRD_FILE \
        --step 60 \
        DS:total_accesses:COUNTER:180:0:99999999 \
        DS:total_traffic:COUNTER:180:0:99999999 \
        DS:current_requests:GAUGE:180:0:99999999 \
        DS:idle_workers:GAUGE:180:0:99999999 \
        DS:waiting:GAUGE:180:0:99999999 \
        DS:starting:GAUGE:180:0:99999999 \
        DS:reading:GAUGE:180:0:99999999 \
        DS:sending:GAUGE:180:0:99999999 \
        DS:keepalive:GAUGE:180:0:99999999 \
        DS:dns_lookup:GAUGE:180:0:99999999 \
        DS:closing:GAUGE:180:0:99999999 \
        DS:logging:GAUGE:180:0:99999999 \
        DS:finishing:GAUGE:180:0:99999999 \
        DS:idle_cleanup:GAUGE:180:0:99999999 \
        DS:open_slot:GAUGE:180:0:99999999 \
        DS:max_clients:GAUGE:180:0:99999999 \
        \
        RRA:AVERAGE:0.5:1:1440 \
        RRA:MAX:0.5:1:1440 \

examples/rrd/graph  view on Meta::CPAN

    --start '-1d' \
    --end $NOW \
    --width $WIDTH \
    --height $HEIGHT \
    --lower-limit 0 \
    DEF:waiting=$RRD_FILE:waiting:AVERAGE \
    DEF:waiting_min=$RRD_FILE:waiting:MIN \
    DEF:starting=$RRD_FILE:starting:AVERAGE \
    DEF:reading=$RRD_FILE:reading:AVERAGE \
    DEF:sending=$RRD_FILE:sending:AVERAGE \
    DEF:keepalive=$RRD_FILE:keepalive:AVERAGE \
    DEF:dns_lookup=$RRD_FILE:dns_lookup:AVERAGE \
    DEF:closing=$RRD_FILE:closing:AVERAGE \
    DEF:logging=$RRD_FILE:logging:AVERAGE \
    DEF:finishing=$RRD_FILE:finishing:AVERAGE \
    DEF:idle_cleanup=$RRD_FILE:idle_cleanup:AVERAGE \
    DEF:requests=$RRD_FILE:current_requests:AVERAGE \
    DEF:open_slot=$RRD_FILE:open_slot:AVERAGE \
    DEF:max_clients=$RRD_FILE:max_clients:AVERAGE \
    \
    DEF:current_requests=$RRD_FILE:current_requests:AVERAGE \

examples/rrd/graph  view on Meta::CPAN

    \
    $MAX_CLIENTS \
    \
    'AREA:max_clients#FFFFAA:Max clients' \
    'AREA:waiting#FFd2aa:Waiting' \
    'AREA:waiting_min#fee3cc:Min Waiting' \
    'AREA:current_requests_max#D8DFFF:Max occupied' \
    'AREA:current_requests#AABBFF:Occupied' \
    'LINE2:reading#22A222:Reading' \
    'LINE2:sending#2222A2:Sending' \
    'LINE1:keepalive#50eae8:Keep-Alive' \
    'LINE:starting#02F222:Starting' \
    'LINE:dns_lookup#225222:DNS Lookup' \
    'LINE:closing#222252:Closing' \
    'LINE:logging#022222:Logging' \
    'LINE:finishing#220222:Gracefully Finishing' \
    'LINE:idle_cleanup#222202:Idle Cleanup' \

lib/Data/Apache/mod_status/2XML.pm  view on Meta::CPAN

                <line><xsl:value-of select="text()" /></line>
            </xsl:for-each>
        </info_lines>
        <workers>
            <!-- count number of status characters in workers pre tag -->
            <xsl:variable name="workers" select="/x:html/x:body/x:pre[1]/text()" />
            <waiting><xsl:value-of select="string-length(translate($workers, translate($workers, '_', ''), ''))" /></waiting>
            <starting><xsl:value-of select="string-length(translate($workers, translate($workers, 'S', ''), ''))" /></starting>
            <reading><xsl:value-of select="string-length(translate($workers, translate($workers, 'R', ''), ''))" /></reading>
            <sending><xsl:value-of select="string-length(translate($workers, translate($workers, 'W', ''), ''))" /></sending>
            <keepalive><xsl:value-of select="string-length(translate($workers, translate($workers, 'K', ''), ''))" /></keepalive>
            <dns_lookup><xsl:value-of select="string-length(translate($workers, translate($workers, 'D', ''), ''))" /></dns_lookup>
            <closing><xsl:value-of select="string-length(translate($workers, translate($workers, 'C', ''), ''))" /></closing>
            <logging><xsl:value-of select="string-length(translate($workers, translate($workers, 'L', ''), ''))" /></logging>
            <finishing><xsl:value-of select="string-length(translate($workers, translate($workers, 'G', ''), ''))" /></finishing>
            <idle_cleanup><xsl:value-of select="string-length(translate($workers, translate($workers, 'I', ''), ''))" /></idle_cleanup>
            <open_slot><xsl:value-of select="string-length(translate($workers, translate($workers, '.', ''), ''))" /></open_slot>
        </workers>
    </mod_status>
</xsl:template>

lib/Data/Apache/mod_status/Workers.pm  view on Meta::CPAN


subtype 'XML_LibXML_Element'
    => as 'Object'
    => where { $_[0]->isa('XML::LibXML::Element') };

has 'workers_tag'  => ( 'is' => 'rw', 'isa' => 'XML_LibXML_Element', 'required' => 1 );
has 'waiting'      => ( 'is' => 'rw', 'isa' => 'Int', 'lazy' => 1, 'default' => sub { $_[0]->_update('waiting') });
has 'starting'     => ( 'is' => 'rw', 'isa' => 'Int', 'lazy' => 1, 'default' => sub { $_[0]->_update('starting') });
has 'reading'      => ( 'is' => 'rw', 'isa' => 'Int', 'lazy' => 1, 'default' => sub { $_[0]->_update('reading') });
has 'sending'      => ( 'is' => 'rw', 'isa' => 'Int', 'lazy' => 1, 'default' => sub { $_[0]->_update('sending') });
has 'keepalive'    => ( 'is' => 'rw', 'isa' => 'Int', 'lazy' => 1, 'default' => sub { $_[0]->_update('keepalive') });
has 'dns_lookup'   => ( 'is' => 'rw', 'isa' => 'Int', 'lazy' => 1, 'default' => sub { $_[0]->_update('dns_lookup') });
has 'closing'      => ( 'is' => 'rw', 'isa' => 'Int', 'lazy' => 1, 'default' => sub { $_[0]->_update('closing') });
has 'logging'      => ( 'is' => 'rw', 'isa' => 'Int', 'lazy' => 1, 'default' => sub { $_[0]->_update('logging') });
has 'finishing'    => ( 'is' => 'rw', 'isa' => 'Int', 'lazy' => 1, 'default' => sub { $_[0]->_update('finishing') });
has 'idle_cleanup' => ( 'is' => 'rw', 'isa' => 'Int', 'lazy' => 1, 'default' => sub { $_[0]->_update('idle_cleanup') });
has 'open_slot'    => ( 'is' => 'rw', 'isa' => 'Int', 'lazy' => 1, 'default' => sub { $_[0]->_update('open_slot') });


=head1 METHODS

script/mod_status-info  view on Meta::CPAN

rrd output has this values:

    total_accesses
    total_traffic
    current_requests
    idle_workers
    waiting
    starting
    reading
    sending
    keepalive
    dns_lookup
    closing
    logging
    finishing
    idle_cleanup
    open_slot

=cut


script/mod_status-info  view on Meta::CPAN

            '-t '.join(':', qw{
                    total_accesses
                    total_traffic
                    current_requests
                    idle_workers
                    
                    waiting
                    starting
                    reading
                    sending
                    keepalive
                    dns_lookup
                    closing
                    logging
                    finishing
                    idle_cleanup
                    open_slot
                }, ($max_clients ? 'max_clients' : ())
            ),
            q{ },
            $current_time_seconds.':',

script/mod_status-info  view on Meta::CPAN

            (
                $info->total_accesses,
                $info->total_traffic,
                $info->current_requests,
                $info->idle_workers,
                
                $workers->waiting,
                $workers->starting,
                $workers->reading,
                $workers->sending,
                $workers->keepalive,
                $workers->dns_lookup,
                $workers->closing,
                $workers->logging,
                $workers->finishing,
                $workers->idle_cleanup,
                $workers->open_slot,
                ($max_clients ? $max_clients : ())
            )
        ;
    }

t/01_Data-Apache-mod_status.t  view on Meta::CPAN

    is($info->cpu_usage_str, 'u2.77 s2.6 cu0 cs0 - .028% CPU load', 'cpu usage string');
    is($info->current_requests, 3, 'current requests');
    is($info->idle_workers, 49, 'idle workers');
    
    my $workers = Data::Apache::mod_status->new->refresh->workers;
    ok($workers->workers_tag, 'workers pre tag');
    is($workers->waiting, 49, 'waiting workers');
    is($workers->starting, 2, 'starting workers');
    is($workers->reading, 3, 'reading workers');
    is($workers->sending, 1, 'sending workers');
    is($workers->keepalive, 4, 'keepalive workers');
    is($workers->dns_lookup, 5, 'dns lookup workers');
    is($workers->closing, 6, 'closing workers');
    is($workers->logging, 7, 'logging workers');
    is($workers->finishing, 8, 'finishing workers');
    is($workers->idle_cleanup, 9, 'idle cleanup workers');
    is($workers->open_slot, 930, 'open slot workers');
    
    
    return 0;
}

t/data/server-status.html  view on Meta::CPAN

................................................................
................................................................
................................................................
................................................................
</pre>
<p>Scoreboard Key:<br>
"<b><code>_</code></b>" Waiting for Connection, 
"<b><code>S</code></b>" Starting up, 
"<b><code>R</code></b>" Reading Request,<br>
"<b><code>W</code></b>" Sending Reply, 
"<b><code>K</code></b>" Keepalive (read), 
"<b><code>D</code></b>" DNS Lookup,<br>
"<b><code>C</code></b>" Closing connection, 
"<b><code>L</code></b>" Logging, 
"<b><code>G</code></b>" Gracefully finishing,<br> 
"<b><code>I</code></b>" Idle cleanup of worker, 
"<b><code>.</code></b>" Open slot with no current process</p>
<p>


<table border="0"><tbody><tr><th>Srv</th><th>PID</th><th>Acc</th><th>M</th><th>CPU

xslt/mod_status2xml.xslt  view on Meta::CPAN

                <line><xsl:value-of select="text()" /></line>
            </xsl:for-each>
        </info_lines>
        <workers>
            <!-- count number of status characters in workers pre tag -->
            <xsl:variable name="workers" select="/x:html/x:body/x:pre[1]/text()" />
            <waiting><xsl:value-of select="string-length(translate($workers, translate($workers, '_', ''), ''))" /></waiting>
            <starting><xsl:value-of select="string-length(translate($workers, translate($workers, 'S', ''), ''))" /></starting>
            <reading><xsl:value-of select="string-length(translate($workers, translate($workers, 'R', ''), ''))" /></reading>
            <sending><xsl:value-of select="string-length(translate($workers, translate($workers, 'W', ''), ''))" /></sending>
            <keepalive><xsl:value-of select="string-length(translate($workers, translate($workers, 'K', ''), ''))" /></keepalive>
            <dns_lookup><xsl:value-of select="string-length(translate($workers, translate($workers, 'D', ''), ''))" /></dns_lookup>
            <closing><xsl:value-of select="string-length(translate($workers, translate($workers, 'C', ''), ''))" /></closing>
            <logging><xsl:value-of select="string-length(translate($workers, translate($workers, 'L', ''), ''))" /></logging>
            <finishing><xsl:value-of select="string-length(translate($workers, translate($workers, 'G', ''), ''))" /></finishing>
            <idle_cleanup><xsl:value-of select="string-length(translate($workers, translate($workers, 'I', ''), ''))" /></idle_cleanup>
            <open_slot><xsl:value-of select="string-length(translate($workers, translate($workers, '.', ''), ''))" /></open_slot>
        </workers>
    </mod_status>
</xsl:template>



( run in 1.779 second using v1.01-cache-2.11-cpan-39bf76dae61 )