<commit_before>################################################################################
# Copyright 2005-2014 MERETHIS
# Centreon is developped by : <NAME> and <NAME> under
# GPL Licence 2.0.
# 
# This program is free software; you can redistribute it and/or modify it under 
# the terms of the GNU General Public License as published by the Free Software 
# Foundation ; either version 2 of the License.
# 
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License along with 
# this program; if not, see <http://www.gnu.org/licenses>.
# 
# Linking this program statically or dynamically with other modules is making a 
# combined work based on this program. Thus, the terms and conditions of the GNU 
# General Public License cover the whole combination.
# 
# As a special exception, the copyright holders of this program give MERETHIS 
# permission to link this program with independent modules to produce an executable, 
# regardless of the license terms of these independent modules, and to copy and 
# distribute the resulting executable under terms of MERETHIS choice, provided that 
# MERETHIS also meet, for each linked independent module, the terms  and conditions 
# of the license of that module. An independent module is a module which is not 
# derived from this program. If you modify this program, you may extend this 
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 
# For more information : <EMAIL>
# Authors : <NAME> <<EMAIL>>
#
####################################################################################

package network::juniper::ggsn::mode::apnstats;

use base qw(centreon::plugins::mode);

use strict;
use warnings;
use centreon::plugins::values;
use centreon::plugins::statefile;
use Digest::MD5 qw(md5_hex);

