Azure Sentinel is a cloud SIEM and SOAR. It is therefore used for the supervision of a customer environment, from which it...
Data traffic measurementLukas Beran
On servers you often need to measure and visualize data traffic. In today’s article I will show you a guide how to use MRTG on Windows Server 2012 R2.
Download and extract MRTG from http://oss.oetiker.ch/mrtg/download.en.html.
For running the tool you need Perl. Recommended is ActivePerl. Perl has to be in system PATH, which is a default setiing when installing ActivePerl. I described how to change system PATH in an older article. If you want to verify that Perl works properly, open command prompt and change the location to c:\mrtg-2.17.4\bin (or where you extracted MRTG) and run
You also need an IP address or a hostname of the machine you want to monitor, and read-only SNMP community string.
You also need running SNMP Service. This service is a part of SNMP features in Windows Server 2012 R2 so you need to install SNMP using Add roles and features. In Services (services.msc) open the service and on the tab Security add Community name with read-only rights and restart the service.
Open command prompt and change your location to extracted MRTG folder (for example c:\mrtg-2.17.4\bin).
First you need to generate configuration file:
perl cfgmaker lan@localhost --global "WorkDir: c:\www\mrtg" --output mrtg.cfg
- lan is read-only SNMP community string
- localhost is an address of monitored device
- WorkDir is a path to folder where you will have HTML files
Now you have a configuration file. If any error occurs, your SNMP service is probably not running properly or your device is not available.
Now open your configuration file mrtg.cfg, where you can see all interfaces of your device. Here you can remove interfaces which you don’t want to monitor.
Now we can generate HTML files using perl mrtg mrtg.cfg. It’s OK if you see errors. You need to run this command three times, then it should be with no error. Now the configuration is done. Every time you run the command, you regenerate the graphs.
Running MRTG as a service
For running MRTG as a service you need two additional files – SrvAny.exe (Applications as Services Utility) and INSTSRV.exe (Service Installer). Both files are from Microsoft Resource Kit. Copy these files to MRTG/bin folder.
Now create mrtg.reg file with the following content:
Windows Registry Editor Version 5.00
"AppParameters"="c:\\mrtg-2.17.4\\bin\\mrtg --logging=eventlog c:\\mrtg-2.17.4\\bin\\mrtg.cfg"
Now create a new service from command line instsrv MRTG c:\mrtg-2.17.4\bin\srvany.exe and App* records for the service regedit /s mrtg.reg.
Now reports are generated every five minutes.