interfacetable_v3t icon indicating copy to clipboard operation
interfacetable_v3t copied to clipboard

monitor an interface of a router on which I have attested an asynchronous connection 30 Mbit / 10 Mbit

Open Tontonitch opened this issue 5 years ago • 5 comments

Hi,

first of all thanks for the excellent work done with interfacetable. I use your work to successfully monitor several important interfaces of my network.

I tried to read the script but I have difficulty understanding how to modify it to be able to monitor an interface of a router on which I have attested an asynchronous connection 30 Mbit / 10 Mbit.

Can you help me somehow?

thanks Jacopo Canovi

Tontonitch avatar Oct 11 '19 10:10 Tontonitch

Hello Jacopo,

Indeed, in its current version the plugin cannot deal correctly with interfaces set with different bandwidths for in and out traffic. The bandwidth % usage will be wrong for at least one of them. Some adaptations to the scripts need to be done to add this feature.

Could you tell me some information about the router? Something like that to start: snmpwalk -c COMMUNITY -v 2c IP system

Il will also need some information about that virtual interface / connection in order to know how to find the corresponding bandwidths in the MIB.

BR, Yannick

Tontonitch avatar Oct 11 '19 10:10 Tontonitch

Thanks for the quick response.

I am attaching the result of the snmpwalk.

The router is a cisco 800 series. [snmpwalk_router.txt]

snmpwalk_router.txt

The interface is a virtual interface Dialer. I provided to set parameters bandwidth and bandwidht receive on configuration of interface Dialer.

jaio80 avatar Oct 11 '19 10:10 jaio80

I try to change from the code line 3434 in this way:

    my $bpsIn  = $grefhCurrent->{MD}->{IfStats}->{"$ifName"}->{OctetsIn} * 8;
    my $bpsOut = $grefhCurrent->{MD}->{IfStats}->{"$ifName"}->{OctetsOut} * 8;

    # bandwidth usage in percent of (configured/negotiated) interface speed
    $grefhCurrent->{If}->{$ifName}->{ifLoadExceedIfSpeed} = "false";
    if (defined $grefhCurrent->{If}->{$ifName}->{ifSpeed} and $grefhCurrent->{If}->{$ifName}->{ifSpeed} > 0) {
        #my $ifLoadIn  = 100 * $bpsIn  / $grefhCurrent->{If}->{$ifName}->{ifSpeed};
		my $ifLoadIn  = 100 * $bpsIn  / 30000000;
        #my $ifLoadOut = 100 * $bpsOut / $grefhCurrent->{If}->{$ifName}->{ifSpeed};
		my $ifLoadOut = 100 * $bpsOut / 10000000;
        $grefhCurrent->{If}->{$ifName}->{ifLoadIn}  = sprintf("%.2f", $ifLoadIn);
        $grefhCurrent->{If}->{$ifName}->{ifLoadOut} = sprintf("%.2f", $ifLoadOut);

        # Check abnormal load compared to interface speed
        if ($grefhCurrent->{If}->{$ifName}->{ifLoadIn} > 115 or $grefhCurrent->{If}->{$ifName}->{ifLoadOut} > 115) {
            logger(2, "  -> load exceeds 115% of the interface speed, related alerts and perfdata disabled");
            $grefhCurrent->{If}->{$ifName}->{ifLoadExceedIfSpeed} = "true";
        }

If I have correctly interpreted the code in that section, the percentage of incoming and outgoing traffic is calculated in relation to the speed of the interface.

In my case the speed read by the OID is unique and refers to the bandwidht parameter, not knowing which is the OID of the parameter Bandwidth receive I try to put a constant in the code.

Can it work?

jaio80 avatar Oct 11 '19 23:10 jaio80

ok .. the changes I made work regularly

jaio80 avatar Oct 21 '19 15:10 jaio80

Nice to see that you've found a solution. I've not found some time to implement something to deal with your situation yet. So if your change is generic and does not break any possible use of the current version of the plugin, you can propose a pull request to implement the feature. My first idea to have something generic was a new option to specify an interface name (regexp) and its in and out bandwidths (so manually specified). So if no news I will implement it that way when I will have some time.

Tontonitch avatar Oct 21 '19 20:10 Tontonitch