From 2ffb7aabaf4ecfdf509136c6019c9c21449780c3 Mon Sep 17 00:00:00 2001 From: Simon Bomm Date: Thu, 11 May 2017 22:08:58 +0200 Subject: [PATCH 1/2] + fix typo in state mapping --- os/linux/local/mode/process.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/os/linux/local/mode/process.pm b/os/linux/local/mode/process.pm index f5508195a..05a94656a 100644 --- a/os/linux/local/mode/process.pm +++ b/os/linux/local/mode/process.pm @@ -31,7 +31,7 @@ my %state_map = ( X => 'dead', W => 'paging', T => 'stopped', - S => 'InterrupibleSleep', + S => 'InterruptibleSleep', R => 'running', D => 'UninterrupibleSleep' ); @@ -261,4 +261,4 @@ You can use: 'zombie', 'dead', 'paging', 'stopped', =back -=cut \ No newline at end of file +=cut From 18d1dd94e93ccdbf2e1aebb1f3eb3c8fe78b68a2 Mon Sep 17 00:00:00 2001 From: Simon Bomm Date: Thu, 11 May 2017 22:12:21 +0200 Subject: [PATCH 2/2] + add possibility to filter on ppid Ref https://github.com/centreon/centreon-plugins/issues/666 #devilissue :) --- os/linux/local/mode/process.pm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/os/linux/local/mode/process.pm b/os/linux/local/mode/process.pm index 05a94656a..fabd7e91c 100644 --- a/os/linux/local/mode/process.pm +++ b/os/linux/local/mode/process.pm @@ -61,6 +61,7 @@ sub new { "filter-command:s" => { name => 'filter_command' }, "filter-arg:s" => { name => 'filter_arg' }, "filter-state:s" => { name => 'filter_state' }, + "filter-ppid:s" => { name => 'filter_ppid' }, }); $self->{result} = {}; return $self; @@ -154,7 +155,9 @@ sub run { $self->{result}->{$pid}->{args} !~ /$self->{option_results}->{filter_arg}/); next if (defined($self->{option_results}->{filter_state}) && $self->{option_results}->{filter_state} ne '' && $state_map{$self->{result}->{$pid}->{state}} !~ /$self->{option_results}->{filter_state}/i); - + next if (defined($self->{option_results}->{filter_ppid}) && $self->{option_results}->{filter_ppid} ne '' && + $self->{result}->{$pid}->{ppid} !~ /$self->{option_results}->{filter_ppid}/); + $self->{output}->output_add(long_msg => 'Process: [command => ' . $self->{result}->{$pid}->{cmd} . '] [arg => ' . $self->{result}->{$pid}->{args} . '] [state => ' . $state_map{$self->{result}->{$pid}->{state}} . ']'); @@ -253,6 +256,10 @@ Filter process commands (regexp can be used). Filter process arguments (regexp can be used). +=item B<--filter-ppid> + +Filter process ppid (regexp can be used). + =item B<--filter-state> Filter process states (regexp can be used).