Ubuntu MRTG インストールメモ
インストール
$ sudo apt-get install mrtg $ sudo apt-get install snmpd $ sudo apt-get install snmp
設定
$ sudo vim /etc/snmp/snmpd.conf
- com2sec paranoid default public + #com2sec paranoid default public #com2sec readonly default public #com2sec readwrite default private + com2sec local localhost private + com2sec mynetwork 192.168.11.0/24 public ←環境に合わせる group MyROSystem v1 paranoid group MyROSystem v2c paranoid group MyROSystem usm paranoid group MyROGroup v1 readonly group MyROGroup v2c readonly group MyROGroup usm readonly group MyRWGroup v1 readwrite group MyRWGroup v2c readwrite group MyRWGroup usm readwrite + group MyRWGroup any local + group MyROGroup any mynetwork access MyROSystem "" any noauth exact system none none - access MyROGroup "" any noauth exact all none none + #access MyROGroup "" any noauth exact all none none - access MyRWGroup "" any noauth exact all all none + #access MyRWGroup "" any noauth exact all all none + access MyROGroup "" any noauth 0 all none none + access MyRWGroup "" any noauth 0 all all all - #disk / 10000 + disk / 10000
$ sudo /etc/init.d/snmpd restart
/etc/mrtg.cfg
$ sudo -s # cfgmaker --no-down private@localhost > mrtg.cfg # vim /etc/mrtg.cfg
# to get bits instead of bytes and graphs growing to the right # Options[_]: growright, bits + Options[_]: growright, noinfo - <div id="sysdetails"> - <table> - <tr> - <td>System:</td> - <td>ubu in Unknown (configure /etc/snmp/snmpd.local.conf)</td> - </tr> - <tr> - <td>Maintainer:</td> - <td>Root <root@localhost> (configure /etc/snmp/snmpd.local.conf)</td> - </tr> - <tr> - <td>Description:</td> - <td>eth0 </td> - </tr> - <tr> - <td>ifType:</td> - <td>ethernetCsmacd (6)</td> - </tr> - <tr> - <td>ifName:</td> - <td>eth0</td> - </tr> - <tr> - <td>Max Speed:</td> - <td>1250.0 kBytes/s</td> - </tr> - <tr> - <td>Ip:</td> - <td>10.42.136.231 (ubu.local)</td> - </tr> - </table> - </div> + Target[cpu]: .1.3.6.1.4.1.2021.11.50.0&.1.3.6.1.4.1.2021.11.52.0:private@localhost + MaxBytes[cpu]: 100 + Options[cpu]: growright, noinfo, nopercent + YLegend[cpu]: CPU usage(%) + ShortLegend[cpu]: (%) + LegendI[cpu]: user + LegendO[cpu]: system + Legend1[cpu]: CPU usage(user)(%) + Legend2[cpu]: CPU usage(system)(%) + Title[cpu]: CPU usage + PageTop[cpu]: <h1>CPU usage</h1> + Target[mem]: .1.3.6.1.4.1.2021.4.6.0&.1.3.6.1.4.1.2021.4.4.0:private@localhost + MaxBytes1[mem]: 4054440 ←freeコマンドで取得した値 + MaxBytes2[mem]: 7815612 ←freeコマンドで取得した値 + Unscaled[mem]: dwmy + Options[mem]: gauge, absolute, growright, noinfo + 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]: free physical memory[MBytes] + Legend2[mem]: free swap[MBytes] + Title[mem]: free memory + PageTop[mem]: <h1>free memory</h1> + Target[disk]: .1.3.6.1.4.1.2021.9.1.9.1&.1.3.6.1.4.1.2021.9.1.9.1:private@localhost + MaxBytes[disk]: 100 + Unscaled[disk]: dwmy + Options[disk]: gauge, absolute, growright, nopercent, noinfo + YLegend[disk]: Disk Used(%) + ShortLegend[disk]: (%) + LegendI[disk]: / Disk used + LegendO[disk]: / Disk Used + Legend1[disk]: / Disk used + Legend2[disk]: / Disk used + Title[disk]: Disk usage + PageTop[disk]: <h1>Disk usage</h1>
# indexmaker --columns=1 /etc/mrtg.cfg > /var/www/mrtg/index.html
参考
MRTGによる計算機の状態監視
ページ中程「ubuntuでのセットアップ」