<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Reading Apache server-status output in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Reading-Apache-server-status-output/m-p/48160#M9114</link>
    <description>&lt;P&gt;Outstanding, thank you. Figured this was the direction to take if there was no direct read of the status page.&lt;/P&gt;</description>
    <pubDate>Mon, 25 Jul 2011 21:01:24 GMT</pubDate>
    <dc:creator>mhouts001</dc:creator>
    <dc:date>2011-07-25T21:01:24Z</dc:date>
    <item>
      <title>Reading Apache server-status output</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Reading-Apache-server-status-output/m-p/48158#M9112</link>
      <description>&lt;P&gt;Has anyone tried to have splunk parse the output of the machine readable apache server-status page, e.g &lt;A href="http://$apachehost/server-status?auto" target="test_blank"&gt;http://$apachehost/server-status?auto&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;I need to keep track of the status of workers, whether they are waiting, logging, etc.&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jul 2011 15:46:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Reading-Apache-server-status-output/m-p/48158#M9112</guid>
      <dc:creator>mhouts001</dc:creator>
      <dc:date>2011-07-25T15:46:23Z</dc:date>
    </item>
    <item>
      <title>Re: Reading Apache server-status output</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Reading-Apache-server-status-output/m-p/48159#M9113</link>
      <description>&lt;P&gt;I use a scripted input - I wrote a perl script to make a call to the Apache servers to pull stats..&lt;/P&gt;

&lt;P&gt;I'll include the code below to get you started:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;#!/usr/bin/perl

###
#Simple script to parse Apache Server statistics for Splunk
###

use LWP::UserAgent;

@apache_urls=("http://server1/server-status","http://server2/server-status","http://server3/server-status","http://server4/server-status");

foreach $url (@apache_urls) {
        my $ua = new LWP::UserAgent;
        $ua-&amp;gt;agent('Splunk Apache Statistics Script');
        my $request = HTTP::Request-&amp;gt;new('GET');
        $request-&amp;gt;url($url);
        my $response = $ua-&amp;gt;request($request);
        my $body = $response-&amp;gt;content;

        ### Extract stats
        $body=~ m/Apache Server Status for ([^&amp;gt;]+)&amp;lt;\/h1&amp;gt;/;
        $server_name=$1;
        $body=~ m/Current Time: [^,]+, ([^&amp;lt;]+)&amp;lt;\/dt&amp;gt;/;
        $timestamp=$1;
        $body=~ m/&amp;lt;dt&amp;gt;([^\s]+) requests\/sec - ([^\s]+) kB\/second - ([^\s]+) kB\/request&amp;lt;\/dt&amp;gt;/;
        $request_stats="requests_per_second=$1,kB_per_second=$2,kB_per_request=$3";
        $body=~ m/&amp;lt;dt&amp;gt; ([^\s]+) requests currently being processed, ([^\s]+) idle workers&amp;lt;\/dt&amp;gt;/;
        $processing_stats="requests_currently_being_processed=$1,idle_workers=$2";
        print "$timestamp,ServerName=$server_name,$request_stats,$processing_stats \n";
}
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 25 Jul 2011 16:14:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Reading-Apache-server-status-output/m-p/48159#M9113</guid>
      <dc:creator>Brian_Osburn</dc:creator>
      <dc:date>2011-07-25T16:14:01Z</dc:date>
    </item>
    <item>
      <title>Re: Reading Apache server-status output</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Reading-Apache-server-status-output/m-p/48160#M9114</link>
      <description>&lt;P&gt;Outstanding, thank you. Figured this was the direction to take if there was no direct read of the status page.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jul 2011 21:01:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Reading-Apache-server-status-output/m-p/48160#M9114</guid>
      <dc:creator>mhouts001</dc:creator>
      <dc:date>2011-07-25T21:01:24Z</dc:date>
    </item>
    <item>
      <title>Re: Reading Apache server-status output</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Reading-Apache-server-status-output/m-p/48161#M9115</link>
      <description>&lt;P&gt;Please accept the answer if it solves your issue.&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jul 2011 17:22:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Reading-Apache-server-status-output/m-p/48161#M9115</guid>
      <dc:creator>Brian_Osburn</dc:creator>
      <dc:date>2011-07-26T17:22:58Z</dc:date>
    </item>
    <item>
      <title>Re: Reading Apache server-status output</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Reading-Apache-server-status-output/m-p/48162#M9116</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I fixed a few typos and extended the script to work on lower-traffic servers and to provide CPU usage:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;#!/usr/bin/perl

