Commit e57c66cc authored by itoussies's avatar itoussies
Browse files

wip

parent 48ffc55f
......@@ -25,7 +25,7 @@ use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
use Digest::MD5 qw(md5_hex);
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng);
sub custom_status_output {
my ($self, %options) = @_;
......@@ -57,7 +57,7 @@ sub set_counters {
closure_custom_calc => $self->can('custom_status_calc'),
closure_custom_output => $self->can('custom_status_output'),
closure_custom_perfdata => sub { return 0; },
closure_custom_threshold_check => \&catalog_status_threshold,
closure_custom_threshold_check => \&catalog_status_threshold_ng,
}
},
{ label => 'traffic-in', set => {
......
......@@ -24,7 +24,7 @@ use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng);
sub custom_status_output {
my ($self, %options) = @_;
......@@ -135,7 +135,7 @@ sub set_counters {
closure_custom_calc => $self->can('custom_status_calc'),
closure_custom_output => $self->can('custom_status_output'),
closure_custom_perfdata => sub { return 0; },
closure_custom_threshold_check => \&catalog_status_threshold,
closure_custom_threshold_check => \&catalog_status_threshold_ng,
}
},
{ label => 'usage', set => {
......
......@@ -25,7 +25,7 @@ use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
use Digest::MD5 qw(md5_hex);
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng);
sub custom_status_output {
my ($self, %options) = @_;
......@@ -57,7 +57,7 @@ sub set_counters {
closure_custom_calc => $self->can('custom_status_calc'),
closure_custom_output => $self->can('custom_status_output'),
closure_custom_perfdata => sub { return 0; },
closure_custom_threshold_check => \&catalog_status_threshold
closure_custom_threshold_check => \&catalog_status_threshold_ng
}
},
{ label => 'traffic-in', set => {
......
......@@ -25,7 +25,7 @@ use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
use Digest::MD5 qw(md5_hex);
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng);
sub custom_status_output {
my ($self, %options) = @_;
......@@ -44,6 +44,12 @@ sub custom_status_calc {
return 0;
}
sub prefix_input_output {
my ($self, %options) = @_;
return "Input '" . $options{instance_value}->{name} . "' ";
}
sub set_counters {
my ($self, %options) = @_;
......@@ -52,7 +58,7 @@ sub set_counters {
];
$self->{maps_counters}->{input} = [
{ label => 'status', threshold => 0, set => {
{ label => 'status', type => 2, set => {
key_values => [ { name => 'active' }, { name => 'name' }, { name => 'error' } ],
closure_custom_calc => $self->can('custom_status_calc'),
closure_custom_output => $self->can('custom_status_output'),
......@@ -79,27 +85,12 @@ sub new {
bless $self, $class;
$options{options}->add_options(arguments => {
'filter-name:s' => { name => 'filter_name' },
'warning-status:s' => { name => 'warning_status' },
'critical-status:s' => { name => 'critical_status' }
'filter-name:s' => { name => 'filter_name' }
});
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::check_options(%options);
$self->change_macros(macros => ['warning_status', 'critical_status']);
}
sub prefix_input_output {
my ($self, %options) = @_;
return "Input '" . $options{instance_value}->{name} . "' ";
}
sub manage_selection {
my ($self, %options) = @_;
......
......@@ -25,7 +25,7 @@ use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
use centreon::plugins::misc;
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng);
sub custom_status_output {
my ($self, %options) = @_;
......@@ -34,15 +34,10 @@ sub custom_status_output {
return $msg;
}
sub custom_status_calc {
sub prefix_output_output {
my ($self, %options) = @_;
$self->{result_values}->{active} = $options{new_datas}->{$self->{instance} . '_active'};
$self->{result_values}->{name} = $options{new_datas}->{$self->{instance} . '_name'};
$self->{result_values}->{error} = $options{new_datas}->{$self->{instance} . '_error'};
$self->{result_values}->{con_stat} = $options{new_datas}->{$self->{instance} . '_con_stat'};
return 0;
return "Output '" . $options{instance_value}->{name} . "' ";
}
sub set_counters {
......@@ -53,24 +48,23 @@ sub set_counters {
];
$self->{maps_counters}->{output_stream} = [
{ label => 'status', threshold => 0, set => {
{ label => 'status', type => 2, set => {
key_values => [ { name => 'active' }, { name => 'name' }, { name => 'error' }, { name => 'con_stat' } ],
closure_custom_calc => $self->can('custom_status_calc'),
closure_custom_output => $self->can('custom_status_output'),
closure_custom_perfdata => sub { return 0; },
closure_custom_threshold_check => \&catalog_status_threshold,
closure_custom_threshold_check => \&catalog_status_threshold_ng
}
},
{ label => 'current-bitrate', set => {
{ label => 'current-bitrate', nlabel => 'feedoutput.traffic.out.usage.bytes.', set => {
key_values => [ { name => 'bitrate' }, { name => 'name' } ],
output_change_bytes => 2,
output_template => 'Current Bitrate : %s %s/s',
output_template => 'current bitrate : %s %s/s',
perfdatas => [
{ label => 'current_bitrate', value => 'bitrate', template => '%.2f',
min => 0, unit => 'b/s', label_extra_instance => 1, instance_use => 'name' },
],
{ label => 'current_bitrate', template => '%.2f',
min => 0, unit => 'b/s', label_extra_instance => 1, instance_use => 'name' }
]
}
},
}
];
}
......@@ -79,27 +73,11 @@ sub new {
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$options{options}->add_options(arguments =>
{
"filter-name:s" => { name => 'filter_name' },
"warning-status:s" => { name => 'warning_status' },
"critical-status:s" => { name => 'critical_status' },
});
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::check_options(%options);
$self->change_macros(macros => ['warning_status', 'critical_status']);
}
$options{options}->add_options(arguments => {
"filter-name:s" => { name => 'filter_name' }
});
sub prefix_output_output {
my ($self, %options) = @_;
return "Output '" . $options{instance_value}->{name} . "' ";
return $self;
}
sub manage_selection {
......
......@@ -30,14 +30,14 @@ sub new {
bless $self, $class;
$self->{version} = '1.0';
%{$self->{modes}} = (
'broadcaster-input-usage' => 'apps::video::zixi::restapi::mode::broadcasterinputusage',
'broadcaster-license-usage' => 'apps::video::zixi::restapi::mode::broadcasterlicenseusage',
'broadcaster-output-usage' => 'apps::video::zixi::restapi::mode::broadcasteroutputusage',
'broadcaster-system-usage' => 'apps::video::zixi::restapi::mode::broadcastersystemusage',
'feeder-input-usage' => 'apps::video::zixi::restapi::mode::feederinputusage',
'feeder-output-usage' => 'apps::video::zixi::restapi::mode::feederoutputusage',
);
$self->{modes} = (
'broadcaster-input-usage' => 'apps::video::zixi::restapi::mode::broadcasterinputusage',
'broadcaster-license-usage' => 'apps::video::zixi::restapi::mode::broadcasterlicenseusage',
'broadcaster-output-usage' => 'apps::video::zixi::restapi::mode::broadcasteroutputusage',
'broadcaster-system-usage' => 'apps::video::zixi::restapi::mode::broadcastersystemusage',
'feeder-input-usage' => 'apps::video::zixi::restapi::mode::feederinputusage',
'feeder-output-usage' => 'apps::video::zixi::restapi::mode::feederoutputusage'
};
$self->{custom_modes}{api} = 'apps::video::zixi::restapi::custom::api';
return $self;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment