enh(plugin)apps-pfsense-snmp metricsv2 (#2495)

This commit is contained in:
itoussies 2021-01-11 16:23:16 +01:00 committed by GitHub
parent fbc3f0f11a
commit c2056a7a26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 36 additions and 37 deletions

View File

@ -32,10 +32,9 @@ sub new {
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$options{options}->add_options(arguments =>
{
"filter-name:s" => { name => 'filter_name' },
});
$options{options}->add_options(arguments => {
'filter-name:s' => { name => 'filter_name' }
});
return $self;
}

View File

@ -34,39 +34,39 @@ sub set_counters {
];
$self->{maps_counters}->{global} = [
{ label => 'match', set => {
{ label => 'match', nlabel => 'packets.matched.persecond', set => {
key_values => [ { name => 'pfCounterMatch', per_second => 1 } ],
output_template => 'Packets Matched Filter Rule : %.2f/s',
perfdatas => [
{ label => 'match', template => '%.2f', unit => '/s', min => 0 },
],
{ label => 'match', template => '%.2f', unit => '/s', min => 0 }
]
}
},
{ label => 'badoffset', set => {
{ label => 'badoffset', nlabel => 'packets.badoffset.persecond', set => {
key_values => [ { name => 'pfCounterBadOffset', per_second => 1 } ],
output_template => 'Bad Offset Packets : %.2f/s',
perfdatas => [
{ label => 'bad_offset', template => '%.2f', unit => '/s', min => 0 },
],
{ label => 'bad_offset', template => '%.2f', unit => '/s', min => 0 }
]
}
},
{ label => 'fragment', set => {
{ label => 'fragment', nlabel => 'packets.fragmented.persecond', set => {
key_values => [ { name => 'pfCounterFragment', per_second => 1 } ],
output_template => 'Fragmented Packets : %.2f/s',
perfdatas => [
{ label => 'fragment', template => '%.2f', unit => '/s', min => 0 },
],
{ label => 'fragment', template => '%.2f', unit => '/s', min => 0 }
]
}
},
{ label => 'short', set => {
{ label => 'short', nlabem => 'packets.short.persecond', set => {
key_values => [ { name => 'pfCounterShort', per_second => 1 } ],
output_template => 'Short Packets : %.2f/s',
perfdatas => [
{ label => 'short', template => '%.2f', unit => '/s', min => 0 },
],
{ label => 'short', template => '%.2f', unit => '/s', min => 0 }
]
}
},
{ label => 'normalize', set => {
{ label => 'normalize', nlabel => 'packets.normalized.persecond',set => {
key_values => [ { name => 'pfCounterNormalize', per_second => 1 } ],
output_template => 'Normalized Packets : %.2f/s',
perfdatas => [
@ -74,14 +74,14 @@ sub set_counters {
],
}
},
{ label => 'memdrop', set => {
{ label => 'memdrop', nlabel => 'packets.memorydropped.persecond',set => {
key_values => [ { name => 'pfCounterMemDrop', per_second => 1 } ],
output_template => 'Dropped Packets Due To Memory : %.2f/s',
perfdatas => [
{ label => 'memdrop', template => '%.2f', unit => '/s', min => 0 },
],
{ label => 'memdrop', template => '%.2f', unit => '/s', min => 0 }
]
}
},
}
];
}

View File

@ -34,46 +34,46 @@ sub set_counters {
];
$self->{maps_counters}->{pfint} = [
{ label => 'traffic-in-pass', set => {
{ label => 'traffic-in-pass', nlabel => 'pass.traffic.in.bitspersecond', set => {
key_values => [ { name => 'pfInterfacesIf4BytesInPass', per_second => 1 }, { name => 'display' } ],
output_change_bytes => 2,
output_template => 'Traffic In Pass : %s %s/s',
perfdatas => [
{ label => 'traffic_in_pass', template => '%.2f',
min => 0, unit => 'b/s', label_extra_instance => 1, instance_use => 'display' },
],
min => 0, unit => 'b/s', label_extra_instance => 1, instance_use => 'display' }
]
}
},
{ label => 'traffic-out-pass', set => {
{ label => 'traffic-out-pass', nlabel => 'pass.traffic.out.bitspersecond', set => {
key_values => [ { name => 'pfInterfacesIf4BytesOutPass', per_second => 1 }, { name => 'display' } ],
output_change_bytes => 2,
output_template => 'Traffic Out Pass : %s %s/s',
perfdatas => [
{ label => 'traffic_out_pass', template => '%.2f',
min => 0, unit => 'b/s', label_extra_instance => 1, instance_use => 'display' },
],
min => 0, unit => 'b/s', label_extra_instance => 1, instance_use => 'display' }
]
}
},
{ label => 'traffic-in-block', set => {
{ label => 'traffic-in-block', nlabel => 'block.traffic.in.bitspersecond', set => {
key_values => [ { name => 'pfInterfacesIf4BytesInBlock', per_second => 1 }, { name => 'display' } ],
output_change_bytes => 2,
output_template => 'Traffic In Block : %s %s/s',
perfdatas => [
{ label => 'traffic_in_block', template => '%.2f',
min => 0, unit => 'b/s', label_extra_instance => 1, instance_use => 'display' },
],
min => 0, unit => 'b/s', label_extra_instance => 1, instance_use => 'display' }
]
}
},
{ label => 'traffic-out-block', set => {
{ label => 'traffic-out-block', nlabel => 'block.traffic.out.bitspersecond', set => {
key_values => [ { name => 'pfInterfacesIf4BytesOutBlock', per_second => 1 }, { name => 'display' } ],
output_change_bytes => 2,
output_template => 'Traffic Out Block : %s %s/s',
perfdatas => [
{ label => 'traffic_out_block', template => '%.2f',
min => 0, unit => 'b/s', label_extra_instance => 1, instance_use => 'display' },
],
min => 0, unit => 'b/s', label_extra_instance => 1, instance_use => 'display' }
]
}
},
}
];
}

View File

@ -30,12 +30,12 @@ sub new {
bless $self, $class;
$self->{version} = '0.1';
%{$self->{modes}} = (
$self->{modes} = {
'list-pfinterfaces' => 'apps::pfsense::snmp::mode::listpfinterfaces',
'packet-stats' => 'apps::pfsense::snmp::mode::packetstats',
'pfinterfaces' => 'apps::pfsense::snmp::mode::pfinterfaces',
'runtime' => 'apps::pfsense::snmp::mode::runtime',
);
'runtime' => 'apps::pfsense::snmp::mode::runtime'
};
return $self;
}