Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Member
    Join Date
    Dec 2004
    Posts
    13

    Question Build apache with custom patches

    Hi!

    I want to rebuild my apache with one little patch which gives ability for apache to change its process title in order to include url there. I need it to have additional information in 'top' results to know what exact proccesses are eating too much cpu.

    How can I do this? I need to keep all other options made by me using easyapache and just only apply one patch with setproctitle. Help me please!

  2. #2
    Member
    Join Date
    Dec 2001
    Posts
    746

    Default

    Quote Originally Posted by HEKTO View Post
    Hi!

    I want to rebuild my apache with one little patch which gives ability for apache to change its process title in order to include url there. I need it to have additional information in 'top' results to know what exact proccesses are eating too much cpu.

    How can I do this? I need to keep all other options made by me using easyapache and just only apply one patch with setproctitle. Help me please!
    Depending on your patch, you can find information about customizing your Apache install here http://www.cpanel.net/support/docs/ea/ea3/

  3. #3
    Member
    Join Date
    Dec 2004
    Posts
    13

    Default

    I don't know if someone need to know how to apply custom patches to apache using Easyapache plugin system but since I've managed to do it with lack of official information I am going to share it with everyone who may concern.

    My goal is to patch apache 1.3 working in the linux enviroment to be able to see in the 'top' results what request each apache process handles every moment. I need to monitor it cause servers do not use phpSuExec and cause it is impossible to catch heavy processes using only mod_stat.

    I'm not going to describe all of the researching process and will give you only results

    Firstly I have to say that by default linux systems have no function to change titles of processes. So I had to find appropriate library. I took it from Alt Linux repositary. Here is the link ( ftp://ftp.altlinux.com/pub/distribut...1-alt1.src.rpm ). After installation I've got libsetproctitle.so shared library in my /usr/lib directory.

    After that I've written perl module for easy apache. I named it as SetProcTitlePatch.pm and placed it into /var/cpanel/easy/apache/custom_opt_mods/Cpanel/Easy/Apache

    Here is the source:

    -[cut here]-----------

    package Cpanel::Easy::Apache::SetProcTitlePatch;

    our $easyconfig = {

    'name' => 'SetProcTitle patch',
    'version' => '$Rev: 1 $',
    'hastargz' => 1,
    'url' => '',

    'dryrun' => {
    '0' => {
    'name' => 'Checking for Apache 1',
    'command' => sub {
    my ($self) = @_;
    $ap_ver = $self->{'working_profile'}{'Apache'}{'version'};
    if ( $ap_ver ne '1' ) {
    return ( 0, 'Not valid for [_1]', "Apache $ap_ver" );
    }
    return ( 1, 'Ok' );
    },
    },
    },

    'step' => {
    '0' => {
    'name' => 'Applying SetProcTitle patch',
    'command' => sub {
    my ($self) = @_;
    return $self->apply_patch( 'apache_set_proc_title.patch' );
    },
    },
    },
    };

    1;

    -[cut here]-----------

    I also prepared the patch, named it 'apache_set_proc_title.patch' and put it to the tarball named SetProcTitlePatch.pm.tar.gz into the same directory with SetProcTitlePatch.pm.

    Here is the source of the patch:

    -[cut here]-----------

    --- apache_1.3.39/src/main/http_main.c 2007-06-04 23:26:21.000000000 +0400
    +++ apache_1.3.39/src/main/http_main.c 2007-12-07 14:25:44.000000000 +0300
    @@ -63,6 +63,9 @@
    #include "scoreboard.h"
    #include "multithread.h"
    #include <sys/stat.h>
    +
    +#include <setproctitle.h>
    +
    #ifdef USE_SHMGET_SCOREBOARD
    #include <sys/types.h>
    #include <sys/ipc.h>
    @@ -4862,6 +4865,8 @@
    * signal (SIGUSR1, SIG_IGN);
    */

    + setproctitle( "%s%s", r->hostname, r->unparsed_uri );
    +
    (void) ap_update_child_status(my_child_num, SERVER_BUSY_WRITE, r);

    /* process the request if it was read without error */

    -[cut here]-----------

    For correct compilation I had to point to the apache make script that it should use shared-library for linking. I did it creating file named LIBS in /var/cpanel/easy/apache/rawenv.
    It contains only one line:

    -[cut here]-----------
    -lsetproctitle
    -[cut here]-----------

    After I did all of that things I can recompile apache server selecting this patch in Easyapache interface. And now I can monitor heavy processes just pressing 'c' key in 'top'

    I hope it can be useful for anybody.

Similar Threads & Tags
Similar threads

  1. How I Can Custom Build PHP?
    By reporter in forum cPanel and WHM Discussions
    Replies: 11
    Last Post: 10-18-2009, 11:59 PM
  2. Custom PHP build through Easy Apache turns on magic_quotes_gpc?????
    By ritontor in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 09-08-2009, 12:53 PM
  3. Replies: 2
    Last Post: 02-23-2009, 12:09 PM
  4. Custom apache patches
    By sirdopes in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 01-05-2009, 11:04 PM
  5. Custom Patches for PHP
    By WebIdentity in forum cPanel and WHM Discussions
    Replies: 5
    Last Post: 04-22-2007, 11:05 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube