[mrtg] How to use mrtg to monitor cpu,memory and network usage
DA Forsyth
iwrtech at iwr.ru.ac.za
Wed Jul 25 08:30:48 CEST 2007
On 24 Jul 2007 , Faizal7778 Ahammed entreated about
"[mrtg] How to use mrtg to monitor cpu,memory and ":
> Hi all,
>
> Iam new to mrtg by creating the config command
>
> perl cfgmaker public at ipaddress of server --global "Wordir: "
> c:\workingdiraddress" -- output filename.cfg
>
> and by starting the process
> perl mrtg filename.cfg
>
>
> iam able to monitor the network usage of the ip mentioned server how
> do i monitor the cpu, memory usage of the servers. pls help.
some samples from my FreeBSD setup...
CPU load
Target[someserver.load]:
.1.3.6.1.4.1.2021.10.1.3.1&.1.3.6.1.4.1.2021.10.1.3.2:readcommunity at so
meIP * 100
Title[someserver.load]: CPU Load for someserver.somewhere.com
MaxBytes[someserver.load]: 20
AbsMax[someserver.load]: 500
Options[someserver.load]: gauge
Shortlegend[someserver.load]: bogomips
YLegend[someserver.load]: Load
LegendI[someserver.load]: Load-1
LegendO[someserver.load]: Load-5
Legend1[someserver.load]: 1 Minute Load Average
Legend2[someserver.load]: 5 Minute Load Average
PageTop[someserver.load]: <H1>CPU Load Analysis for someserver </H1>
<TABLE>
<tr><td>Values are 'load * 100' so a value of 20 on the graph is a
load of 0.2</td></tr>
</TABLE>
I multiply by 100 since MRTG cannot deal with fractions unless you
use rrdtool. I'll use rrdtool as soon as I get a faster
motherboard, I find the graph generation takes a lot of power to get
snappy web pages. THe Celeron 700 isn't coping (-:
Memory usage...
LoadMIBs: /usr/local/share/snmp/mibs/HOST-RESOURCES-MIB.txt
Target[someserver.ram.mem]:
hrStorageUsed.2&hrStorageUsed.3:readcommunity at someIP * 4096
MaxBytes[someserver.ram.mem]: 805175296
Title[someserver.ram.mem]: Memory 'mem' Usage
PageTop[someserver.ram.mem]: <h1>Memory 'mem' Usage</h1>
Shortlegend[someserver.ram.mem]: Bytes
kilo[someserver.ram.mem]: 1024
YLegend[someserver.ram.mem]: mem Used
Legend1[someserver.ram.mem]: mem RAM used
Legend2[someserver.ram.mem]: mem SWAP used
Legend3[someserver.ram.mem]:
Legend4[someserver.ram.mem]:
LegendI[someserver.ram.mem]: RAM Usage
LegendO[someserver.ram.mem]: SWAP Usage
options[someserver.ram.mem]: gauge pngdate
In that target I multiply by 4096, which is the block size for that
device.
The hrStorageUsed OID returns blocks used, but I want the graph to
display
in bytes.
I use command line tools to find things to monitor, like this....
To see disk data
snmpwalk -c readcommunity -v 1 ip.ip.ip.ip hrStorage
will show all the data starting at the hrStorage key. from that you
can
figure out what subkeys belong to which disks or mem
To see the map of what it means
snmptranslate -Tp -IR hrStorage
will give something like
+--hrStorage(2)
|
+--hrStorageTypes(1)
| |
| +--hrStorageOther(1)
| +--hrStorageRam(2)
| +--hrStorageVirtualMemory(3)
| +--hrStorageFixedDisk(4)
| +--hrStorageRemovableDisk(5)
| +--hrStorageFloppyDisk(6)
| +--hrStorageCompactDisc(7)
| +--hrStorageRamDisk(8)
| +--hrStorageFlashMemory(9)
| +--hrStorageNetworkDisk(10)
|
+-- -R-- Integer32 hrMemorySize(2)
| Textual Convention: KBytes
| Range: 0..2147483647
|
+--hrStorageTable(3)
|
+--hrStorageEntry(1)
| Index: hrStorageIndex
|
+-- -R-- Integer32 hrStorageIndex(1)
| Range: 1..2147483647
+-- -R-- ObjID hrStorageType(2)
| Textual Convention: AutonomousType
+-- -R-- String hrStorageDescr(3)
| Textual Convention: DisplayString
| Size: 0..255
+-- -R-- Integer32 hrStorageAllocationUnits(4)
| Range: 1..2147483647
+-- -RW- Integer32 hrStorageSize(5)
| Range: 0..2147483647
+-- -R-- Integer32 hrStorageUsed(6)
| Range: 0..2147483647
+-- -R-- Counter hrStorageAllocationFailures(7)
On Windows you can use a tool like 'getif' (google for it) to view
the tree and figure out the OIDs for mrtg to use. Note that the order
of disk entries may change after a reboot.
You really do need to read more of the MRTG manual, and read more
about SNMP, to speed you on your way to getting MRTG to do what you
want.
--
DA Fo rsyth Network Supervisor
Principal Technical Officer -- Institute for Water Research
http://www.ru.ac.za/institutes/iwr/
More information about the mrtg
mailing list