|
NAMESYNOPSISPREREQUISITESINSTALLINGCONFIGURING MRTGMAKE MRTG RUN ALL THE TIMEHOW TO SETUP MRTG AS A WINDOWS SERVICEEXAMPLEAUTHORS
mrtg-nt-guide - The MRTG 2.17.4 Windows Installation Guide Installing MRTG on a Windows box is not quite as "click and point" as some might want it to be. But then again, it is not all that difficult if you follow the instructions below. To get MRTG to work on Windows you need the following:
I suggest you do the following from the machine that will be running MRTG, which, in this case, is also a web server. All examples are for doing things to a LOCAL machine.
To see if everything is installed properly you can open a Command Shell and go into c:\mrtg-2.17.4\bin. Type:
This should give you a friendly error message complaining about the missing MRTG configuration file. Now, you have successfully installed MRTG and Perl. Now it is time to create a configuration for MRTG. But before we begin you need to know a few things. Take an opportunity to gather the following information:
For the rest of this document we will be using device 10.10.10.1 ( a CISCO Catalyst 5000) with Community string public. We are interested in monitoring traffic, and the CPU load. Let's begin. The first thing we do in setting up MRTG is making a default config file. Get to a cmd prompt and change to the c:\mrtg-2.17.4\bin directory. Type the following command:
This creates an initial MRTG config file for you. Note that in this file all interfaces of your router will be stored by number. Unfortunately, these numbers are likely to change whenever you reconfigure your router. In order to work around this you can get cfgmaker to produce a configuration which is based on Ip numbers, or even Interface Descriptions. Check cfgmaker If you get an error message complaining about no such name or no response, your community name is probably wrong. Now, let's take a look at the mrtg.cfg file that was created. In Perl, a Add the following to the top of the mrtg.cfg file:
This is where the web pages are created, usually a web root.
TargetDevice's IP Address:Interface Number:Community:IP Address
This is the interface speed (Default is 10 megabits; for 100Mbit devices use 12500000 and so on...)
This section determines how the web page headers will look
And that's a very basic MRTG config file. You can run this and see your results by going into the c:\mrtg-2.17.4\bin directory and typing:
It is normal to get errors for the first two times you run this command. The errors will alert you about the fact that there have not been any log files in existence before. If you take a look at those web pages they are not very exciting (yet). You need to have the MRTG files run every five minutes to produce the desired results. Just run it again after a few minutes. You should now be able to see the first lines in your graphs. 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
to your mrtg.cfg file and start it with:
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
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
PreparationPlease complete the following steps before starting the installation:
Service InstallationOnce 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:
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:
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! Now lets look at a config file to monitor what we wanted to on our mythical Cisco Cat 5000 -- utilization on ports 3, 5, 10, and 24, and the CPU Load, which will show us nonstandard mrtg configurations as well as more options..
This is a nice example of how to monitor any SNMP device if you know what OID you want to use. Once again, for an explanation of the more advance features of mrtg, please see the rest of the documentation. Tobi Oetiker <tobi@oetiker.ch>, David S. Divins <ddivins@moon.jic.com>, Steve Pierce <MRTG@HDL.com>, Artyom Adjemov <one.bofh@gmail.com>, Ilja Ivanov <ivanov@bseu.by> Karel Fajkus <http://fajkus.cz/> |
NOTE: The content of this website is accessible with any browser. The graphical design though relies completely on CSS2 styles. If you see this text, this means that your browser does not support CSS2. Consider upgrading to a standard conformant browser like Mozilla Firefox or Opera but also Apple's Safari or KDE's Konqueror for example. It may also be that you are looking at a mirror page which did not copy the CSS for this page. Or if some pictures are missing, then the mirror may not have picked up the contents of either the images or the inc directory.