pshankland
Posts: 3
Joined: Tue Jul 31, 2012 6:19 pm

MRTG?

Tue Jul 31, 2012 6:24 pm

Hi all,

Simple question: anyone managed to get MRTG to work?

I have used "sudo apt-get install mrtg snmpd" and everything appeared to work. However when I run "cfgmaker public@localhost > /etc/mrtg.cfg" I get the following:

Code: Select all

Subroutine SNMP_Session::pack_sockaddr_in6 redefined at /usr/share/perl/5.14/Exporter.pm line 67.
 at /usr/share/perl5/SNMP_Session.pm line 149
Subroutine SNMP_Session::unpack_sockaddr_in6 redefined at /usr/share/perl/5.14/Exporter.pm line 67.
 at /usr/share/perl5/SNMP_Session.pm line 149
Subroutine SNMP_Session::sockaddr_in6 redefined at /usr/share/perl/5.14/Exporter.pm line 67.
 at /usr/share/perl5/SNMP_Session.pm line 149
Subroutine SNMPv1_Session::pack_sockaddr_in6 redefined at /usr/share/perl/5.14/Exporter.pm line 67.
 at /usr/share/perl5/SNMP_Session.pm line 608
Subroutine SNMPv1_Session::unpack_sockaddr_in6 redefined at /usr/share/perl/5.14/Exporter.pm line 67.
 at /usr/share/perl5/SNMP_Session.pm line 608
Subroutine SNMPv1_Session::sockaddr_in6 redefined at /usr/share/perl/5.14/Exporter.pm line 67.
 at /usr/share/perl5/SNMP_Session.pm line 608
--base: Get Device Info on public@localhost:
--base: Vendor Id: Unknown Vendor - 1.3.6.1.4.1.8072.3.2.10
--base: Populating confcache
--base: Get Interface Info
--base: Walking ifIndex
--snpd:   public@localhost: -> 1 -> ifIndex = 1
--snpd:   public@localhost: -> 2 -> ifIndex = 2
--base: Walking ifType
--snpd:   public@localhost: -> 1 -> ifType = 24
--snpd:   public@localhost: -> 2 -> ifType = 6
--base: Walking ifAdminStatus
--snpd:   public@localhost: -> 1 -> ifAdminStatus = 1
--snpd:   public@localhost: -> 2 -> ifAdminStatus = 1
--base: Walking ifOperStatus
--snpd:   public@localhost: -> 1 -> ifOperStatus = 1
--snpd:   public@localhost: -> 2 -> ifOperStatus = 1
--base: Walking ifMtu
--snpd:   public@localhost: -> 1 -> ifMtu = 16436
--snpd:   public@localhost: -> 2 -> ifMtu = 1500
--base: Walking ifSpeed
--snpd:   public@localhost: -> 1 -> ifSpeed = 10000000
--snpd:   public@localhost: -> 2 -> ifSpeed = 100000000
And then "indexmaker /etc/mrtg.cfg > /var/www/mrtg/index.html" I get:

Code: Select all

Subroutine SNMP_Session::pack_sockaddr_in6 redefined at /usr/share/perl/5.14/Exporter.pm line 67.
 at /usr/share/perl5/SNMP_Session.pm line 149
Subroutine SNMP_Session::unpack_sockaddr_in6 redefined at /usr/share/perl/5.14/Exporter.pm line 67.
 at /usr/share/perl5/SNMP_Session.pm line 149
Subroutine SNMP_Session::sockaddr_in6 redefined at /usr/share/perl/5.14/Exporter.pm line 67.
 at /usr/share/perl5/SNMP_Session.pm line 149
Subroutine SNMPv1_Session::pack_sockaddr_in6 redefined at /usr/share/perl/5.14/Exporter.pm line 67.
 at /usr/share/perl5/SNMP_Session.pm line 608
Subroutine SNMPv1_Session::unpack_sockaddr_in6 redefined at /usr/share/perl/5.14/Exporter.pm line 67.
 at /usr/share/perl5/SNMP_Session.pm line 608
Subroutine SNMPv1_Session::sockaddr_in6 redefined at /usr/share/perl/5.14/Exporter.pm line 67.
 at /usr/share/perl5/SNMP_Session.pm line 608
I have installed apache and php5 and they both appear to work.

Any suggestions?

Thanks.
Pete.

dvaad
Posts: 11
Joined: Mon Jul 16, 2012 1:47 pm

Re: MRTG?

Tue Jul 31, 2012 7:11 pm

pshankland wrote: Any suggestions?
My useless suggestion is to use rrdtool instead of mrtg. It is written by the same guy, but rrdtool was created to overcome the limitations of mrtg.

The interface to rrdtool is generic, you only need to be able to create shell/perl/python scripts to provide current values on a period basis.

Take a look - http://oss.oetiker.ch/rrdtool/gallery/index.en.html
dan.schudel@gmail.com - Google+ http://goo.gl/qferZ - 919-636-9529

oakfan52
Posts: 13
Joined: Fri Aug 03, 2012 6:19 pm

Re: MRTG?

Fri Aug 03, 2012 8:06 pm

Has anyone tried to get cacti running yet?

FX4
Posts: 64
Joined: Fri Jul 27, 2012 2:39 pm

Re: MRTG?

Fri Aug 03, 2012 10:08 pm

LOL, I was thinking the same thing. I am watching this thread closely.

oakfan52
Posts: 13
Joined: Fri Aug 03, 2012 6:19 pm

Re: MRTG?

Fri Aug 03, 2012 10:21 pm

FX4 wrote:LOL, I was thinking the same thing. I am watching this thread closely.
I don't really need it on my pi but I have played with it for a few years. Maybe i'll give it a shot after I move my root fs to my external usb drive.

FX4
Posts: 64
Joined: Fri Jul 27, 2012 2:39 pm

Re: MRTG?

Fri Aug 03, 2012 11:20 pm

I was thinking about buying a Pi just for network monitoring. I'm not entirely certain it has the umph to do the job.

irosaurus
Posts: 3
Joined: Tue Aug 07, 2012 2:17 pm

Re: MRTG?

Tue Aug 07, 2012 2:20 pm

try this patch, worked for me:

Code: Select all

--- SNMP_Session.pm.orig	2011-06-01 15:48:06.000000000 +0200
+++ SNMP_Session.pm	2011-06-01 15:56:19.000000000 +0200
@@ -146,7 +146,7 @@
 
     if (eval {local $SIG{__DIE__};require Socket6;} &&
        eval {local $SIG{__DIE__};require IO::Socket::INET6; IO::Socket::INET6->VERSION("1.26");}) {
-	import Socket6;
+	Socket6->import(qw(inet_pton getaddrinfo));
 	$ipv6_addr_len = length(pack_sockaddr_in6(161, inet_pton(AF_INET6(), "::1")));
 	$SNMP_Session::ipv6available = 1;
     }
@@ -605,7 +605,7 @@
 BEGIN {
     if($SNMP_Session::ipv6available) {
 	import IO::Socket::INET6;
-	import Socket6;
+	Socket6->import(qw(inet_pton getaddrinfo));
     }
 }
by the way, Nagios is running fine - if anyone is interested in testing it ;)

Cheers iro

irosaurus
Posts: 3
Joined: Tue Aug 07, 2012 2:17 pm

Re: MRTG?

Tue Aug 07, 2012 4:08 pm

sorry forgot to add the path of SNMP_Session.pm.

you can find it over here:
/usr/share/perl5/SNMP_Session.pm

found the solution somewhere in the bug section of ubuntu^^ there was one as well in the debian bug section, but that one didn't fixed the complete error, only a part of it.

Cheers iro

oakfan52
Posts: 13
Joined: Fri Aug 03, 2012 6:19 pm

Re: MRTG?

Tue Aug 07, 2012 4:43 pm

I also got cacto install light night. pretty easy. apt-get cacti. I am running lighttpd. All I have have had to do manually so far is ass an alias in lighttpd.conf to the cacti site '/usr/share/cacti/site'.

stevecody
Posts: 8
Joined: Thu Jul 26, 2012 4:13 pm

Re: MRTG?

Wed Aug 08, 2012 11:16 am

Hey guys,

I recently installed mrtg in the same manner as the original post. I also have the perl module errors. However, my MRTG is working fine. You can check it out here: http://codycrew.net/mrtg

This is hosted on my Raspberry Pi running Apache and MRTG and that's about it. I do intend to research the PM errors and will probably try the patch suggested above.

Steve
Steve Cody
RPi B rev 1 - running Apache/MRTG - http://codycrew.net/mrtg (Network utilization, temperature probes)
RPi B rev 2 - for experimenting
RPi B+ - for experimenting
RPi2 - Security Camera using RPI noIR camera and motion

Elect
Posts: 11
Joined: Tue Aug 07, 2012 7:48 am
Location: Netherlands

Re: MRTG?

Wed Aug 08, 2012 6:03 pm

I'm trying to achive a working result, but I'm stuck. What i've done so far;

Code: Select all

sudo apt-get install mrtg snmpd
After that i'm tring to create to config:

Code: Select all

pi@raspberrypi / $ cfgmaker public@localhost > /etc/mrtg.cfg
--base: Get Device Info on public@localhost:
--base: Vendor Id: Unknown Vendor - 1.3.6.1.4.1.8072.3.2.10
--base: Populating confcache
--base: Get Interface Info
--base: Walking ifIndex
--base: Walking ifType
--base: Walking ifAdminStatus
--base: Walking ifOperStatus
--base: Walking ifMtu
--base: Walking ifSpeed
This looks allright, but the /etc/mrtg.cfg has no information about the snmpd server/port? I assume this should?

Code: Select all

# Created by
# /usr/bin/cfgmaker public@localhost


### Global Config Options

#  for UNIX
# WorkDir: /home/http/mrtg

#  for Debian
WorkDir: /var/www/mrtg

#  or for NT
# WorkDir: c:\mrtgdata

### Global Defaults

#  to get bits instead of bytes and graphs growing to the right
# Options[_]: growright, bits

EnableIPv6: no

######################################################################
# System: raspberrypi
# Description: Linux raspberrypi 3.1.9+ #242 PREEMPT Wed Aug 1 19:47:22 BST 2012 armv6l
# Contact: Me <me@example.org>
# Location: Sitting on the Dock of the Bay
######################################################################
Running the indexmaker returns a 'ERROR: did not find any matching data in cfg file'

Code: Select all

pi@raspberrypi / $ indexmaker /etc/mrtg.cfg > /var/www/mrtg/index.html
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = (unset),
	LC_ALL = (unset),
	LC_CTYPE = "UTF-8",
	LANG = "en_GB.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
ERROR: did not find any matching data in cfg file

Elect
Posts: 11
Joined: Tue Aug 07, 2012 7:48 am
Location: Netherlands

Re: MRTG?

Sat Aug 11, 2012 7:16 am

For anyone still interested in generating MRTG network bandwith images, i've written a tutorial for it:

http://piserv.nl/blog/index.php/mrtg-on ... pberry-pi/

n00badmin
Posts: 46
Joined: Tue Aug 14, 2012 2:09 pm

Re: MRTG?

Wed Aug 15, 2012 7:49 am

Just got my RPi and installed Cacti.

I'll whip up a guide and post it asap.
n00badmin
CCNA JNCIA
www.n00blab.com

n00badmin
Posts: 46
Joined: Tue Aug 14, 2012 2:09 pm

Re: MRTG?

Wed Aug 15, 2012 9:57 am

k, will stop contributing to the hijacking of this thread :)

cacti guide/topic :
http://www.raspberrypi.org/phpBB3/viewt ... 80#p150380
n00badmin
CCNA JNCIA
www.n00blab.com

pshankland
Posts: 3
Joined: Tue Jul 31, 2012 6:19 pm

Re: MRTG?

Wed Aug 15, 2012 5:52 pm

irosaurus wrote:try this patch, worked for me:

Code: Select all

--- SNMP_Session.pm.orig	2011-06-01 15:48:06.000000000 +0200
+++ SNMP_Session.pm	2011-06-01 15:56:19.000000000 +0200
@@ -146,7 +146,7 @@
 
     if (eval {local $SIG{__DIE__};require Socket6;} &&
        eval {local $SIG{__DIE__};require IO::Socket::INET6; IO::Socket::INET6->VERSION("1.26");}) {
-	import Socket6;
+	Socket6->import(qw(inet_pton getaddrinfo));
 	$ipv6_addr_len = length(pack_sockaddr_in6(161, inet_pton(AF_INET6(), "::1")));
 	$SNMP_Session::ipv6available = 1;
     }
@@ -605,7 +605,7 @@
 BEGIN {
     if($SNMP_Session::ipv6available) {
 	import IO::Socket::INET6;
-	import Socket6;
+	Socket6->import(qw(inet_pton getaddrinfo));
     }
 }
by the way, Nagios is running fine - if anyone is interested in testing it ;)

Cheers iro
How would I apply this patch?

n00badmin
Posts: 46
Joined: Tue Aug 14, 2012 2:09 pm

Re: MRTG?

Thu Aug 16, 2012 4:23 pm

Hey Pete,

Just some observations from my experiences thus far with SNMPD on my RPi that I poll using Cacti....(while you figure out that patch as it looks like it would work for you too)

Everything was fine using the default snmpd.conf file as the agentadress is set to:
agentAddress udp:127.0.0.1:161

Once I changed the config as I have many times before on Ubuntu machines it broke. When I uncommented the line:

agentAddress udp:161,udp6:[::1]:161

SNMPD failed to start and /var/log/daemon.log showed various errors regarding ipv6:

Aug 16 10:26:47 raspberrypi snmpd[4234]: could not open /proc/net/if_inet6
Aug 16 10:26:47 raspberrypi snmpd[4234]: payload OID: prNames
Aug 16 10:26:47 raspberrypi snmpd[4234]: /etc/snmp/snmpd.conf: line 143: Error: unknown payload OID
Aug 16 10:26:47 raspberrypi snmpd[4234]: Unknown payload OID: prNames
Aug 16 10:26:47 raspberrypi snmpd[4234]: /etc/snmp/snmpd.conf: line 143: Error: Unknown payload OID
Aug 16 10:26:47 raspberrypi snmpd[4234]: payload OID: prErrMessage
Aug 16 10:26:47 raspberrypi snmpd[4234]: /etc/snmp/snmpd.conf: line 143: Error: unknown payload OID
Aug 16 10:26:47 raspberrypi snmpd[4234]: Unknown payload OID: prErrMessage
Aug 16 10:26:47 raspberrypi snmpd[4234]: /etc/snmp/snmpd.conf: line 143: Error: Unknown payload OID
Aug 16 10:26:47 raspberrypi snmpd[4234]: trigger OID: prErrorFlag
Aug 16 10:26:47 raspberrypi snmpd[4234]: /etc/snmp/snmpd.conf: line 143: Error: unknown monitor OID
Aug 16 10:26:47 raspberrypi snmpd[4234]: payload OID: memErrorName

etc etc etc....

with it eventually ending in:

raspberrypi snmpd[4234]: Server Exiting with code 1

netstat -l confirmed no snmp port listening

Anyway, long story longer, i have no use for anything ipv6 in the shortterm so i changed the agent address to :

agentAddress udp:161

sudo service snmpd restart

and voila shes cooking again......


I don't use MTRG but it appears the errors you are getting are also related to ipv6 specific lines of code.....so maybe have a look at your /etc/snmp/snmp.conf file and check out the agent address you have set....
n00badmin
CCNA JNCIA
www.n00blab.com

pshankland
Posts: 3
Joined: Tue Jul 31, 2012 6:19 pm

Re: MRTG?

Fri Aug 17, 2012 12:54 pm

Thanks for the reply n00badmin. Will try modifying the snmpd config file as suggested and post back the results.

Pete.

irosaurus
Posts: 3
Joined: Tue Aug 07, 2012 2:17 pm

Re: MRTG?

Tue Oct 23, 2012 8:12 am

Hey everybody,

I wrote a tutorial, too. For all german speaking people: http://kopfkino.irosaurus.com/tutorial- ... an-wheezy/

for all others: I think you can get it if you use google translator, that should work for you :D
http://translate.google.com/translate?h ... ian-wheezy

I also explained how to fix that annoying perl bug.

cheers iro
Last edited by irosaurus on Tue Jun 18, 2013 1:10 pm, edited 1 time in total.

loonix
Posts: 5
Joined: Wed Oct 03, 2012 5:07 pm

Re: MRTG?

Wed Nov 28, 2012 4:29 am

irosaurus wrote:try this patch, worked for me:

Code: Select all

--- SNMP_Session.pm.orig	2011-06-01 15:48:06.000000000 +0200
+++ SNMP_Session.pm	2011-06-01 15:56:19.000000000 +0200
@@ -146,7 +146,7 @@
 
     if (eval {local $SIG{__DIE__};require Socket6;} &&
        eval {local $SIG{__DIE__};require IO::Socket::INET6; IO::Socket::INET6->VERSION("1.26");}) {
-	import Socket6;
+	Socket6->import(qw(inet_pton getaddrinfo));
 	$ipv6_addr_len = length(pack_sockaddr_in6(161, inet_pton(AF_INET6(), "::1")));
 	$SNMP_Session::ipv6available = 1;
     }
@@ -605,7 +605,7 @@
 BEGIN {
     if($SNMP_Session::ipv6available) {
 	import IO::Socket::INET6;
-	import Socket6;
+	Socket6->import(qw(inet_pton getaddrinfo));
     }
 }
by the way, Nagios is running fine - if anyone is interested in testing it ;)

Cheers iro
Hi all:

I made a one liner to fix this issue

Code: Select all

sed -i 's|import\ Socket6;|Socket6->import\(qw\(inet_pton\ getaddrinfo\)\);|' /usr/share/perl5/SNMP_Session.pm
Cheers

AR aka. loonix

momma
Posts: 1
Joined: Fri Dec 28, 2012 2:53 pm

Re: MRTG?

Fri Dec 28, 2012 3:05 pm

loonix, your fix worked for me fine, thank you. MRTG is now working fine on my Raspbian, at least for load average. I'll try and add other stats data soon.

mythryll
Posts: 6
Joined: Fri Mar 22, 2013 11:25 am

Re: MRTG?

Fri Mar 22, 2013 11:35 am

The problem with mrtg does have to do with support of ipv6 for snmp libraries used in mrtg.
Here are two pages which can help you with that:
1)http://oss.oetiker.ch/mrtg-trac/ticket/134
2) http://tasos.pavta.com/myblog/2012/06/1 ... redefined/
I will check the sed oneliner to see if it's the same thing. Thank you for that.
About the rrdtool and mrtg, they are not for the same thing. Mrtg does more than graph data (collect, store, graph). You can replace any part of that with your own tool, it's still mrtg. If you want to take a deeper look in how mrtg could work with rrd (storing the data in rrd format and no creation of png files except on demand) you could take a look at Steve Shipway's book and relative software, check here:
http://www.steveshipway.org/software/.
Tobi has promised a long time ago that mrtg v3 will work with rrd but I guess it's not time yet.

sander2
Posts: 60
Joined: Wed Jul 04, 2012 2:22 pm

Re: MRTG?

Sun Oct 19, 2014 9:55 pm

loonix wrote: Hi all:

I made a one liner to fix this issue

Code: Select all

sed -i 's|import\ Socket6;|Socket6->import\(qw\(inet_pton\ getaddrinfo\)\);|' /usr/share/perl5/SNMP_Session.pm
Cheers

AR aka. loonix
Wow ... that worked! (With sudo added before the sed)

Thank you.

Return to “Networking and servers”