The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Siebel::Srvrmgr::OS::Unix - module to recover information from OS processes of Siebel components

SYNOPSIS

    use Siebel::Srvrmgr::OS::Unix;
    my $procs = Siebel::Srvrmgr::OS::Unix->new(
        {
            comps_source =>
              Siebel::Srvrmgr::Log::Enterprise::Parser::Comp_alias->new(
                {
                    process_regex => 'Created\s(multithreaded)?\sserver\sprocess', 
                    log_path => $enterprise_log,
                    archive  => Archive->new( { dbm_path => $MY_DBM } )
                }
              ),
            cmd_regex => $siebel_path,
        }
    );

    # hash reference of objects Siebel::Srvrmgr::OS::Process
    my $procs_ref = $procs->get_procs;
    foreach my $comp_pid( keys( %{$procs_ref} ) ) {

        print 'Component ', $procs_ref->{$comp_pid}->{comp_alias}, ' is using ', $procs_ref->{$comp_pid}->{pctcpu}, "% of CPU now\n";

    }

DESCRIPTION

This module is a Moose class.

It is responsible to recover information from processes executing on a UNIX-like O.S. and merging that with information of Siebel components.

Details on running processes are recovered from /proc directory meanwhile the details about the components are read from a class that implements the Siebel::Srvrmgr::Comps_source role.

ATTRIBUTES

comps_source

Required attribute.

An instance of a class that implements the Moose Role Siebel::Srvrmgr::Comps_source. Those classes are supposed to recover information about the current modules available in a Siebel Server.

cmd_regex

Required attribute.

A string of the regular expression to match the command executed by the Siebel user from the cmdline file in /proc. This usually is the path included in the binary when you check with ps -aux command.

This attribute is a string, not a compiled regular expression with qr.

The amount of processes returned will depend on the regular expression used: one can match anything execute by the Siebel OS user or only the processes related to the Siebel components.

mem_limit

Optional attribute.

A integer representing the maximum bytes of RSS a Siebel process might have.

If set together with limits_callback, this class can execute some action when this threshold is exceeded.

cpu_limit

Optional attribute.

A integer representing the maximum CPU percentage a Siebel process might have.

If set together with limits_callback, this class can execute some action when this threshold is exceeded.

limits_callback

Optional attribute.

A code reference that will be executed when one of the attributes mem_limit and cpu_limit threshold is exceeded.

This is useful, for example, with you want to set a alarm or something like that.

The code reference will receive a hash reference as parameter which keys and values will depend on the type of limit triggered:

  • memory:

        type  => 'memory'
        rss   => <processes RSS>
        vsz   => <process VSZ>
        pid   => <process id>
        fname => <process fname>,
        cmd   => <process cmndline>
  • CPU:

        type  => 'cpu'
        cpu   => <process % of cpu>
        pid   => <process id>
        fname => <process fname>
        cmd   => <process cmndline>

METHODS

new

To create new instances of Siebel::Srvrmgr::OS::Unix.

The constructor expects a hash reference with the attributes required plus those that are marked as optional.

get_procs

Searches through /proc and and returns an hash reference with the pids as keys and Siebel::Srvrmgr::OS::Process instances as values.

Those instances will be created by merging information from /proc and the comps_source attribute instance.

SEE ALSO

AUTHOR

Alceu Rodrigues de Freitas Junior, <arfreitas@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2015 of Alceu Rodrigues de Freitas Junior, <arfreitas@cpan.org>

This file is part of Siebel Monitoring Tools.

Siebel Monitoring Tools is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

Siebel Monitoring Tools is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with Siebel Monitoring Tools. If not, see <http://www.gnu.org/licenses/>.