mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-20 20:25:06 +02:00
enh(plugin)apps-php-metrics v2 (#2523)
This commit is contained in:
parent
fafe49374d
commit
1c0732fade
@ -35,88 +35,88 @@ sub set_counters {
|
|||||||
];
|
];
|
||||||
|
|
||||||
$self->{maps_counters}->{fcache} = [
|
$self->{maps_counters}->{fcache} = [
|
||||||
{ label => 'request-rate', set => {
|
{ label => 'request-rate', nlabel => 'requests.persecond', set => {
|
||||||
key_values => [ { name => 'rr' } ],
|
key_values => [ { name => 'rr' } ],
|
||||||
output_template => 'Request Rate (global): %.2f',
|
output_template => 'Request Rate (global): %.2f',
|
||||||
perfdatas => [
|
perfdatas => [
|
||||||
{ label => 'request_rate', template => '%.2f',
|
{ label => 'request_rate', template => '%.2f',
|
||||||
unit => 'r/s', min => 0 },
|
unit => 'r/s', min => 0 }
|
||||||
],
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ label => 'request-rate-now', set => {
|
{ label => 'request-rate-now', nlabel => 'requests.now.persecond', set => {
|
||||||
key_values => [ { name => 'hits', diff => 1 }, { name => 'misses', diff => 1 } ],
|
key_values => [ { name => 'hits', diff => 1 }, { name => 'misses', diff => 1 } ],
|
||||||
closure_custom_calc => $self->can('custom_rr_calc'),
|
closure_custom_calc => $self->can('custom_rr_calc'),
|
||||||
output_template => 'Request Rate : %.2f', output_error_template => 'Request Rate : %s',
|
output_template => 'Request Rate : %.2f', output_error_template => 'Request Rate : %s',
|
||||||
output_use => 'rr_now', threshold_use => 'rr_now',
|
output_use => 'rr_now', threshold_use => 'rr_now',
|
||||||
perfdatas => [
|
perfdatas => [
|
||||||
{ label => 'request_rate_now', value => 'rr_now', template => '%.2f',
|
{ label => 'request_rate_now', template => '%.2f',
|
||||||
unit => 'r/s', min => 0 },
|
unit => 'r/s', min => 0 }
|
||||||
],
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ label => 'hit-rate', set => {
|
{ label => 'hit-rate', nlabel => 'hits.persecond', set => {
|
||||||
key_values => [ { name => 'hr' } ],
|
key_values => [ { name => 'hr' } ],
|
||||||
output_template => 'Hit Rate (global): %.2f',
|
output_template => 'Hit Rate (global): %.2f',
|
||||||
perfdatas => [
|
perfdatas => [
|
||||||
{ label => 'hit_rate',template => '%.2f',
|
{ label => 'hit_rate',template => '%.2f',
|
||||||
unit => 'r/s', min => 0 },
|
unit => 'r/s', min => 0 }
|
||||||
],
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ label => 'hit-rate-now', set => {
|
{ label => 'hit-rate-now', nlabel => 'hits.persecond', set => {
|
||||||
key_values => [ { name => 'hits', diff => 1 } ],
|
key_values => [ { name => 'hits', diff => 1 } ],
|
||||||
closure_custom_calc => $self->can('custom_hr_calc'),
|
closure_custom_calc => $self->can('custom_hr_calc'),
|
||||||
output_template => 'Hit Rate : %.2f', output_error_template => 'Hit Rate : %s',
|
output_template => 'Hit Rate : %.2f', output_error_template => 'Hit Rate : %s',
|
||||||
output_use => 'hr_now', threshold_use => 'hr_now',
|
output_use => 'hr_now', threshold_use => 'hr_now',
|
||||||
perfdatas => [
|
perfdatas => [
|
||||||
{ label => 'hit_rate_now', value => 'hr_now', template => '%.2f',
|
{ label => 'hit_rate_now', template => '%.2f',
|
||||||
unit => 'r/s', min => 0 },
|
unit => 'r/s', min => 0 }
|
||||||
],
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ label => 'miss-rate', set => {
|
{ label => 'miss-rate', nlabel => 'misses.persecond', set => {
|
||||||
key_values => [ { name => 'mr' } ],
|
key_values => [ { name => 'mr' } ],
|
||||||
output_template => 'Miss Rate (global): %.2f',
|
output_template => 'Miss Rate (global): %.2f',
|
||||||
perfdatas => [
|
perfdatas => [
|
||||||
{ label => 'miss_rate',template => '%.2f',
|
{ label => 'miss_rate',template => '%.2f',
|
||||||
unit => 'r/s', min => 0 },
|
unit => 'r/s', min => 0 }
|
||||||
],
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ label => 'miss-rate-now', set => {
|
{ label => 'miss-rate-now', nlabel => 'misses.now.persecond', set => {
|
||||||
key_values => [ { name => 'misses', diff => 1 } ],
|
key_values => [ { name => 'misses', diff => 1 } ],
|
||||||
closure_custom_calc => $self->can('custom_mr_calc'),
|
closure_custom_calc => $self->can('custom_mr_calc'),
|
||||||
output_template => 'Miss Rate : %.2f', output_error_template => 'Miss Rate : %s',
|
output_template => 'Miss Rate : %.2f', output_error_template => 'Miss Rate : %s',
|
||||||
output_use => 'mr_now', threshold_use => 'mr_now',
|
output_use => 'mr_now', threshold_use => 'mr_now',
|
||||||
perfdatas => [
|
perfdatas => [
|
||||||
{ label => 'miss_rate_now', value => 'mr_now', template => '%.2f',
|
{ label => 'miss_rate_now', value => 'mr_now', template => '%.2f',
|
||||||
unit => 'r/s', min => 0 },
|
unit => 'r/s', min => 0 }
|
||||||
],
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ label => 'hit-percent', set => {
|
{ label => 'hit-percent', nlabel => 'hits.percentage', set => {
|
||||||
key_values => [ { name => 'hits' }, { name => 'misses' } ],
|
key_values => [ { name => 'hits' }, { name => 'misses' } ],
|
||||||
closure_custom_calc => $self->can('custom_hit_percent_calc'),
|
closure_custom_calc => $self->can('custom_hit_percent_calc'),
|
||||||
output_template => 'Hit Ratio (global) : %.2f %%', output_error_template => 'Hit Ratio (global): %s',
|
output_template => 'Hit Ratio (global) : %.2f %%', output_error_template => 'Hit Ratio (global): %s',
|
||||||
output_use => 'hit_ratio', threshold_use => 'hit_ratio',
|
output_use => 'hit_ratio', threshold_use => 'hit_ratio',
|
||||||
perfdatas => [
|
perfdatas => [
|
||||||
{ label => 'hit_ratio', value => 'hit_ratio', template => '%.2f',
|
{ label => 'hit_ratio', value => 'hit_ratio', template => '%.2f',
|
||||||
unit => '%', min => 0, max => 100 },
|
unit => '%', min => 0, max => 100 }
|
||||||
],
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ label => 'hit-percent-now', set => {
|
{ label => 'hit-percent-now', nlabel => 'hits.now.percentage', set => {
|
||||||
key_values => [ { name => 'hits', diff => 1 }, { name => 'misses', diff => 1 } ],
|
key_values => [ { name => 'hits', diff => 1 }, { name => 'misses', diff => 1 } ],
|
||||||
closure_custom_calc => $self->can('custom_hit_percent_now_calc'),
|
closure_custom_calc => $self->can('custom_hit_percent_now_calc'),
|
||||||
output_template => 'Hit Ratio : %.2f %%', output_error_template => 'Hit Ratio : %s',
|
output_template => 'Hit Ratio : %.2f %%', output_error_template => 'Hit Ratio : %s',
|
||||||
output_use => 'hit_ratio_now', threshold_use => 'hit_ratio_now',
|
output_use => 'hit_ratio_now', threshold_use => 'hit_ratio_now',
|
||||||
perfdatas => [
|
perfdatas => [
|
||||||
{ label => 'hit_ratio_now', value => 'hit_ratio_now', template => '%.2f',
|
{ label => 'hit_ratio_now', value => 'hit_ratio_now', template => '%.2f',
|
||||||
unit => '%', min => 0, max => 100 },
|
unit => '%', min => 0, max => 100 }
|
||||||
],
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,39 +27,6 @@ use warnings;
|
|||||||
use centreon::plugins::http;
|
use centreon::plugins::http;
|
||||||
use centreon::plugins::misc;
|
use centreon::plugins::misc;
|
||||||
|
|
||||||
sub set_counters {
|
|
||||||
my ($self, %options) = @_;
|
|
||||||
|
|
||||||
$self->{maps_counters_type} = [
|
|
||||||
{ name => 'mem', type => 0, cb_prefix_output => 'prefix_output' }
|
|
||||||
];
|
|
||||||
|
|
||||||
$self->{maps_counters}->{mem} = [
|
|
||||||
{ label => 'used', set => {
|
|
||||||
key_values => [ { name => 'free' }, { name => 'free' } ],
|
|
||||||
closure_custom_calc => $self->can('custom_used_calc'),
|
|
||||||
closure_custom_output => $self->can('custom_used_output'),
|
|
||||||
threshold_use => 'used_prct',
|
|
||||||
output_error_template => 'Memory Usage: %s',
|
|
||||||
perfdatas => [
|
|
||||||
{ value => 'used', label => 'used', template => '%d',
|
|
||||||
unit => 'B', min => 0, max => 'total', threshold_total => 'total' },
|
|
||||||
],
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ label => 'fragmentation', set => {
|
|
||||||
key_values => [ { name => 'fragmentation' } ],
|
|
||||||
output_template => 'Memory Fragmentation: %.2f %%', output_error_template => 'Memory Fragmentation: %s',
|
|
||||||
output_use => 'fragmentation', threshold_use => 'fragmentation',
|
|
||||||
perfdatas => [
|
|
||||||
{ value => 'fragmentation', label => 'fragmentation', template => '%.2f',
|
|
||||||
unit => '%', min => 0, max => 100 },
|
|
||||||
],
|
|
||||||
}
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
sub custom_used_calc {
|
sub custom_used_calc {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
@ -90,6 +57,39 @@ sub prefix_output {
|
|||||||
return "Apc ";
|
return "Apc ";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub set_counters {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
$self->{maps_counters_type} = [
|
||||||
|
{ name => 'mem', type => 0, cb_prefix_output => 'prefix_output' }
|
||||||
|
];
|
||||||
|
|
||||||
|
$self->{maps_counters}->{mem} = [
|
||||||
|
{ label => 'used', nlabel => 'memory.usage.bytes', set => {
|
||||||
|
key_values => [ { name => 'free' }, { name => 'free' } ],
|
||||||
|
closure_custom_calc => $self->can('custom_used_calc'),
|
||||||
|
closure_custom_output => $self->can('custom_used_output'),
|
||||||
|
threshold_use => 'used_prct',
|
||||||
|
output_error_template => 'Memory Usage: %s',
|
||||||
|
perfdatas => [
|
||||||
|
{ label => 'used', template => '%d',
|
||||||
|
unit => 'B', min => 0, max => 'total', threshold_total => 'total' },
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ label => 'fragmentation', nlabel => 'memory.fragmentation.percentage', set => {
|
||||||
|
key_values => [ { name => 'fragmentation' } ],
|
||||||
|
output_template => 'Memory Fragmentation: %.2f %%', output_error_template => 'Memory Fragmentation: %s',
|
||||||
|
output_use => 'fragmentation', threshold_use => 'fragmentation',
|
||||||
|
perfdatas => [
|
||||||
|
{ label => 'fragmentation', template => '%.2f',
|
||||||
|
unit => '%', min => 0, max => 100 }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
my ($class, %options) = @_;
|
my ($class, %options) = @_;
|
||||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||||
|
@ -30,10 +30,10 @@ sub new {
|
|||||||
bless $self, $class;
|
bless $self, $class;
|
||||||
|
|
||||||
$self->{version} = '0.1';
|
$self->{version} = '0.1';
|
||||||
%{$self->{modes}} = (
|
$self->{modes} = {
|
||||||
'file-cache' => 'apps::php::apc::web::mode::filecache',
|
'file-cache' => 'apps::php::apc::web::mode::filecache',
|
||||||
'memory' => 'apps::php::apc::web::mode::memory',
|
'memory' => 'apps::php::apc::web::mode::memory'
|
||||||
);
|
};
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
@ -27,51 +27,6 @@ use warnings;
|
|||||||
use centreon::plugins::http;
|
use centreon::plugins::http;
|
||||||
use Digest::MD5 qw(md5_hex);
|
use Digest::MD5 qw(md5_hex);
|
||||||
|
|
||||||
sub set_counters {
|
|
||||||
my ($self, %options) = @_;
|
|
||||||
|
|
||||||
$self->{maps_counters_type} = [
|
|
||||||
{ name => 'fpm', type => 0, cb_prefix_output => 'prefix_output' }
|
|
||||||
];
|
|
||||||
|
|
||||||
$self->{maps_counters}->{fpm} = [
|
|
||||||
{ label => 'active-processes', set => {
|
|
||||||
key_values => [ { name => 'active' }, { name => 'total' } ],
|
|
||||||
closure_custom_calc => $self->can('custom_active_calc'),
|
|
||||||
closure_custom_output => $self->can('custom_active_output'),
|
|
||||||
threshold_use => 'active_prct',
|
|
||||||
closure_custom_perfdata => => $self->can('custom_active_perfdata')
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ label => 'idle-processes', set => {
|
|
||||||
key_values => [ { name => 'idle' }, { name => 'total' } ],
|
|
||||||
closure_custom_calc => $self->can('custom_idle_calc'),
|
|
||||||
closure_custom_output => $self->can('custom_idle_output'),
|
|
||||||
threshold_use => 'idle_prct',
|
|
||||||
closure_custom_perfdata => => $self->can('custom_idle_perfdata')
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ label => 'listen-queue', set => {
|
|
||||||
key_values => [ { name => 'listen_queue' }, { name => 'max_listen_queue' } ],
|
|
||||||
output_template => 'Listen queue : %s',
|
|
||||||
output_use => 'listen_queue', threshold_use => 'listen_queue',
|
|
||||||
perfdatas => [
|
|
||||||
{ label => 'listen_queue', template => '%s',
|
|
||||||
min => 0, max => 'max_listen_queue' }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ label => 'requests', set => {
|
|
||||||
key_values => [ { name => 'request', per_second => 1 } ],
|
|
||||||
output_template => 'Requests : %.2f/s',
|
|
||||||
perfdatas => [
|
|
||||||
{ label => 'requests', template => '%.2f', unit => '/s', min => 0 }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
sub custom_active_calc {
|
sub custom_active_calc {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
@ -132,6 +87,51 @@ sub prefix_output {
|
|||||||
return "php-fpm ";
|
return "php-fpm ";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub set_counters {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
$self->{maps_counters_type} = [
|
||||||
|
{ name => 'fpm', type => 0, cb_prefix_output => 'prefix_output' }
|
||||||
|
];
|
||||||
|
|
||||||
|
$self->{maps_counters}->{fpm} = [
|
||||||
|
{ label => 'active-processes', nlabel => 'processes.active.count', set => {
|
||||||
|
key_values => [ { name => 'active' }, { name => 'total' } ],
|
||||||
|
closure_custom_calc => $self->can('custom_active_calc'),
|
||||||
|
closure_custom_output => $self->can('custom_active_output'),
|
||||||
|
threshold_use => 'active_prct',
|
||||||
|
closure_custom_perfdata => => $self->can('custom_active_perfdata')
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ label => 'idle-processes', nlabel => 'processes.idle.count', set => {
|
||||||
|
key_values => [ { name => 'idle' }, { name => 'total' } ],
|
||||||
|
closure_custom_calc => $self->can('custom_idle_calc'),
|
||||||
|
closure_custom_output => $self->can('custom_idle_output'),
|
||||||
|
threshold_use => 'idle_prct',
|
||||||
|
closure_custom_perfdata => => $self->can('custom_idle_perfdata')
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ label => 'listen-queue', nlabel => 'queue.listen.count', set => {
|
||||||
|
key_values => [ { name => 'listen_queue' }, { name => 'max_listen_queue' } ],
|
||||||
|
output_template => 'Listen queue : %s',
|
||||||
|
output_use => 'listen_queue', threshold_use => 'listen_queue',
|
||||||
|
perfdatas => [
|
||||||
|
{ label => 'listen_queue', template => '%s',
|
||||||
|
min => 0, max => 'max_listen_queue' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ label => 'requests', nlabel => 'requests.count', set => {
|
||||||
|
key_values => [ { name => 'request', per_second => 1 } ],
|
||||||
|
output_template => 'Requests : %.2f/s',
|
||||||
|
perfdatas => [
|
||||||
|
{ label => 'requests', template => '%.2f', unit => '/s', min => 0 }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
my ($class, %options) = @_;
|
my ($class, %options) = @_;
|
||||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1);
|
my $self = $class->SUPER::new(package => __PACKAGE__, %options, statefile => 1);
|
||||||
|
@ -30,9 +30,9 @@ sub new {
|
|||||||
bless $self, $class;
|
bless $self, $class;
|
||||||
|
|
||||||
$self->{version} = '0.1';
|
$self->{version} = '0.1';
|
||||||
%{$self->{modes}} = (
|
$self->{modes} = {
|
||||||
'usage' => 'apps::php::fpm::web::mode::usage',
|
'usage' => 'apps::php::fpm::web::mode::usage'
|
||||||
);
|
};
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user