<commit_before>#
# Copyright 2019 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

package network::alcatel::isam::snmp::mode::hubsapusage;

use base qw(centreon::plugins::templates::counter);

use strict;
use warnings;
use Digest::MD5 qw(md5_hex);
use centreon::plugins::statefile;
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);

sub set_counters {
    my ($self, %options) = @_;
    
    $self->{maps_counters_type} = [
        { name => 'global', type => 0 },
        { name => 'sap', type => 1, cb_prefix_output => 'prefix_sap_output', message_multiple => 'All SAP are ok', skipped_code => { -10 => 1 } },
    ];
    
    $self->{maps_counters}->{sap} = [
        { label => 'status', threshold => 0, set => {
                key_values => [ { name => 'status' }, { name => 'admin' }, { name => 'display' } ],
                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 => $self->can('custom_status_threshold'),
            }
        },
        { label => 'in-traffic', nlabel => 'sap.traffic.in.bitspersecond', set => {
                key_values => [ { name => 'in', diff => 1 }, { name => 'display' } ],
                per_second => 1,
                closure_custom_calc => $self->can('custom_sap_calc'), closure_custom_calc_extra_options => { label_ref => 'in' },
                closure_custom_output => $self->can('custom_sap_output'),
                closure_custom_perfdata => $self->can('custom_sap_perfdata'),
                closure_custom_threshold_check => $self->can('custom_qsap_threshold'),
            }
        },
        { label => 'out-traffic', nlabel => 'sap.traffic.out.bitsperseconds', set => {
                key_values => [ { name => 'out', diff => 1 }, { name => 'display' } ],
                per_second => 1,
                closure_custom_calc => $self->can('custom_sap_calc'), closure_custom_calc_extra_options => { label_ref => 'out' },
                closure_custom_output => $self->can('custom_sap_output'),
                closure_custom_perfdata => $self->can('custom_sap_perfdata'),
                closure_custom_threshold_check => $self->can('custom_sap_threshold'),
            }
        },
    ];
    
    $self->{maps_counters}->{global} = [
        { label => 'total-in-traffic', nlabel => 'sap.traffic.in.bitspersecond', set => {
                key_values => [],
                manual_keys => 1, per_second => 1, output_change_bytes => 2,
                closure_custom_calc => $self->can('custom_total_traffic_calc'), closure_custom_calc_extra_options => { label_ref => 'in' },
                closure_custom_output => $self->can('custom_total_traffic_output'),
                closure_custom_perfdata => $self->can('custom_total_traffic_perfdata'),
                closure_custom_threshold_check => $self->can('custom_total_traffic_threshold'),
            }
        },
        { label => 'total-out-traffic', nlabel => 'sap.traffic.out.bitspersecond', set => {
                key_values => [],<commit_msg>fix new naming alcatel isam<commit_after>#
# Copyright 2019 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

package network::alcatel::isam::snmp::mode::hubsapusage;

use base qw(centreon::plugins::templates::counter);

use strict;
use warnings;
use Digest::MD5 qw(md5_hex);
use centreon::plugins::statefile;
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold);

sub set_counters {
    my ($self, %options) = @_;
    
    $self->{maps_counters_type} = [
        { name => 'global', type => 0 },
        { name => 'sap', type => 1, cb_prefix_output => 'prefix_sap_output', message_multiple => 'All SAP are ok', skipped_code => { -10 => 1 } },
    ];
    
    $self->{maps_counters}->{sap} = [
        { label => 'status', threshold => 0, set => {
                key_values => [ { name => 'status' }, { name => 'admin' }, { name => 'display' } ],
                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 => $self->can('custom_status_threshold'),
            }
        },
        { label => 'in-traffic', nlabel => 'sap.traffic.in.bitspersecond', set => {
                key_values => [ { name => 'in', diff => 1 }, { name => 'display' } ],
                per_second => 1,
                closure_custom_calc => $self->can('custom_sap_calc'), closure_custom_calc_extra_options => { label_ref => 'in' },
                closure_custom_output => $self->can('custom_sap_output'),
                closure_custom_perfdata => $self->can('custom_sap_perfdata'),
                closure_custom_threshold_check => $self->can('custom_qsap_threshold'),
            }
        },
        { label => 'out-traffic', nlabel => 'sap.traffic.out.bitspersecond', set => {
                key_values => [ { name => 'out', diff => 1 }, { name => 'display' } ],
                per_second => 1,
                closure_custom_calc => $self->can('custom_sap_calc'), closure_custom_calc_extra_options => { label_ref => 'out' },
                closure_custom_output => $self->can('custom_sap_output'),
                closure_custom_perfdata => $self->can('custom_sap_perfdata'),
                closure_custom_threshold_check => $self->can('custom_sap_threshold'),
            }
        },
    ];
    
    $self->{maps_counters}->{global} = [
        { label => 'total-in-traffic', nlabel => 'sap.traffic.in.bitspersecond', set => {
                key_values => [],
                manual_keys => 1, per_second => 1, output_change_bytes => 2,
                closure_custom_calc => $self->can('custom_total_traffic_calc'), closure_custom_calc_extra_options => { label_ref => 'in' },
                closure_custom_output => $self->can('custom_total_traffic_output'),
                closure_custom_perfdata => $self->can('custom_total_traffic_perfdata'),
                closure_custom_threshold_check => $self->can('custom_total_traffic_threshold'),
            }
        },
        { label => 'total-out-traffic', nlabel => 'sap.traffic.out.bitspersecond', set => {
                key_values => [],
{'fraction_non_alphanumeric': 0.1414452573482223, 'fraction_numerical': 0.0061609549480169425, 'mean_word_length': 2.8177364037236647, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 171, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1878428', 'n_tokens_mistral': 2299, 'n_tokens_neox': 2233, 'n_words': 496}