begin work on README and add JID display
This commit is contained in:
parent
a3e3392454
commit
aaa5d264f9
|
@ -1,16 +1,11 @@
|
||||||
Proc-ProcessTable-ncps
|
Proc-ProcessTable-ncps
|
||||||
|
|
||||||
The README is used to introduce the module and provide instructions on
|
A enhanced version of ps that adjanced searching capabilities
|
||||||
how to install the module, any machine dependencies it may have (for
|
|
||||||
example C compilers and installed libraries) and any other information
|
|
||||||
that should be provided before the module is installed.
|
|
||||||
|
|
||||||
A README file is required for CPAN modules since CPAN extracts the README
|
|
||||||
file from a module distribution so that people browsing the archive
|
|
||||||
can use it to get an idea of the module's uses. It is usually a good idea
|
|
||||||
to provide version information here so that people can decide whether
|
|
||||||
fixes for the module are worth downloading.
|
|
||||||
|
|
||||||
|
>ncps -c ldap -F -f
|
||||||
|
User PID %CPU %MEM VSZ RSS Info Nic Pri MajF minF Start Time Command
|
||||||
|
kitsune 21031 0.0 0.05 28536832 18235392 Rs+ 0 172 0 3187 18:01 0 perl /usr/local/bin/ncps -c ldap -F -f
|
||||||
|
ldap 1379 0.0 0.03 194584576 11145216 SL uwait 0 172 20 4917 21-08:50 1:15 /usr/local/libexec/slapd -u ldap -g ldap
|
||||||
|
|
||||||
INSTALLATION
|
INSTALLATION
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,8 @@ sub help{
|
||||||
|
|
||||||
-F Show major faults.
|
-F Show major faults.
|
||||||
|
|
||||||
|
-J Show jail IDs.
|
||||||
|
|
||||||
-n Show number of threads.
|
-n Show number of threads.
|
||||||
|
|
||||||
-p <pctcpu> CPU usage percent to search for.
|
-p <pctcpu> CPU usage percent to search for.
|
||||||
|
@ -83,7 +85,8 @@ my $major_faults=0;
|
||||||
my $cminor_faults=0;
|
my $cminor_faults=0;
|
||||||
my $cmajor_faults=0;
|
my $cmajor_faults=0;
|
||||||
my $numthr=0;
|
my $numthr=0;
|
||||||
my $tty=0,
|
my $tty=0;
|
||||||
|
my $jid=0;
|
||||||
|
|
||||||
# get the commandline options
|
# get the commandline options
|
||||||
Getopt::Long::Configure ('no_ignore_case');
|
Getopt::Long::Configure ('no_ignore_case');
|
||||||
|
@ -118,6 +121,7 @@ GetOptions(
|
||||||
'cF' => \$cmajor_faults,
|
'cF' => \$cmajor_faults,
|
||||||
'n' => \$numthr,
|
'n' => \$numthr,
|
||||||
'tty' => \$tty,
|
'tty' => \$tty,
|
||||||
|
'J' => \$jid,
|
||||||
);
|
);
|
||||||
|
|
||||||
# print the version info if requested
|
# print the version info if requested
|
||||||
|
@ -265,6 +269,7 @@ my $args={
|
||||||
minor_faults=>$minor_faults,
|
minor_faults=>$minor_faults,
|
||||||
numthr=>$numthr,
|
numthr=>$numthr,
|
||||||
tty=>$tty,
|
tty=>$tty,
|
||||||
|
'jid'=>$jid,
|
||||||
match=>{
|
match=>{
|
||||||
checks=>\@filters,
|
checks=>\@filters,
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,8 +71,10 @@ sub new {
|
||||||
$self->{match}=Proc::ProcessTable::Match->new( $args{match} );
|
$self->{match}=Proc::ProcessTable::Match->new( $args{match} );
|
||||||
}
|
}
|
||||||
|
|
||||||
my @bool_feed=('major_faults', 'minor_faults', 'cmajor_faults',
|
my @bool_feed=(
|
||||||
'cminor_faults', 'numthr', 'tty');
|
'major_faults', 'minor_faults', 'cmajor_faults',
|
||||||
|
'cminor_faults', 'numthr', 'tty', 'jid'
|
||||||
|
);
|
||||||
|
|
||||||
foreach my $feed ( @bool_feed ){
|
foreach my $feed ( @bool_feed ){
|
||||||
$self->{$feed}=$args{$feed};
|
$self->{$feed}=$args{$feed};
|
||||||
|
@ -201,6 +203,12 @@ sub run{
|
||||||
if (( $header_int % 2 ) != 0){ $padding=1; }else{ $padding=0; }
|
if (( $header_int % 2 ) != 0){ $padding=1; }else{ $padding=0; }
|
||||||
$tb->set_column_style($header_int, pad => $padding ); $header_int++;
|
$tb->set_column_style($header_int, pad => $padding ); $header_int++;
|
||||||
}
|
}
|
||||||
|
# add jail ID if needed
|
||||||
|
if ( $self->{jid} ){
|
||||||
|
push( @headers, 'JID' );
|
||||||
|
if (( $header_int % 2 ) != 0){ $padding=1; }else{ $padding=0; }
|
||||||
|
$tb->set_column_style($header_int, pad => $padding ); $header_int++;
|
||||||
|
}
|
||||||
if (( $header_int % 2 ) != 0){ $padding=1; }else{ $padding=0; }
|
if (( $header_int % 2 ) != 0){ $padding=1; }else{ $padding=0; }
|
||||||
$tb->set_column_style($header_int, pad => $padding ); $header_int++;
|
$tb->set_column_style($header_int, pad => $padding ); $header_int++;
|
||||||
push( @headers, 'Start' );
|
push( @headers, 'Start' );
|
||||||
|
@ -423,6 +431,13 @@ sub run{
|
||||||
push( @new_line, color($self->nextColor).$proc->{ttydev}.color('reset') );
|
push( @new_line, color($self->nextColor).$proc->{ttydev}.color('reset') );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# jail ID
|
||||||
|
#
|
||||||
|
if ( $self->{jid} ){
|
||||||
|
push( @new_line, color($self->nextColor).$proc->{jid}.color('reset') );
|
||||||
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# handles the start column
|
# handles the start column
|
||||||
#
|
#
|
||||||
|
|
Loading…
Reference in New Issue