CentOS 7
Sponsored Link

MRTG : Get Disk Usage2015/06/16

 
Configure MRTG to display Disk Usage rate (mainly display free disk area).
[1] Configure MRTG.
[root@dlp ~]#
vi /etc/snmp/snmpd.conf
# line 323: uncomment

disk / 10000
[root@dlp ~]#
systemctl restart snmpd

# make sure total disk amount (replace the "Serverworld" to your comunity name)

[root@dlp ~]#
snmpwalk -v2c -c Serverworld localhost .1.3.6.1.4.1.2021.9.1.6

UCD-SNMP-MIB::dskTotal.1 = INTEGER: 27740944
[root@dlp ~]#
vi /etc/mrtg/mrtg.cfg
# add follows to the end (replace the "Serverworld" to your comunity name)

# specify the result of above for "MaxBytes" section

Target[Disk]: .1.3.6.1.4.1.2021.9.1.7.1&.1.3.6.1.4.1.2021.9.1.7.1:Serverworld@127.0.0.1:::::2
MaxBytes[Disk]: 27740944
kMG[Disk]: k,M,G,T,P
Unscaled[Disk]: dwmy
Options[Disk]: gauge, absolute, growright, nopercent
YLegend[Disk]: Disk Free(Bytes)
ShortLegend[Disk]: Bytes
LegendI[Disk]: / Disk Free [Bytes]
LegendO[Disk]:
Legend1[Disk]: / Disk Free [Bytes]
Legend2[Disk]:
Title[Disk]: Disk Free
PageTop[Disk]: <H1>Disk 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-06-16 19:30:23, Rateup WARNING: /usr/bin/rateup could not read the primary log file for disk
2015-06-16 19:30:23, Rateup WARNING: /usr/bin/rateup The backup log file for disk was invalid as well
2015-06-16 19:30:23, Rateup WARNING: /usr/bin/rateup Can't rename disk.log to disk.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 Free Disk amount.
Matched Content