Add support for high capacity counters.

This commit is contained in:
Ramon Novoa 2017-03-15 08:46:11 +01:00
parent 7f4bbb70df
commit c957faad18
2 changed files with 93 additions and 37 deletions

View File

@ -21,6 +21,8 @@ our $DOT1DBASEPORTIFINDEX = ".1.3.6.1.2.1.17.1.4.1.2";
our $DOT1DTPFDBADDRESS = ".1.3.6.1.2.1.17.4.3.1.1";
our $DOT1DTPFDBPORT = ".1.3.6.1.2.1.17.4.3.1.2";
our $IFDESC = ".1.3.6.1.2.1.2.2.1.2";
our $IFHCINOCTECTS = ".1.3.6.1.2.1.31.1.1.1.6";
our $IFHCOUTOCTECTS = ".1.3.6.1.2.1.31.1.1.1.10";
our $IFINDEX = ".1.3.6.1.2.1.2.2.1.1";
our $IFINOCTECTS = ".1.3.6.1.2.1.2.2.1.10";
our $IFOPERSTATUS = ".1.3.6.1.2.1.2.2.1.8";
@ -48,6 +50,8 @@ our @EXPORT = qw(
$DOT1DTPFDBADDRESS
$DOT1DTPFDBPORT
$IFDESC
$IFHCINOCTECTS
$IFHCOUTOCTECTS
$IFINDEX
$IFINOCTECTS
$IFOPERSTATUS
@ -1052,6 +1056,8 @@ sub scan($) {
}
my @hosts = map { (split('/', $_))[0] } $net_addr->hostenum;
next if (scalar(@hosts) == 0);
my $step = 50.0 / scalar(@subnets) / scalar(@hosts); # The first 50% of the recon task approx.
foreach my $host (@hosts) {
@ -1293,7 +1299,7 @@ sub switch_to_switch_connectivity($$$) {
next if ($self->are_connected($switch_1, $if_name_1, $switch_2, $if_name_2));
$self->call('message', "Switch $switch_1 (if $if_name_1) is connected to switch $switch_2 (if $if_name_2).", 5);
$self->call(' / scalar(@subnets))connect_agents', $switch_1, $if_name_1, $switch_2, $if_name_2);
$self->call('connect_agents', $switch_1, $if_name_1, $switch_2, $if_name_2);
$self->mark_connected($switch_1, $if_name_1, $switch_2, $if_name_2);
# Mark switch to switch connections.

View File

@ -513,45 +513,95 @@ sub PandoraFMS::Recon::Base::create_agent($$) {
}
# Incoming traffic module.
$module_id = get_agent_module_id($self->{'dbh'}, "${if_name}_ifInOctets", $agent_id);
if ($module_id <= 0) {
my %module = ('id_tipo_modulo' => 16,
'id_modulo' => 2,
'nombre' => "${if_name}_ifInOctets",
'descripcion' => 'The total number of octets received on the interface, including framing characters.',
'id_agente' => $agent_id,
'ip_target' => $device,
'tcp_send' => 1,
'snmp_community' => $community,
'snmp_oid' => "$PandoraFMS::Recon::Base::IFINOCTECTS.$if_index");
pandora_create_module_from_hash ($self->{'pa_config'}, \%module, $self->{'dbh'});
} else {
my %module = (
'ip_target' => $device,
'snmp_community' => $community,
);
pandora_update_module_from_hash ($self->{'pa_config'}, \%module, 'id_agente_modulo', $module_id, $self->{'dbh'});
my $if_hc_in_octets = $self->snmp_get_value($device, "$PandoraFMS::Recon::Base::IFHCINOCTECTS.$if_index");
if (defined($if_hc_in_octets)) {
$module_id = get_agent_module_id($self->{'dbh'}, "${if_name}_ifHCInOctets", $agent_id);
if ($module_id <= 0) {
my %module = ('id_tipo_modulo' => 16,
'id_modulo' => 2,
'nombre' => "${if_name}_ifHCInOctets",
'descripcion' => 'The total number of octets received on the interface, including framing characters. This object is a 64-bit version of ifInOctets.',
'id_agente' => $agent_id,
'ip_target' => $device,
'tcp_send' => 1,
'snmp_community' => $community,
'snmp_oid' => "$PandoraFMS::Recon::Base::IFHCINOCTECTS.$if_index");
pandora_create_module_from_hash ($self->{'pa_config'}, \%module, $self->{'dbh'});
} else {
my %module = (
'ip_target' => $device,
'snmp_community' => $community,
);
pandora_update_module_from_hash ($self->{'pa_config'}, \%module, 'id_agente_modulo', $module_id, $self->{'dbh'});
}
}
# ifInOctets
else {
$module_id = get_agent_module_id($self->{'dbh'}, "${if_name}_ifInOctets", $agent_id);
if ($module_id <= 0) {
my %module = ('id_tipo_modulo' => 16,
'id_modulo' => 2,
'nombre' => "${if_name}_ifInOctets",
'descripcion' => 'The total number of octets received on the interface, including framing characters.',
'id_agente' => $agent_id,
'ip_target' => $device,
'tcp_send' => 1,
'snmp_community' => $community,
'snmp_oid' => "$PandoraFMS::Recon::Base::IFINOCTECTS.$if_index");
pandora_create_module_from_hash ($self->{'pa_config'}, \%module, $self->{'dbh'});
} else {
my %module = (
'ip_target' => $device,
'snmp_community' => $community,
);
pandora_update_module_from_hash ($self->{'pa_config'}, \%module, 'id_agente_modulo', $module_id, $self->{'dbh'});
}
}
# Outgoing traffic module.
$module_id = get_agent_module_id($self->{'dbh'}, "${if_name}_ifOutOctets", $agent_id);
if ($module_id <= 0) {
my %module = ('id_tipo_modulo' => 16,
'id_modulo' => 2,
'nombre' => "${if_name}_ifOutOctets",
'descripcion' => 'The total number of octets received on the interface, including framing characters.',
'id_agente' => $agent_id,
'ip_target' => $device,
'tcp_send' => 1,
'snmp_community' => $community,
'snmp_oid' => "$PandoraFMS::Recon::Base::IFOUTOCTECTS.$if_index");
pandora_create_module_from_hash ($self->{'pa_config'}, \%module, $self->{'dbh'});
} else {
my %module = (
'ip_target' => $device,
'snmp_community' => $community,
);
pandora_update_module_from_hash ($self->{'pa_config'}, \%module, 'id_agente_modulo', $module_id, $self->{'dbh'});
my $if_hc_out_octets = $self->snmp_get_value($device, "$PandoraFMS::Recon::Base::IFHCOUTOCTECTS.$if_index");
if (defined($if_hc_out_octets)) {
$module_id = get_agent_module_id($self->{'dbh'}, "${if_name}_ifHCOutOctets", $agent_id);
if ($module_id <= 0) {
my %module = ('id_tipo_modulo' => 16,
'id_modulo' => 2,
'nombre' => "${if_name}_ifHCOutOctets",
'descripcion' => 'The total number of octets received on the interface, including framing characters. This object is a 64-bit version of ifOutOctets.',
'id_agente' => $agent_id,
'ip_target' => $device,
'tcp_send' => 1,
'snmp_community' => $community,
'snmp_oid' => "$PandoraFMS::Recon::Base::IFHCOUTOCTECTS.$if_index");
pandora_create_module_from_hash ($self->{'pa_config'}, \%module, $self->{'dbh'});
} else {
my %module = (
'ip_target' => $device,
'snmp_community' => $community,
);
pandora_update_module_from_hash ($self->{'pa_config'}, \%module, 'id_agente_modulo', $module_id, $self->{'dbh'});
}
}
# ifOutOctets
else {
$module_id = get_agent_module_id($self->{'dbh'}, "${if_name}_ifOutOctets", $agent_id);
if ($module_id <= 0) {
my %module = ('id_tipo_modulo' => 16,
'id_modulo' => 2,
'nombre' => "${if_name}_ifOutOctets",
'descripcion' => 'The total number of octets received on the interface, including framing characters.',
'id_agente' => $agent_id,
'ip_target' => $device,
'tcp_send' => 1,
'snmp_community' => $community,
'snmp_oid' => "$PandoraFMS::Recon::Base::IFOUTOCTECTS.$if_index");
pandora_create_module_from_hash ($self->{'pa_config'}, \%module, $self->{'dbh'});
} else {
my %module = (
'ip_target' => $device,
'snmp_community' => $community,
);
pandora_update_module_from_hash ($self->{'pa_config'}, \%module, 'id_agente_modulo', $module_id, $self->{'dbh'});
}
}
}