Please perform the following steps in roughly the order shown. Be sure to test each part before blundering onward. Some knowledge of MSDOS command line operations is assumed. You will need a long file name compatible UNZIP program and a text editor. PKUNZIP 2.04 will not work.
Test with:
ECHO PRINT "Hello World" | PERLIt should display Hello World and not hang on exit. If you get some kind of "Cannot find Perl" error message, fix your PATH= line your AUTOEXEC.BAT file.
c:/mrtg-2.9.21/bin\rateup.exeThis results in an "Invalid command or filename" error message later when MRTG is run. Almost all the email I have received involve this error message.
The fix is to add 4 lines near the bottom of:
c:\perl\lib\findbin.pm$RealBin = abs_path($RealBin) if($RealBin); ## existing line
Of course, make a backup of findbin.pm before tweaking.
That's a "tilde" after the equal sign in the $Bin line.
If you are unable to use a text editor, you can download a fixed copy of FindBin.pm from here.
A new feature of Active State Perl 5.6.1 build 633 is that it no longer
belches "Invalid command or filename". It now hangs the perl program,
locks up the MSDOS window, prevents one from removing the mrtg.cfg_l
lock file, and requires a Windoze reboot to recover.
Copy MRTG-2.9.21.ZIP to C:\ (root directory) of your
hard disk. When this is unzipped, it will create a directory called C:\MRTG-2.9.21.
This is where most everything will be installed. Do not rename this directory.
If the MRTG version changes, change the version references in this document.
Run:
C:
CD \
UNZIP -d MRTG-2.9.21.ZIP
Verify that C:\MRTG-2.9.21 directory was properly created and includes
various sub directories.
You may want to erase the ZIP file with:
DEL MRTG-2.9.21.ZIPThe MRTG program is now installed.
------------------- cut here ----------------------------------Run it with:
use BER;
use SNMP_Session;
# Return the uptime of the localhost to test SNMP
$host = "localhost";
$community = "public";
$oid = encode_oid(1,3,6,1,2,1,1,3,0); # Uptime
$session = SNMP_Session->open ($host, $community, 161)
|| die "Can't open SNMP session to localhost";
$session->get_request_response ($oid);
($bindings) = $session->decode_get_response ($session->{pdu_buffer});
($binding,$bindings) = &decode_sequence ($bindings);
($oid,$value) = &decode_by_template ($binding, "%O%@");
print &pretty_print($oid)," => ", &pretty_print ($value), "\n";
------------------- cut here -----------------------------------
CD \MRTG-2.9.21\LIB\MRTG2
PERL UPTIME.PL
It should display the uptime of your machine. If it does NOT work,
you may not have SNMP properly installed on your Windows machine.
127.0.0.1 localhostnear the top. This file may already exist and may have other entries. The localhost line must be present.
Open an MSDOS window and run:
PING LOCALHOSTIt should return something like:
Pinging karma.learnbydestroying.com [127.0.0.1] with 32 bytes of data:Localhost must work in order to monitor your own traffic.
Reply from 127.0.0.1: bytes=32 time=1ms TTL=128
Reply from 127.0.0.1: bytes=32 time=1ms TTL=128
Reply from 127.0.0.1: bytes=32 time=1ms TTL=128
Reply from 127.0.0.1: bytes=32 time=1ms TTL=128
C:This should fill the screen with something like:
CD \MRTG-2.9.21\BIN
PERL CFGMAKER public@localhost
Target[localhost.2]: 2:public@localhostTo generate this output requires that PERL SNMP and W95/98/ME networking are working. Troubleshoot according to the error messages generated.
MaxBytes[localhost.2]: 10000
Title[localhost.2]: JEFFLIEB (mg130-151.ricochet.net): PPP Adapter.
PageTop[localhost.2]: <H1>Traffic Analysis for PPP Adapter.
<H1>
<TABLE>
<TR><TD>System:</TD><TD>JEFFLIEB in Santa Cruz</TD></TR>
<TR><TD>Maintainer:</TD><TD>Jeff Liebermann</TD></TR>
<TR><TD>Interface:</TD><TD>PPP Adapter. (2)</TD></TR>
<TR><TD>IP:</TD><TD>mg130-151.ricochet.net (204.179.130.151)</TD></TR>
<TR><TD>Max Speed:</TD>
<TD>10000.0 Bytes/s (ethernetCsmacd)</TD></TR>
</TABLE>
Note that the output will change depending upon which network interface (PPP, ethernet) is active and which ISP is active. Try it connecting to the internet via various ISP's and note the differences. When it looks reasonable, run:
PERL CFGMAKER public@localhost > MRTG.CFGYou may find a problem with the MaxBytes: line. For some unknown reason, my systems decided that the MaxBytes: of my radio modem was 1200 Bytes/sec. I edited the above MRTG.CFG file and increased the speed to an overly optimistic 10,000 Bytes/sec.
WorkDir: C:\InetPub\wwwroot\mrtgNote the space after the comma in the Options[_] line. This is required. Make sure that the WorkDir directory exists. There should be no spaces between the left margin and the various entries.
Options[_]: growright, unknaszero
WithPeak[_]: wmy
If you are not running a local web server, keep it simple and instead use just:
WorkDir: C:\MRTGDATACreate a corresponding empty C:\MRTGDATA directory.
Options[_]: growright, unknaszero
WithPeak[_]: wmy
COPY C:\MRTG-2.9.21\IMAGES\*.* C:\MRTGDATAIt should say 8 files copied.
C:In earlier versions, you may get some errors about "Can't remove ..." This is normal. You should not get these errors in MRTG 2.9.17 and above. Run the above command line twice again until the errors disappear. Check the WorkDir for the output files. If you get one or more "Bad command or filename" errors, or Perl just hangs requiring a reboot to recover, go to the section labeled "Fix a Perl Bug" and follow the instructions.
CD \MRTG-2.9.21\BIN
PERL MRTG MRTG.CFG
You should see a familiar MRTG page with 3ea graphs. There will probably be no data to graph at this time. This is normal.C:\MRTGDATA\localhost_12345678.html
RunAsDaemon: YesOpen an MSDOS window. From the command line, run:
Interval: 5
CD \MRTG-2.9.21\BINYou should get the message:
PERL MRTG MRTG.CFG
Daemonizing MRTG...In past versions, MRTG would display an obnoxious windows box every time MRTG runs. This was fixed in MRTG version 2.9.17 (hurrah).
Do Not close this window. Or MRTG will die
To stop MRTG, open the window labeled PERL, and hit <ctrl>C or <ctrl><Break>.
If you make changes to mrtg.cfg, you should stop MRTG and restart.
Backup your existing registry with:
CD \WINDOWSFor Windows 98 and Windows ME, cut and save the following as SNMP.REG in the C:\MRTG-2.9.21\BIN directory.
ATTRIB -r -h -s SYSTEM.DAT
COPY SYSTEM.DAT SYSTEM.OLD
------------------------ cut here -------------------------
REGEDIT4
[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\SNMP]
[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\SNMP\Parameters]
[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\SNMP\Parameters\EnableAuthenticationTraps]
"switch"=hex:01,00,00,00
[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\SNMP\Parameters\ExtensionAgents]
"1"="SOFTWARE\\Microsoft\\RFC1156Agent\\CurrentVersion"
[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\SNMP\Parameters\PermittedManagers]
[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\SNMP\Parameters\TrapConfiguration]
[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\SNMP\Parameters\RFC1156Agent]
"sysContact"="Your Name Here"
"sysLocation"="Your Location Here"
"sysServices"=hex:4c,00,00,00
[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\SNMP\Parameters\ValidCommunities]
"1"="public"
------------------------ cut here -------------------------For Windows 95, cut and save the following as SNMP.REG in the C:\MRTG-2.9.21\BIN directory.
------------------------ cut here -------------------------Edit the file as required. I suggest you leave the sysServices and Communities alone.
REGEDIT4
[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\SNMP\Parameters\RFC1156Agent]
"sysContact"="Your Name Here"
"sysLocation"="Your Location Here"
"sysServices"=hex:4c,00,00,00
[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\SNMP\Parameters\ValidCommunities]
"1"="public"
------------------------ cut here -------------------------
REGEDIT SNMP.REGfrom the command line. It should say that the registry was properly updated. If you have an existing entry for localhost in your MRTG.CFG file, you will need to recreate it as the names in the header do not change automatically.
If SNMP appears to malfunctioning, try the reg files at:
http://www.wtcs.org/snmp4tpc/snmp49x.htm
which are more detailed.
If MRTG or PING causes the modem to dial out looking for a DNS nameserver, disarm the monster by turning off "Dial on Demand" or by selecting "Connect to internet via local network".
If you get a Bad Command or Filename error messages, see the section on Fix a Perl Bug.
If MRTG hangs when you run from the command line, you are using Active State 5.6.1 build 633 and have failed to properly Fix a Perl Bug. If you are unable to use a text editor, you can download a fixed copy of FindBin.pm from here.
If you get "Cannot find WorkDir" error, remove the spaces in front of the
Workdir line in mrtg.cfg.
90% of the email I receive are the result of 2 problems. Failure to
properly edit or install FindBin.pm as in Fix
a Perl Bug, and failure for SNMP to operate under the original version
of Windoze 98 (4.00.1998). The Perl bug can be fixed by following instructions.
The Windoze 98 problem is usually repaired by removing SNMP, rebooting,
and re-installing SNMP, with the Network control panel tool.
Email comments, corrections, additions and gratuities to Jeff Liebermann