CentOS 6
Sponsored Link

MRTG : Get Memory Usage info2015/01/25

 
Configure MRTG to display Memory Usage rate.
[1] Configure MRTG.
# make sure total memory

[root@dlp ~]#
free

             total       used       free     shared    buffers     cached
Mem:       3922688     135224    3787464        260       7288      41788
-/+ buffers/cache:      86148    3836540
Swap:      4128764          0    4128764

[root@dlp ~]#
vi /etc/mrtg/mrtg.cfg
# add follows to the end (replace the "Serverworld" to your comunity name)

Target[mem]: .1.3.6.1.4.1.2021.4.6.0&.1.3.6.1.4.1.2021.4.4.0:Serverworld@127.0.0.1
# total memory

MaxBytes1[Mem]: 3922688
# total swap

MaxBytes2[Mem]: 4128764
Unscaled[Mem]: dwmy
Options[Mem]: gauge, growright
YLegend[Mem]: Mem Free(Bytes)
ShortLegend[Mem]: Bytes
kilo[Mem]: 1024
kMG[Mem]: k,M,G,T,P
LegendI[Mem]: Real
LegendO[Mem]: Swap
Legend1[Mem]: Memory Free [MBytes]
Legend2[Mem]: Swap Free [MBytes]
Title[Mem]: Memory Free
PageTop[Mem]: <H1>Memory Free</H1>

# execute mrtg 3 times (display warnings until 3 times)

[root@dlp ~]#
for (( i=1 ; i <= 3 ; i++ )); do env LANG=C mrtg /etc/mrtg/mrtg.cfg; done

2015-01-25 23:05:51, Rateup WARNING: /usr/bin/rateup could not read the primary log file for mem
2015-01-25 23:05:51, Rateup WARNING: /usr/bin/rateup The backup log file for mem was invalid as well
2015-01-25 23:05:51, Rateup WARNING: /usr/bin/rateup Can't remove mem.old updating log file
2015-01-25 23:05:51, Rateup WARNING: /usr/bin/rateup Can't rename mem.log to mem.old updating log file
2015-01-25 23:05:51, Rateup WARNING: /usr/bin/rateup Can't remove mem.old updating log file
# generate index file

[root@dlp ~]#
indexmaker --columns=1 /etc/mrtg/mrtg.cfg > /var/www/mrtg/index.html
[2] Access to the "http://(MRTG hostname or IP address)/mrtg/" from a client with HTTP, then it's possible to see Memory Usage rate.
Matched Content