my $maps_counters = {
    '000_traffic-in'   => { class => 'centreon::plugins::values', obj => undef,
                 set => {
                        key_values => [
                                        { name => 'ggsnApnUplinkBytes', diff => 1 }, { name => 'ggsnApnName' },
                                      ],
                        per_second => 1, output_change_bytes => 2,
                        output_template => 'Traffic In : %s %s/s',
                        perfdatas => [
                            { label => 'traffic_in', value => 'ggsnApnUplinkBytes_per_second', template => '%s',
                              unit => 'b', min => 0, label_extra_instance => 1, instance_use => 'ggsnApnName_absolute' },
                        ],
                    }
               },
    '001_traffic-out'   => { class => 'centreon::plugins::values', obj => undef,
                 set => {
                        key_values => [
                                        { name => 'ggsnApnDownlinkBytes', diff => 1 }, { name => 'ggsnApnName' },
                                      ],
                        per_second => 1,  output_change_bytes => 2,
                        output_template => 'Traffic Out : %s %s/s',
                        perfdatas => [
                            { label => 'traffic_out', value => 'ggsnApnDownlinkBytes_per_second', template => '%s',
                              unit => 'b', min => 0, label_extra_instance => 1, instance_use => 'ggsnApnName_absolute' },
                        ],
                    }
               },
    '004_drop-in'   => { class => 'centreon::plugins::values', obj => undef,
                 set => {
                        key_values => [
                                        { name => 'ggsnApnUplinkDrops', diff => 1 }, { name => 'ggsnApnUplinkPackets', diff => 1 }, { name => 'ggsnApnName' },
                                      ],
                        output_template => 'Drop In Packets : %s %%', threshold_use => 'drop_prct', output_use => 'drop_prct',
                        closure_custom_calc => \&custom_drop_in_calc,
                        perfdatas => [
                            { label => 'drop_in', value => 'ggsnApnUplinkDrops_absolute', template => '%s',
                              min => 0, max => 'ggsnApnUplinkPackets_absolute', label_extra_instance => 1, instance_use => 'ggsnApnName' },
                        ],
                    }
               },
    '005_drop-out'   => { class => 'centreon::plugins::values', obj => undef,
                 set => {
                        key_values => [
                                        { name => 'ggsnApnDownlinkDrops', diff => 1 }, { name => 'ggsnApnDownlinkPackets', diff => 1 }, { name => 'ggsnApnName' },
                                      ],
                        output_template => 'Drop In Packets : %s %%', threshold_use => 'drop_prct', output_use => 'drop_prct',
                        closure_custom_calc => \&custom_drop_out_calc,
                        perfdatas => [
                            { label => 'drop_out', value => 'ggsnApnDownlinkDrops_absolute', template => '%s',
                              min => 0, max => 'ggsnApnDownlinkPackets_absolute', label_extra_instance => 1, instance_use => 'ggsnApnName' },
                        ],
                    }
               },
    '006_active-pdp'   => { class => 'centreon::plugins::values', obj => undef,
                 set => {
                        key_values => [
                                        { name => 'ggsnApnActivePdpContextCount' }, { name => 'ggsnApnName' },
                                      ],
                        output_template => 'Active Pdp : %s',
                        perfdatas => [
                            { label => 'active_pdp', value => 'ggsnApnActivePdpContextCount_absolute', template => '%s', min => 0, label_extra_instance => 1, instance_use => 'ggsnApnName_absolute' },
                        ],
                    }
               },
    '007_attempted-activation-pdp'   => { class => 'centreon::plugins::values', obj => undef,
                 set => {
                        key_values => [
                                        { name => 'ggsnApnAttemptedActivation' }, { name => 'ggsnApnName' },
                                      ],
                        output_template => 'Attempted Activation Pdp : %s',
                        perfdatas => [
                            { label => 'attempted_activation_pdp', value => 'ggsnApnAttemptedActivation_absolute', template => '%s', min => 0, label_extra_instance => 1, instance_use => 'ggsnApnName_absolute' },
                        ],
                    }
               },
    '008_attempted-dyn-activation-pdp'   => { class => 'centreon::plugins::values', obj => undef,
                 set => {
                        key_values => [
                                        { name => 'ggsnApnAttemptedDynActivation' }, { name => 'ggsnApnName' },
                                      ],
                        output_template => 'Attempted Dyn Activation Pdp : %s',
                        perfdatas => [
                            { label => 'attempted_dyn_activation_pdp', value => 'ggsnApnAttemptedDynActivation_absolute', template => '%s', min => 0, label_extra_instance => 1, instance_use => 'ggsnApnName_absolute' },
                        ],
                    }
               },
    '009_attempted-deactivation-pdp'   => { class => 'centreon::plugins::values', obj => undef,
                 set => {
                        key_values => [
                                        { name => 'ggsnApnAttemptedDeactivation' }, { name => 'ggsnApnName' },
                                      ],
                        output_template => 'Attempted Deactivation Pdp : %s',
                        perfdatas => [
                            { label => 'attempted_deactivation_pdp', value => 'ggsnApnAttemptedDeactivation_absolute', template => '%s', min => 0, label_extra_instance => 1, instance_use => 'ggsnApnName_absolute' },
                        ],
                    }
               },
    '010_attempted-self-deactivation-pdp'   => { class => 'centreon::plugins::values', obj => undef,
                 set => {
                        key_values => [
                                        { name => 'ggsnApnAttemptedSelfDeactivation' }, { name => 'ggsnApnName' },
                                      ],
                        output_template => 'Attempted Self Deactivation Pdp : %s',
                        perfdatas => [
                            { label => 'attempted_self_deactivation_pdp', value => 'ggsnApnAttemptedSelfDeactivation_absolute', template => '%s', min => 0, label_extra_instance => 1, instance_use => 'ggsnApnName_absolute' },
                        ],
                    }
               },
    '011_completed-activation-pdp'   => { class => 'centreon::plugins::values', obj => undef,
                 set => {
                        key_values => [
                                        { name => 'ggsnApnCompletedActivation' }, { name => 'ggsnApnName' },
                                      ],
                        output_template => 'Completed Activation Pdp : %s',
                        perfdatas => [
                            { label => 'completed_activation_pdp', value => 'ggsnApnCompletedActivation_absolute', template => '%s', min => 0, label_extra_instance => 1, instance_use => 'ggsnApnName_absolute' },
                        ],
                    }
               },
    '012_completed-dyn-activation-pdp'   => { class => 'centreon::plugins::values', obj => undef,
                 set => {
                        key_values => [
                                        { name => 'ggsnApnCompletedDynActivation' }, { name => 'ggsnApnName' },
                                      ],
                        output_template => 'Completed Dyn Activation Pdp : %s',
                        perfdatas => [
                            { label => 'completed_dyn_activation_pdp', value => 'ggsnApnCompletedDynActivation_absolute', template => '%s', min => 0, label_extra_instance => 1, instance_use => 'ggsnApnName_absolute' },
                        ],
                    }
               },
    '013_completed-deactivation-pdp'   => { class => 'centreon::plugins::values', obj => undef,
                 set => {
                        key_values => [
                                        { name => 'ggsnApnCompletedDeactivation' }, { name => 'ggsnApnName' },
                                      ],
                        output_template => 'Completed Deactivation Pdp : %s',
                        perfdatas => [
                            { label => 'completed_deactivation_pdp', value => 'ggsnApnCompletedDeactivation_absolute', template => '%s', min => 0, label_extra_instance => 1, instance_use => 'ggsnApnName_absolute' },
                        ],
                    }
               },
    '014_completed-self-deactivation-pdp'   => { class => 'centreon::plugins::values', obj => undef,
                 set => {
                        key_values => [
                                        { name => 'ggsnApnCompletedSelfDeactivation' }, { name => 'ggsnApnName' },
                                      ],
                        output_template => 'Completed Self Deactivation Pdp : %s',
                        perfdatas => [
                            { label => 'completed_self_deactivation_pdp', value => 'ggsnApnCompletedSelfDeactivation_absolute', template => '%s', min => 0, label_extra_instance => 1, instance_use => 'ggsnApnName_absolute' },
                        ],<commit_msg>+ Finish first mode for ggsn juniper<commit_after>################################################################################
# Copyright 2005-2014 MERETHIS
# Centreon is developped by : <NAME> and <NAME> under
# GPL Licence 2.0.
# 
# This program is free software; you can redistribute it and/or modify it under 
# the terms of the GNU General Public License as published by the Free Software 
# Foundation ; either version 2 of the License.
# 
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License along with 
# this program; if not, see <http://www.gnu.org/licenses>.
# 
# Linking this program statically or dynamically with other modules is making a 
# combined work based on this program. Thus, the terms and conditions of the GNU 
# General Public License cover the whole combination.
# 
# As a special exception, the copyright holders of this program give MERETHIS 
# permission to link this program with independent modules to produce an executable, 
# regardless of the license terms of these independent modules, and to copy and 
# distribute the resulting executable under terms of MERETHIS choice, provided that 
# MERETHIS also meet, for each linked independent module, the terms  and conditions 
# of the license of that module. An independent module is a module which is not 
# derived from this program. If you modify this program, you may extend this 
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 
# For more information : <EMAIL>
# Authors : <NAME> <<EMAIL>>
#
####################################################################################

package network::juniper::ggsn::mode::apnstats;

use base qw(centreon::plugins::mode);

use strict;
use warnings;
use centreon::plugins::values;
use centreon::plugins::statefile;
use Digest::MD5 qw(md5_hex);

my $maps_counters = {
    '000_traffic-in'   => { class => 'centreon::plugins::values', obj => undef,
                 set => {
                        key_values => [
                                        { name => 'ggsnApnUplinkBytes', diff => 1 }, { name => 'ggsnApnName' },
                                      ],
                        per_second => 1, output_change_bytes => 2,
                        output_template => 'Traffic In : %s %s/s',
                        perfdatas => [
                            { label => 'traffic_in', value => 'ggsnApnUplinkBytes_per_second', template => '%s',
                              unit => 'b', min => 0, label_extra_instance => 1, instance_use => 'ggsnApnName_absolute' },
                        ],
                    }
               },
    '001_traffic-out'   => { class => 'centreon::plugins::values', obj => undef,
                 set => {
                        key_values => [
                                        { name => 'ggsnApnDownlinkBytes', diff => 1 }, { name => 'ggsnApnName' },
                                      ],
                        per_second => 1,  output_change_bytes => 2,
                        output_template => 'Traffic Out : %s %s/s',
                        perfdatas => [
                            { label => 'traffic_out', value => 'ggsnApnDownlinkBytes_per_second', template => '%s',
                              unit => 'b', min => 0, label_extra_instance => 1, instance_use => 'ggsnApnName_absolute' },
                        ],
                    }
               },
    '004_drop-in'   => { class => 'centreon::plugins::values', obj => undef,
                 set => {
                        key_values => [
                                        { name => 'ggsnApnUplinkDrops', diff => 1 }, { name => 'ggsnApnUplinkPackets', diff => 1 }, { name => 'ggsnApnName' },
                                      ],
                        output_template => 'Drop In Packets : %s %%', threshold_use => 'drop_prct', output_use => 'drop_prct',
                        closure_custom_calc => \&custom_drop_in_calc,
                        perfdatas => [
                            { label => 'drop_in', value => 'ggsnApnUplinkDrops_absolute', template => '%s',
                              min => 0, max => 'ggsnApnUplinkPackets_absolute', label_extra_instance => 1, instance_use => 'ggsnApnName' },
                        ],
                    }
               },
    '005_drop-out'   => { class => 'centreon::plugins::values', obj => undef,
                 set => {
                        key_values => [
                                        { name => 'ggsnApnDownlinkDrops', diff => 1 }, { name => 'ggsnApnDownlinkPackets', diff => 1 }, { name => 'ggsnApnName' },
                                      ],
                        output_template => 'Drop In Packets : %s %%', threshold_use => 'drop_prct', output_use => 'drop_prct',
                        closure_custom_calc => \&custom_drop_out_calc,
                        perfdatas => [
                            { label => 'drop_out', value => 'ggsnApnDownlinkDrops_absolute', template => '%s',
                              min => 0, max => 'ggsnApnDownlinkPackets_absolute', label_extra_instance => 1, instance_use => 'ggsnApnName' },
                        ],
                    }
               },
    '006_active-pdp'   => { class => 'centreon::plugins::values', obj => undef,
                 set => {
                        key_values => [
                                        { name => 'ggsnApnActivePdpContextCount', diff => 1 }, { name => 'ggsnApnName' },
                                      ],
                        output_template => 'Active Pdp : %s',
                        perfdatas => [
                            { label => 'active_pdp', value => 'ggsnApnActivePdpContextCount_absolute', template => '%s', min => 0, label_extra_instance => 1, instance_use => 'ggsnApnName_absolute' },
                        ],
                    }
               },
    '007_attempted-activation-pdp'   => { class => 'centreon::plugins::values', obj => undef,
                 set => {
                        key_values => [
                                        { name => 'ggsnApnAttemptedActivation', diff => 1 }, { name => 'ggsnApnName' },
                                      ],
                        output_template => 'Attempted Activation Pdp : %s',
                        perfdatas => [
                            { label => 'attempted_activation_pdp', value => 'ggsnApnAttemptedActivation_absolute', template => '%s', min => 0, label_extra_instance => 1, instance_use => 'ggsnApnName_absolute' },
                        ],
                    }
               },
    '008_attempted-dyn-activation-pdp'   => { class => 'centreon::plugins::values', obj => undef,
                 set => {
                        key_values => [
                                        { name => 'ggsnApnAttemptedDynActivation', diff => 1 }, { name => 'ggsnApnName' },
                                      ],
                        output_template => 'Attempted Dyn Activation Pdp : %s',
                        perfdatas => [
                            { label => 'attempted_dyn_activation_pdp', value => 'ggsnApnAttemptedDynActivation_absolute', template => '%s', min => 0, label_extra_instance => 1, instance_use => 'ggsnApnName_absolute' },
                        ],
                    }
               },
    '009_attempted-deactivation-pdp'   => { class => 'centreon::plugins::values', obj => undef,
                 set => {
                        key_values => [
                                        { name => 'ggsnApnAttemptedDeactivation', diff => 1 }, { name => 'ggsnApnName' },
                                      ],
                        output_template => 'Attempted Deactivation Pdp : %s',
                        perfdatas => [
                            { label => 'attempted_deactivation_pdp', value => 'ggsnApnAttemptedDeactivation_absolute', template => '%s', min => 0, label_extra_instance => 1, instance_use => 'ggsnApnName_absolute' },
                        ],
                    }
               },
    '010_attempted-self-deactivation-pdp'   => { class => 'centreon::plugins::values', obj => undef,
                 set => {
                        key_values => [
                                        { name => 'ggsnApnAttemptedSelfDeactivation', diff => 1 }, { name => 'ggsnApnName' },
                                      ],
                        output_template => 'Attempted Self Deactivation Pdp : %s',
                        perfdatas => [
                            { label => 'attempted_self_deactivation_pdp', value => 'ggsnApnAttemptedSelfDeactivation_absolute', template => '%s', min => 0, label_extra_instance => 1, instance_use => 'ggsnApnName_absolute' },
                        ],
                    }
               },
    '011_completed-activation-pdp'   => { class => 'centreon::plugins::values', obj => undef,
                 set => {
                        key_values => [
                                        { name => 'ggsnApnCompletedActivation', diff => 1 }, { name => 'ggsnApnName' },
                                      ],
                        output_template => 'Completed Activation Pdp : %s',
                        perfdatas => [
                            { label => 'completed_activation_pdp', value => 'ggsnApnCompletedActivation_absolute', template => '%s', min => 0, label_extra_instance => 1, instance_use => 'ggsnApnName_absolute' },
                        ],
                    }
               },
    '012_completed-dyn-activation-pdp'   => { class => 'centreon::plugins::values', obj => undef,
                 set => {
                        key_values => [
                                        { name => 'ggsnApnCompletedDynActivation', diff => 1 }, { name => 'ggsnApnName' },
                                      ],
                        output_template => 'Completed Dyn Activation Pdp : %s',
                        perfdatas => [
                            { label => 'completed_dyn_activation_pdp', value => 'ggsnApnCompletedDynActivation_absolute', template => '%s', min => 0, label_extra_instance => 1, instance_use => 'ggsnApnName_absolute' },
                        ],
                    }
               },
    '013_completed-deactivation-pdp'   => { class => 'centreon::plugins::values', obj => undef,
                 set => {
                        key_values => [
                                        { name => 'ggsnApnCompletedDeactivation', diff => 1 }, { name => 'ggsnApnName' },
                                      ],
                        output_template => 'Completed Deactivation Pdp : %s',
                        perfdatas => [
                            { label => 'completed_deactivation_pdp', value => 'ggsnApnCompletedDeactivation_absolute', template => '%s', min => 0, label_extra_instance => 1, instance_use => 'ggsnApnName_absolute' },
                        ],
                    }
               },
    '014_completed-self-deactivation-pdp'   => { class => 'centreon::plugins::values', obj => undef,
                 set => {
                        key_values => [
                                        { name => 'ggsnApnCompletedSelfDeactivation', diff => 1 }, { name => 'ggsnApnName' },
                                      ],
                        output_template => 'Completed Self Deactivation Pdp : %s',
                        perfdatas => [
                            { label => 'completed_self_deactivation_pdp', value => 'ggsnApnCompletedSelfDeactivation_absolute', template => '%s', min => 0, label_extra_instance => 1, instance_use => 'ggsnApnName_absolute' },
                        ],
{'fraction_non_alphanumeric': 0.12597304762701933, 'fraction_numerical': 0.007742529505315142, 'mean_word_length': 1.48285536159601, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 460, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 82, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5200715', 'n_tokens_mistral': 6261, 'n_tokens_neox': 5707, 'n_words': 1438}