📄 config.txt
字号:
* [1]Multi Router Traffic Grapher - Configuration File Format * [2]Global Configuration * [3]Optional Global Parameters + [4]Refresh + [5]Interval + [6]WriteExpires + [7]IconDir + [8]LoadMIBs + [9]Language + [10]UseRRDTool + [11]RunAsDaemon * [12]Configuration for each Target you want to monitor + [13]Target + [14]RouterUptime + [15]MaxBytes + [16]MaxBytes1 + [17]MaxBytes2 + [18]Title + [19]PageTop * [20]Optional Target Configuration Tags + [21]AddHead + [22]AbsMax + [23]Unscaled + [24]WithPeak + [25]Suppress + [26]Directory + [27]XSize and YSize + [28]XZoom and YZoom + [29]XScale and YScale + [30]YTics and YTicsFactor + [31]Step + [32]Options + [33]kilo + [34]kMG + [35]Colours + [36]Background + [37]YLegend, ShortLegend, Legend[1234] + [38]Timezone + [39]Weekformat * [40]Threshold Checking + [41]ThreshDir (GLOBAL) + [42]ThreshMinI (PER TARGET) + [43]ThreshMaxI (PER TARGET) + [44]ThreshDesc (PER TARGET) + [45]ThreshProgI (PER TARGET) + [46]ThreshProgOKI (PER TARGET) + [47]ThreshMinO, ThreshMaxO, ThreshProgO, and ThreshProgOKO * [48]Two very special Target names * [49]And one more very special Target name * [50]NoSpaceChar * [51]Some example mrtg.cfg files + [52]Minimal mrtg.cfg + [53]Cfg for several Routers. _________________________________________________________________ [INLINE] _________________________________________________________________ Multi Router Traffic Grapher -- Configuration File Format This file is for use with MRTG 2.8.12 Note: * Keywords must start at the beginning of a line. * Lines which follow a keyword line which do start with a blank are appended to the keyword line * Empty Lines are ignored * Lines starting with a # sign are comments. _________________________________________________________________ Global Configuration Workdir specifies where the logfiles and the webpages should be created. Example: WorkDir: /usr/tardis/pub/www/stats/mrtg _________________________________________________________________ Optional Global Parameters _________________________________________________________________ Refresh How many seconds apart should the browser (Netscape) be instructed to reload the page? If this is not defined, the default is 300 seconds (5 minutes). Example: Refresh: 600 _________________________________________________________________ Interval How often do you call mrtg? The default is 5 minutes. If you call it less often, you should specify it here. This does two things: * the generated HTML page does contain the right information about the calling interval ... * a META header in the generated HTML page will instruct caches about the time to live of this page ..... In this example we tell mrtg that we will be calling it every 10 minutes. If you are calling mrtg every 5 minutes, you can leave this line commented out. Example: Interval: 10 _________________________________________________________________ WriteExpires With this switch mrtg will generate .meta files for CERN and Apache servers which contain Expiration tags for the html and gif files. The *.meta files will be created in the same directory as the other files, so you will have to set ``MetaDir .'' and ``MetaFiles on'' in your apache.conf or .htaccess file for this to work NOTE: If you are running Apache-1.2 or later, you can use the mod_expire to achieve the same effect ... see the file htaccess.txt Example: WriteExpires: Yes _________________________________________________________________ IconDir If you want to keep the mrtg icons in some place other than the working directory, use the IconDir variable to give its url. Example: IconDir: /mrtgicons/ _________________________________________________________________ LoadMIBs Load the MIB file(s) specified and make its OIDs available as symbolic names. For better efficiancy, a cache of MIBs is maintained in the WorkDir. Example: LoadMIBs: /dept/net/mibs/netapp.mib,/usr/local/lib/ft100m.mib _________________________________________________________________ Language Switch output format to the selected Language (At the moment, the values: danish, french, english, dutch, brazilian, russian, spanish, greek and italian are supported) Example: Language: danish _________________________________________________________________ UseRRDTool Setting UseRRDTool to Yes in your mrtg.cfg file enables rrdtool mode. In rrdtool mode, mrtg relies on rrdtool to do its logging. Graphs and html pages will be generated on the fly by the 14all.cgi which can be found in the contrib section together with a short readme ... This feature has been contributed by [54]Rainer.Bawidamann@informatik.uni-ulm.de. Please check his website for more information: [55]http://www.uni-ulm.de/~rbawidam/mrtg-rrd/ Example: UseRRDTool: Yes _________________________________________________________________ RunAsDaemon The RunAsDaemon keyword enables daemon mode operation. The purpose of daemon mode is that MRTG is launched once and not at regular basis by cron as in native mode. This behavior saves computing resourses as loading and parsing of configuration files only hapens once. Using daemon mode MRTG itself is responible for timing the measurement intervals. Therfore its important to set the Interval keyword to an apropiate value. Note that using daemon mode MRTG should no longer be started from cron by regular basis as each started process runs forever. Instead MRTG should be started from the command prompt or by a system startup script. Also note that in daemon mode restart of the process is required in order to activate changes in the config file. Under UNIX, the Daemon switch causes mrtg to fork into background after checking its config file. Example RunAsDaemon:Yes Interval:5 Makes MRTG run as a daemon beginning data collection every 5 minutes _________________________________________________________________ Configuration for each Target you want to monitor The configuration keywords Target must be followed by a unique name. This will also be the name used for the webpages, logfiles and gifs created for that target. Note that the Target sections can be auto-generated with the cfgmaker tool. Check readme.html for instructions. _________________________________________________________________ Target With the Target keyword you tell mrtg what it should monitor. The Target keyword takes arguments in a wide range of formats: * The most basic format is ``port:community@router'' This will generate a traffic graph for the interface 'port' of the host 'router' (dns name or IP address) and it will use the community 'community' (snmp password) for the snmp query. Example: Target[ezwf]: 2:public@wellfleet-fddi.ethz.ch * Sometimes you are sitting on the wrong side of the link, and you would like to have mrtg report Incoming traffic as outgoing and vice versa. This can be achieved by adding the '-' sign in front of the ``Target'' description. It flips the incoming and outgoing traffic rates. Example: Target[ezci]: -1:public@ezci-ether.ethz.ch * You can also explicitly define the OID to query by using the following syntax 'OID_1&OID_2:community@router' The following example will retrieve error counts for input and output on interface 1. MRTG needs to graph two variables, so you need to specify two OID's such as temperature and humidity or error input and error output. Example: Target[ezwf]: 1.3.6.1.2.1.2.2.1.14.1&1.3.6.1.2.1.2.2.1.20.1:public@myrouter * MRTG knows a number of symbolical SNMP variable names. See the file mibhelp.txt for a list of known names. One example are the ifInErrors and ifOutErrors. This means you can specify the above as: Example: Target[ezwf]: ifInErrors.1&ifOutErrors.1:public@myrouter * Sometimes SNMP interface index can change, like when new interfaces are added or removed. This can cause all Target entries in your config file to become wrong by offset, causing MRTG to graphs wrong instances etc. MRTG supports IP address instead of ifindex in target definition. Then MRTG will query snmp device and try to map IP address to current ifindex, You can use IP address in every type of target definition, by adding IP address of the numbered interface after OID and separation char '/' Make sure that given IP address is used on your same target router, your same target router, especially when graphing two different OIDs and/or interface split by '&' delimiter. Example: Target[ezwf]: /1.2.3.4:public@wellfleet-fddi.ethz.ch Target[ezci]: -/1.2.3.4:public@ezci-ether.ethz.ch Target[ezwf]: 1.3.6.1.2.1.2.2.1.14/1.2.3.4&/1.2.3.4:public@myrouter Target[ezwf]: ifInErrors/1.2.3.4&ifOutErrors/1.2.3.4:public@myrouter * When the SNMP interface index changes, you can key that interface by its 'Physical Address', sometimes called a 'hard address', which is the SNMP variable 'ifPhysAddress'. Internally, MRTG matches the Physical Address from the *.cfg file to its current index, and then uses that index for the rest of the session. You can use the Physical Address in every type of target definition, by adding the Physical Address after the OID and separation char '!' (analogous to the IP address option). The Physical address is specified as either '-' delimited octets, such as ``0a-0-f1-5-23-18'' (omit the double quotes) or a string with exactly two chars per octet such as ``0a00f1052318''. Note that there are 6 octets for for ethernet hard addresses but other types of network connections may differ. There is a utility 'cfgmaker_phys' that can be used to convert every interface index or IP addresses to the new Physical Address format, ``cfgmaker_phys old.cfg > new.cfg'' or it can be combined with 'cfgmaker' as follows ``cfgmaker [56]public@1.2.3.4 | cfgmaker_phys > new.cfg''. If however you only want to convert some - not all - of the interfaces, this must be done manually. Example: Target[ezwf]: !0a-0b-0c-0d:public@wellfleet-fddi.ethz.ch Target[ezci]: -!0-f-bb-05-71-22:public@ezci-ether.ethz.ch Target[ezwf]: 1.3.6.1.2.1.2.2.1.14!0a-00-10-23-44-51&!0a-00-10-23-44-51:public@myrouter Target[ezwf]: ifInErrors!0a-00-10-23-44-51&ifOutErrors!0a-00-10-23-44-51:public@myrouter * In all places where ``community@router'' is accepted, you can add additional parameters for the SNMP communication using colon-separated suffixes. The full syntax is as follows: community@router[:port[:timeout[:retries[:backoff]]]] where the meaning of each parameter is as follows: port the UDP port under which to contact the SNMP agent (default: 161) timeout initial timeout for SNMP queries, in seconds (default: 2.0) retries number of times a timed-out request will be retried (default: 5) backoff factor by which the timeout is multiplied on every retry (default: 1.0). A value that equals the default value can be omitted. Trailing colons can be omitted, too. Example: Target[ezci]: 1:public@ezci-ether.ethz.ch:9161::4 This would refer to the input/output octet counters for the interface with ifIndex 1 on ezci-ether.ethz.ch, as known by the SNMP agent listening on UDP port 9161. The standard initial timeout (2.0 seconds) is used, but the number of retries is set to four. The backoff value is the default. * if you want to monitor something which does not provide data via snmp you can use some external program to do the data gathering. The external command must return 4 lines of output: Line 1 current state of the first variable, normally 'incoming bytes count' Line 2 current state of the second variable, normally 'outgoing bytes count' Line 3 string (in any human readable format), telling the uptime of the target. Line 4 string, telling the name of the target. Depending on the type of data your script returns you might want to use the 'gauge' or 'absolute' arguments for the Options keyword. Example: Target[ezwf]: `/usr/local/bin/df2mrtg /dev/dsk/c0t2d0s0` Note the use of the backticks (`), not apostrophes (') around the command. * You can also use several statements in a mathematical expression. This could be used to aggregate both B channels in an ISDN connection or multiple T1s that are aggregated into a single channel for greater bandwidth. Note the whitespace arround the target definitions. Example:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -