Install MRTG , FreeBSD

Submitted by xwings
on June 10, 2004 - 11:01am
Title  : Install MRTG
OS     : BSD
Distro : FreeBSD
URL    : http://www.freebsd.org
Install SNMP using Ports

      # cd /usr/ports/net-mgmt/net-snmp
      # make && make install && make clean 
      
Add Two Lines into /etc/rc.conf
	
	snmpd_enable="YES"
	snmpd_flags="-a -Lsd -p /var/run/snmpd.pid"

      # chmod 444 /usr/local/etc/rc.d/snmptrapd.sh
      
Configure snmpd.conf      
      
      # snmpconf -i
	
      a. Edit snmpd.conf
      b. Choose : System Information Setup
      c. You will get 
      		   1:  The [typically physical] location of the system.
   		   2:  The contact information for the administrator
                   3:  The proper value for the sysServices object.
      d. Fill up 1 and 2. Please pay attention to option 3
      e. When finish, back to main menu and choose 2.
      f. Choose 3, a SNMPv1/SNMPv2c read-only access community name
      h. Put in community name such as, foo
      i. In hostname and network mask we enter 127.0.0.1
      j. Setup OID , leave blank
      k. Back to menu
      l. The IP address and port number that the agent will listen on.
 
Finish generate configuration file.

	# /usr/local/etc/rc.d/snmpd.sh start
	
Install MRTG using ports

      # cd /usr/ports/net-mgmt/mrtg
      # make && make install && make clean
       
	Configure file for MRTG
		# cfgmaker foo@127.0.0.1 > /usr/local/etc/mrtg/mrtg.cfg
	
	Edit /usr/local/etc/mrtg/mrtg.cfg , put in Apache Directory
	
	Adding Cron Jon
		# crontab -e
	Insert
		*/5 * * * * /usr/local/bin/mrtg /usr/local/etc/mrtg/mrtg.cfg

Launch Brower and view the file.

BEST !!!!! BEST GREATE !!!

Anonymous (not verified)
on
April 12, 2005 - 12:42pm

BEST !!!!! BEST GREATE !!!

Slight Ambiguity

theorem (not verified)
on
June 17, 2005 - 5:40am

Between steps :

k. Back to menu
l. The IP address and port number that the agent will listen on.

there is some back-tracking involved in finding this menu. Perhaps you could modify this post to include the step and recommended settings (though if you're setting up mrtg I would hope most people have an idea of good policies of settings for this!)

> Edit /usr/local/etc/mrtg/mrtg.cfg , put in Apache Directory

Somewhat ambiguious, I assume this means "Edit the 'WorkDir' definition in your MRTG config." Heads up first timers :).

Oh , crontab is added to the root user .. but I wonder if it can be added to a non-priveleged user instead ... thoughts anyone ? (does simple bandwidth monitoring need root access??)

Other than that, looks excellent !

Thanks for writing this , it helped greatly!

It can, if you use ping with

Koaps (not verified)
on
July 12, 2006 - 9:38pm

It can, if you use ping with certain settings you have to be root.
For instance, ping -i .5 -c 3 would require superuser and be a faster way to scan a class C.

This does not help at ALL!!!

thinkITover (not verified)
on
February 9, 2007 - 10:37pm

To tell you frankly this one doesn't not help me at all. I got stucked with:

# cfgmaker foo@127.0.0.1 > /usr/local/etc/mrtg/mrtg.cfg

After doing this command, I went in to edit the mrtg.cfg (as stated:

# Created by
# /usr/local/bin/cfgmaker foo@192.168.17.186

### Global Config Options

# for UNIX
# WorkDir: /home/http/mrtg
# I Did this part as the working directory because mrtg.cf is in this directory.
WorkDir: /usr/local/etc/mrtg
# I Did this even in the Apache configuration (httpd.conf) still no help at all.

# 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:
# Description:
# Contact:
# Location:
######################################################################

What is the next step in here. Could someone help me.
Need help on this one. Also could someone fix the instruction here.

cfgmaker - lack of target

jofficer (not verified)
on
January 11, 2008 - 3:15pm

Based on your posted excerpt of the mrtg.cfg, you're not actually hitting an OID, to be able to pull data.

Here is a sample excerpt from my running config. MRTG is running from a Gentoo box, and it's target is a Gentoo box as well, but the sample should apply to you as well.

The most important thing here is to recognize where you want to pull the data from.

Sample:

#-------------------------------------------------------------------

WorkDir: /var/www/localhost/htdocs/mrtg
LoadMIBs: /usr/share/snmp/mibs/UCD-SNMP-MIB.txt
Target[piggy1.cpu]:ssCpuRawUser.0&ssCpuRawUser.0:public@piggy1 + ssCpuRawSystem. 0&ssCpuRawSystem.0:public@piggy1 + ssCpuRawNice.0&ssCpuRawNice.0:public@piggy1
RouterUptime[piggy1.cpu]: public@piggy1
MaxBytes[piggy1.cpu]: 100
Title[piggy1.cpu]: Piggy/MRTG CPU Load
PageTop[piggy1.cpu]: Piggy/MRTG (mrtg host) Active CPU Load %
Unscaled[piggy1.cpu]: ymwd
ShortLegend[piggy1.cpu]: %
YLegend[piggy1.cpu]: CPU Utilization
Legend1[piggy1.cpu]: Active CPU in % (Load)
Legend2[piggy1.cpu]:
Legend3[piggy1.cpu]:
Legend4[piggy1.cpu]:
LegendI[piggy1.cpu]: Active
LegendO[piggy1.cpu]:
Options[piggy1.cpu]: growright,nopercent
#-------------------------------------------------------------------

Notice my 'Target' line. This is where, within SNMPd, it pulls data from.

generate index page

thinkITover (not verified)
on
February 9, 2007 - 10:53pm

and how can it generate an index page so that apache would display it in a browser.

indexmaker YOURCONF.cfg >

Anonymous (not verified)
on
February 20, 2007 - 12:00pm

indexmaker YOURCONF.cfg > /path/to/mrtgroot/index.html

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.