INSTALLING MRTG
Before you can install MRTG, you need to download and install Perl first.
Download MRTG to your desktop.
You also need WinZip (or another unzip utility).
Double Click the MRTG icon to unzip the file.
Navigate to the location you extracted MRTG to and notice the odd name on the folder.
Right Click on the folder and select Rename. Change the name to mrtg.
Create a new folder called on the same drive called mrtghtml.
You are now finished with the installation of MRTG.
The next step is to create a config file for the MRTG data you will collect. You can create this file with CFGMAKER.
Begin by opening a DOS Window by typing command in the Run box. Choose OK.
Navigate to the mrtg\bin directory.
This is the fun part! At this point, you must know the community string and IP address for the equipment you want to monitor. If you don't know, you most likely don't have any business monitoring it! In this document, I will use a Windows NT Server. It would work exactly the same for a router, bridge, or switch. The only difference would be the output file might include several interfaces (or ports) instead of just one. We will use the community string of public and an IP of 10.1.1.1. Substitute yours as appropriate. Also, we will name the cfg file server.cfg.
Use a name that makes sense to you and your environment.
Type the following syntax on one line as follows. (DOS may automatically wrap the text which is acceptable.)
perl cfgmaker public@10.1.1.1 --global "WorkDir: f:\mrtghtml" --output server.cfg
Hit Enter when finished. If you used the correct information, your output should look similar to the output below.
You have now created your first cfg file. For more config options also check Indexmaker. We can now move forward and start collecting data. Read further and learn how to start MRTG.
RUNNING MRTG
You are now ready to collect data with MRTG.
At the command prompt, type
perl mrtg server.cfg
substituting the name of your cfg file as needed.
You have now collected your first data. Wait about 5 minutes and run the same command again.
Navigate to the mrtghtml directory created earlier and open the web page. It should be defined as the device IP and interface number. If you did a something with multiple active interfaces, you will have many web pages.
Double click to open the web page in Internet Explorer (or your default browser).
Your web page will look close to mine. CLICK HERE. Notice the Daily Graph has the start of a graph on the left edge. Also, there is data directly below the graph which represent the traffic levels. If you scroll down to the bottom, you will find some broken picture links.
Here is how to fix them. Navigate to the \mrtg\images directory. Select all images and copy.
Navigate to the \mrtghtml directory and paste. The problem is now fixed. Refresh the web page in the browser to see the corrected image links.
MAKE MRTG RUN ALL THE TIME
Starting MRTG by hand every time you want to run it is not going to make you happy I guess.
There is a special option you can set in the MRTG configuration file so so that MRTG will not terminate after it was started. Instead it will wait for 5 minutes and then run again.
Add the option
RunAsDaemon: yes
to your mrtg.cfg file and start it with:
start /Dc:\mrtg-2.16.2\bin wperl mrtg --logging=eventlog mrtg.cfg
If you use wperl instead of perl, no console window will show. MRTG is now running in the background. If it runs into problems it will tell you so over the EventLog. To stop MRTG, open the Task Manager and terminate the wperl.exe process. If mrtg has anything to tell you these messages can be found in the event log.
If you put a shortcut with
Target: wperl mrtg --logging=eventlog mrtg.cfg
Start in: c:\mrtg-2.16.2\bin
into your start-up folder, MRTG will now start whenever you login to your NT box.
If you do not want to log into your box just to start MRTG. Have a look at http://www.firedaemon.com/mrtg-howto.html which describes a free tool to start any program as a Service. The pages gives specific instructions for MRTG users.
Additional Prerequisites
- MRTG must be installed and fully configured on the target system. In the following exercise the assumption is that MRTG is installed under c:\mrtgand all the sample files use this location.
- http://www.microsoft.com/downloads/details.aspx?FamilyID=9D467A69-57FF-4AE7-96EE-B18C4790CFFD&displaylang=en
- You must have administrative rights on the target system.
Preparation
Please complete the following steps before starting the installation:
- Copy srvany.exe and instsrv.exe to c:\mrtg-2.16.2\bin\ (your MRTG bin directory).
- Create a file called mrtg.reg anywhere on your system and paste the following content into it:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MRTG\Parameters]
"Application"="c:\\perl\\bin\\wperl.exe"
"AppParameters"="c:\\mrtg-2.16.2\\bin\\mrtg --logging=eventlog c:\\mrtg-2.16.2\\bin\\mrtg.cfg"
"AppDirectory"="c:\\mrtg-2.16.2\\bin\\"
Service Installation
Once again, assuming that MRTG is already fully installed and configured on the target system under c:\mrtg\ the following steps are necessary to setup MRTG as a service.
Using the command prompt go into the temporary directory where you unzipped the package. When there type the following command to create a service named "MRTG" in the Windows Services management console:
instsrv MRTG c:\mrtg\bin\srvany.exe
Now you need to create the App* entries required for the new service. You can do this by either right-clicking on the mrtg.reg file and selecting 'merge' or by running the following command:
regedit /s mrtg.reg
After setting up the registry entry it is time to point it to your MRTG installation. If you have installed MRTG under c:\mrtg\, you can skip this step. Open your registry editor (Start -> Run -> regedt32), and locate the [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MRTG] key. Make sure that the ImagePath variable is correctly pointing to srvany.exe located in your MRTG bin directory (for example c:\mrtg\bin\srvany.exe). Next you have to expand the MRTG tree, and go to the [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MRTG\Parameters] key. Under Parameters make sure that all the Application variables are setup properly.
At this point you are ready to run the service. The only thing left to do is to start the MRTG service in the Services management console. After you do this, you should see two new processes running on your system: srvany.exe and wperl.exe. Make sure to stop any previously running MRTG processes to avoid conflict.
Note that it is imperative to set the RunAsDaemon: yes option or the service will stop after just one single run!
Pasted from <http://oss.oetiker.ch/mrtg/doc/mrtg-nt-guide.en.html>
Comments
Post a Comment