###
#Simple script to parse Apache Server statistics for Splunk
###

use LWP::UserAgent;

@apache_urls=("http://server1/server-status","http://server2/server-status");

foreach $url (@apache_urls) {
        my $ua = new LWP::UserAgent;
        $ua-&amp;gt;agent('Splunk Apache Statistics Script');
        my $request = HTTP::Request-&amp;gt;new('GET');
        $request-&amp;gt;url($url);
        my $response = $ua-&amp;gt;request($request);
        my $body = $response-&amp;gt;content;

        ### Extract stats
        $body=~ m/Apache Server Status for ([^&amp;gt;]+)&amp;lt;\/h1&amp;gt;/;
        $server_name=$1;
        $body=~ m/Current Time: [^,]+, ([^&amp;lt;]+)&amp;lt;\/dt&amp;gt;/;
        $timestamp=$1;
        $body=~ m/&amp;lt;dt&amp;gt;([^\s]+) requests\/sec - ([^\s]+) (k*B)\/second - ([^\s]+) (k*B)\/request&amp;lt;\/dt&amp;gt;/;
        $request_stats="requests_per_second=$1,$3_per_second=$2,$5_per_request=$4";
        $body=~ m/&amp;lt;dt&amp;gt;([^\s]+) requests currently being processed, ([^\s]+) idle workers&amp;lt;\/dt&amp;gt;/;
        $processing_stats="requests_currently_being_processed=$1,idle_workers=$2";
        $body=~ m/&amp;lt;dt&amp;gt;CPU Usage: u([^\s]+) s([^\s]+) cu.* cs.* - ([^\s]+%) CPU load&amp;lt;\/dt&amp;gt;/;
        $cpu_stats="user_cpu=$1,system_cpu=$2,cpu_load=$3";
        print "$timestamp,ServerName=$server_name,$request_stats,$processing_stats,$cpu_stats \n";
}
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 02 Aug 2011 15:58:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Reading-Apache-server-status-output/m-p/48162#M9116</guid>
      <dc:creator>LK</dc:creator>
      <dc:date>2011-08-02T15:58:47Z</dc:date>
    </item>
    <item>
      <title>Re: Reading Apache server-status output</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Reading-Apache-server-status-output/m-p/48163#M9117</link>
      <description>&lt;P&gt;Not sure why all the backslashes doubled themselves.  Please be sure to correct that before using the script.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Aug 2011 22:11:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Reading-Apache-server-status-output/m-p/48163#M9117</guid>
      <dc:creator>LK</dc:creator>
      <dc:date>2011-08-02T22:11:53Z</dc:date>
    </item>
    <item>
      <title>Re: Reading Apache server-status output</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Reading-Apache-server-status-output/m-p/48164#M9118</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;needed to change the line;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; $body=~ m/&amp;lt;dt&amp;gt;([^\s]+) requests\/sec - ([^\s]+) (k*B)\/second - ([^\s]+) (k*B)\/request&amp;lt;\/dt&amp;gt;/;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;to:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; $body=~ m/&amp;lt;dt&amp;gt;([^\s]+) requests\/sec - ([^\s]+) (k*B)\/second - ([^\s]+) ([k,M]*B)\/request&amp;lt;\/dt&amp;gt;/;        
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;regards,&lt;BR /&gt;
-thomas&lt;/P&gt;</description>
      <pubDate>Thu, 20 Oct 2016 15:24:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Reading-Apache-server-status-output/m-p/48164#M9118</guid>
      <dc:creator>ThomasKoeberlei</dc:creator>
      <dc:date>2016-10-20T15:24:18Z</dc:date>
    </item>
  </channel>
</rss>

