[mrtg] Clue, please, for (slightly) complex target (Niall O'Reilly)

Edwin A. Epstein III ed at rhinobee.com
Thu Nov 2 21:06:24 CET 2017


Hi Niall,

It does sound like you have a rather complex target. I too refer to most, if not all, of my interfaces by name with "\", but I usually convert everything to numeric OIDs. I'll just assume those work normally elsewhere. If I understand you correctly you want:
IN = IF3  |  OUT = IF2 + IF3

I double checked the literature and have some ideas as to what went wrong. 

  "Target[limes.no8.be_aggregate-dn]: ifHCInOctets.\ether3-uplink:public at limes.no8.be:::::2&ifHCInOctets.\ether2-uplink:public at limes.no8.be:::::2 
  + ifHCInOctets.\ether3-uplink:public at limes.no8.be:::::2"

You can't use the math operation here is my first guess. It's:

  IF-1-IN & IF-1-OUT +-/* MATH

It's not adding your two interfaces together for OUT, but would add it to both IN and OUT. That's assuming that it can understand to SNMP poll your OID for the value in the first place. Most likely it passed that to Perl directly, and Perl understandably barfed. Turn on debugging by calling MRTG differently in rc.d, or your cron job. Ours is custom:

  daemon_flags="--user _mrtg --group _mrtg --confcache-file /etc/mrtg/mrtg.ok --pid-file /var/run/mrtg.pid --logging /var/log/mrtg.log --debug=conf,base /etc/mrtg/mrtg.cfg"

The last part is what gets you the error output you are looking for. It will tell you during polling, and when it attempts to graph the target. My guess is that the math is performed during its graphing stage and not the polling stage. I often see errors related to the math in this stage when SNMP failed or returns null.  

This sounds like a job for a custom collector, which is easier than it sounds. Instead of defining OIDs and math, you define an external command called with arguments:

  Target[limes.no8.be_aggregate-dn]: `/usr/bin/perl /etc/mrtg/ipv6.uplink.relative.stats limes.no8.be_aggregate-dn'

Your perl script will snmpwalk your three OIDs, perform the required calculations, and then provide output to the MRTG script with values on seperate lines. Your output might look like 
  12400341
  1208581838
  1:00PM  up 19 days, 19:34
  limes.no8.be_aggregate-dn

That's my best guess as to what you can do to make it work.


Sincerely, 

Edwin A Epstein, III 
Rhinobee Internet Services 
707.237.7504 ext 209 
707.737.0288 Mobile

----- Original Message -----
From: "mrtg-request" <mrtg-request at lists.oetiker.ch>
To: "mrtg" <mrtg at lists.oetiker.ch>
Sent: Thursday, November 2, 2017 4:00:02 AM
Subject: mrtg Digest, Vol 123, Issue 1

Send mrtg mailing list submissions to
	mrtg at lists.oetiker.ch

To subscribe or unsubscribe via the World Wide Web, visit
	https://lists.oetiker.ch/cgi-bin/listinfo/mrtg
or, via email, send a message with subject or body 'help' to
	mrtg-request at lists.oetiker.ch

You can reach the person managing the list at
	mrtg-owner at lists.oetiker.ch

When replying, please edit your Subject line so it is more specific
than "Re: Contents of mrtg digest..."


Today's Topics:

   1. Clue, please, for (slightly) complex target (Niall O'Reilly)


----------------------------------------------------------------------

Message: 1
Date: Thu, 02 Nov 2017 00:30:21 +0000
From: "Niall O'Reilly" <niall.oreilly at ucd.ie>
To: mrtg at lists.oetiker.ch
Subject: [mrtg] Clue, please, for (slightly) complex target
Message-ID: <6AF1F4D2-0B6F-4E9F-BBE1-34920F44592C at ucd.ie>
Content-Type: text/plain; format=flowed

Hello.

I have a box with two uplinks, one configured for IPv4 only, the other 
for IPv6 only.
I'ld like to show IPv6 traffic in relation to total.  The current 
version of my
target expression isn't what I need.  I'm seeing the log file with four 
zeroes in
each row, except for the expected '-1 -1' in the top one.

Because of the characteristics of the box, I have to refer to interfaces 
by description
rather than by name, so I'm using the '\' prefix.  This works for the 
targets generated
by cfgmaker, where the OID is implicit.

My ether3-uplink is the IPv6 one, and ether2-uplink carries IPv4.

I'm trying to plot IPv6 ("IN") traffic, aggregate IPv6 + IPv4 traffic 
("OUT") and the
relative percentage, with one target for inward traffic, another for 
outward.

Here are the relevant fragments of my configuration file for the inward 
direction.

LoadMIBs: /usr/local/share/snmp/mibs/IF-MIB.txt

Target[limes.no8.be_aggregate-dn]: 
ifHCInOctets.\ether3-uplink:public at limes.no8.be:::::2&ifHCInOctets.\ether2-uplink:public at limes.no8.be:::::2 
+ ifHCInOctets.\ether3-uplink:public at limes.no8.be:::::2

Options[limes.no8.be_aggregate-dn]: growright,bits,dorelpercent

Clue, please, anyone?

Thanks in anticipation.

Niall O'Reilly



------------------------------

Subject: Digest Footer

_______________________________________________
mrtg mailing list
mrtg at lists.oetiker.ch
https://lists.oetiker.ch/cgi-bin/listinfo/mrtg


------------------------------

End of mrtg Digest, Vol 123, Issue 1
************************************
(null)



More information about the mrtg mailing list