[mrtg] Cant get data

Gate gatenews at omnicast.net
Thu Aug 26 01:40:12 MEST 1999

I cant seem to get any data back from using the
/usr/lib/mrtg/contrib/portmasters/gather script. I had modified it, I'll
tack it on the end here. This is what I have in my mrtg.cfg:

Target[portmasters]: `/usr/lib/mrtg/contrib/portmasters/gather`
MaxBytes[portmasters]: 126
Unscaled[portmasters]: dwmy
Title[portmasters]: Total Users @ omnicast.net dial-up
PageTop[portmasters]: <H1>Traffic Analysis for Bud, Weis & Err
   <TR><TD>System:</TD><TD>omnicast.net dial-up ports </TD></TR>

I only get 0 data on everything, but the script shows the proper format.
here is the script after modification:


# run this script ever 5 minutes via cron with a crontab something like:
# 1,6,11,16,21,26,31,36,41,46,51,56 * * * * /home/admin/pmgraph/bin/getstats
# note that this script calls MRTG

# set the names or IP's of your Portmasters
set Portmaster1="cs0.NOTMYDOMAIN.com"
set Portmaster2="cs1.NOTMYDOMAIN.com"
set Portmaster3="cs2.NOTMYDOMAIN.com"

# set the SNMP read community of your Portmasters
set P1comm="public"
set P2comm="public"
set P3comm="public"
# Grab a user count for each Portmaster via the snmpwalk command
# You may need to use "snmpwalk -v 1" depending on your version of snmpwalk
# You may also need to grep for something other than "23"
set PM1=`snmpwalk $Portmaster1 $P1comm interfaces.ifTable.ifEntry.ifType|grep 23 |wc -l`
set PM2=`snmpwalk $Portmaster2 $P2comm interfaces.ifTable.ifEntry.ifType|grep 23 |wc -l`
set PM3=`snmpwalk $Portmaster3 $P3comm interfaces.ifTable.ifEntry.ifType|grep 23 |wc -l`

# Get a grand total of users online 
@ TOTAL=$PM1 + $PM2 + $PM3

# MRTG needs 4 lines of input to be happy, we're only interested in the 2nd 
# line and possibly the first so we fill the others with junk

# write out the various logs
# grand total of all your Portmasters
#        echo "0"    >  /home/httpd/html/status/pmgrand
#        echo $TOTAL >> /home/httpd/html/status/pmgrand
#        echo "0"    >> /home/httpd/html/status/pmgrand
#        echo "0"    >> /home/httpd/html/status/pmgrand

	echo "0"
	echo $TOTAL
	echo "0"
	echo "0"

# Portmaster #1
        echo "0"    >  /home/httpd/html/status/pm1-log
        echo $PM1   >> /home/httpd/html/status/pm1-log
        echo "time" >> /home/httpd/html/status/pm1-log
        echo "pm1"  >> /home/httpd/html/status/pm1-log

# Portmaster #2
        echo "0"    >  /home/httpd/html/status/pm2-log
        echo $PM2   >> /home/httpd/html/status/pm2-log
        echo "time" >> /home/httpd/html/status/pm2-log
        echo "pm2"  >> /home/httpd/html/status/pm2-log

# Portmaster #3
        echo "0"    >  /home/httpd/html/status/pm3-log
        echo $PM3   >> /home/httpd/html/status/pm3-log
        echo "time" >> /home/httpd/html/status/pm3-log
        echo "pm3"  >> /home/httpd/html/status/pm3-log

And that returns something like this:

[root at postal status]# /usr/lib/mrtg/contrib/portmasters/gather

Any suggestions? Thanks!

* To unsubscribe from the mrtg mailing list, send a message with the
  subject: unsubscribe to mrtg-request at list.ee.ethz.ch
* The mailing list archive is at http://www.ee.ethz.ch/~slist/mrtg

More information about the mrtg mailing list