Life is fun and easy!
不正IP報告数
Okan Sensor
ページへ戻る
印刷
MacOSX/HigiSierra/mrtg
をテンプレートにして作成 ::
UJP
tech_regist2
:MacOSX/HigiSierra/mrtg をテンプレートにして作成
開始行:
*macOS High SierraにMRTGを設定
**はじめに
MRTGとは,マルチルータトラフィックグラファーの略.ルー...
**インストール
インストールはHomeBrewでおこなった.特に問題もなかった.
$ brew info mrtg🆑
mrtg: stable 2.17.7 (bottled)🈁
Multi router traffic grapher
https://oss.oetiker.ch/mrtg/
/usr/local/Cellar/mrtg/2.17.7 (110 files, 2.4MB) *
Poured from bottle on 2019-05-07 at 00:48:32
From: https://github.com/Homebrew/homebrew-core/blob/mas...
==> Dependencies
Required: gd ✔
==> Analytics
install: 30 (30 days), 76 (90 days), 458 (365 days)
install_on_request: 26 (30 days), 69 (90 days), 381 (365...
build_error: 0 (30 days)
$
インストールされたか,コマンドの場所を確認.
まずは,mrtgコマンド.
$ which mrtg🆑
/usr/local/bin/mrtg🈁
$
そして,設定ファイルを自動的に作成してくれる,cfgmaker...
$ which cfgmaker🆑
/usr/local/bin/cfgmaker🈁
$
**初期設定
まずは,SNMPD.CONFにあるコミュニティ名を確認.
$ grep com2sec /etc/snmp/snmpd.conf🆑
com2sec local localhost private🈁
com2sec mynetwork NETWORK/24 public
$
"private"だとわかった.
cfgmakerコマンドを指定し,privateコミュニティの初期設定...
$ cfgmaker private@localhost > mrtg.cfg🆑
Subroutine SNMP_Session::pack_sockaddr_in6 redefined at ...
line 66. at /usr/local/bin/../lib/mrtg2/SNMP_Session.pm...
Subroutine SNMPv1_Session::pack_sockaddr_in6 redefined a...
line 66. at /usr/local/bin/../lib/mrtg2/SNMP_Session.pm...
--base: Get Device Info on private@localhost:
--base: Vendor Id: Unknown Vendor - 1.3.6.1.4.1.8072.3.2...
--base: Populating confcache
--base: Get Interface Info
--base: Walking ifIndex
--snpd: private@localhost: -> 1 -> ifIndex = 1
--snpd: private@localhost: -> 2 -> ifIndex = 2
--snpd: private@localhost: -> 3 -> ifIndex = 3
--snpd: private@localhost: -> 4 -> ifIndex = 4
--snpd: private@localhost: -> 5 -> ifIndex = 5
--snpd: private@localhost: -> 6 -> ifIndex = 6
--snpd: private@localhost: -> 7 -> ifIndex = 7
--snpd: private@localhost: -> 8 -> ifIndex = 8
--snpd: private@localhost: -> 9 -> ifIndex = 9
--snpd: private@localhost: -> 10 -> ifIndex = 10
--snpd: private@localhost: -> 11 -> ifIndex = 11
--snpd: private@localhost: -> 12 -> ifIndex = 12
--base: Walking ifType
--snpd: private@localhost: -> 1 -> ifType = 24
--snpd: private@localhost: -> 2 -> ifType = 55
--snpd: private@localhost: -> 3 -> ifType = 57
--snpd: private@localhost: -> 4 -> ifType = 1
--snpd: private@localhost: -> 5 -> ifType = 1
--snpd: private@localhost: -> 6 -> ifType = 6
--snpd: private@localhost: -> 7 -> ifType = 6
--snpd: private@localhost: -> 8 -> ifType = 6
--snpd: private@localhost: -> 9 -> ifType = 6
--snpd: private@localhost: -> 10 -> ifType = 209
--snpd: private@localhost: -> 11 -> ifType = 1
--snpd: private@localhost: -> 12 -> ifType = 23
--base: Walking ifAdminStatus
--snpd: private@localhost: -> 1 -> ifAdminStatus = 1
--snpd: private@localhost: -> 2 -> ifAdminStatus = 2
--snpd: private@localhost: -> 3 -> ifAdminStatus = 2
--snpd: private@localhost: -> 4 -> ifAdminStatus = 2
--snpd: private@localhost: -> 5 -> ifAdminStatus = 2
--snpd: private@localhost: -> 6 -> ifAdminStatus = 1
--snpd: private@localhost: -> 7 -> ifAdminStatus = 1
--snpd: private@localhost: -> 8 -> ifAdminStatus = 2
--snpd: private@localhost: -> 9 -> ifAdminStatus = 1
--snpd: private@localhost: -> 10 -> ifAdminStatus = 1
--snpd: private@localhost: -> 11 -> ifAdminStatus = 1
--snpd: private@localhost: -> 12 -> ifAdminStatus = 1
--base: Walking ifOperStatus
--snpd: private@localhost: -> 1 -> ifOperStatus = 1
--snpd: private@localhost: -> 2 -> ifOperStatus = 2
--snpd: private@localhost: -> 3 -> ifOperStatus = 2
--snpd: private@localhost: -> 4 -> ifOperStatus = 2
--snpd: private@localhost: -> 5 -> ifOperStatus = 2
--snpd: private@localhost: -> 6 -> ifOperStatus = 1
--snpd: private@localhost: -> 7 -> ifOperStatus = 2
--snpd: private@localhost: -> 8 -> ifOperStatus = 2
--snpd: private@localhost: -> 9 -> ifOperStatus = 1
--snpd: private@localhost: -> 10 -> ifOperStatus = 1
--snpd: private@localhost: -> 11 -> ifOperStatus = 1
--snpd: private@localhost: -> 12 -> ifOperStatus = 1
--base: Walking ifMtu
--snpd: private@localhost: -> 1 -> ifMtu = 16384
--snpd: private@localhost: -> 2 -> ifMtu = 1280
--snpd: private@localhost: -> 3 -> ifMtu = 1280
--snpd: private@localhost: -> 4 -> ifMtu = 0
--snpd: private@localhost: -> 5 -> ifMtu = 0
--snpd: private@localhost: -> 6 -> ifMtu = 1500
--snpd: private@localhost: -> 7 -> ifMtu = 1500
--snpd: private@localhost: -> 8 -> ifMtu = 2304
--snpd: private@localhost: -> 9 -> ifMtu = 1500
--snpd: private@localhost: -> 10 -> ifMtu = 1500
--snpd: private@localhost: -> 11 -> ifMtu = 2000
--snpd: private@localhost: -> 12 -> ifMtu = 1280
--base: Walking ifSpeed
--snpd: private@localhost: -> 1 -> ifSpeed = 0
--snpd: private@localhost: -> 2 -> ifSpeed = 0
--snpd: private@localhost: -> 3 -> ifSpeed = 0
--snpd: private@localhost: -> 4 -> ifSpeed = 0
--snpd: private@localhost: -> 5 -> ifSpeed = 0
--snpd: private@localhost: -> 6 -> ifSpeed = 1000000000
--snpd: private@localhost: -> 7 -> ifSpeed = 0
--snpd: private@localhost: -> 8 -> ifSpeed = 10000000
--snpd: private@localhost: -> 9 -> ifSpeed = 0
--snpd: private@localhost: -> 10 -> ifSpeed = 0
--snpd: private@localhost: -> 11 -> ifSpeed = 0
--snpd: private@localhost: -> 12 -> ifSpeed = 100000000
$
自動作成された設定ファイルを確認.
$ cat mrtg.cfg🆑
# Created by
# /usr/local/bin/cfgmaker private@localhost
### Global Config Options
# for UNIX
# WorkDir: /home/http/mrtg
# or for NT
# WorkDir: c:\mrtgdata
### Global Defaults
# to get bits instead of bytes and graphs growing to th...
# Options[_]: growright, bits
EnableIPv6: no
########################################################...
# System: zeus.local
# Description: Darwin zeus.local 17.7.0 Darwin Kernel Ve...
Wed Feb 27 00:43:23 PST 2019; root:xnu-4570.71.35~1/RELE...
# Contact: サーバ管理者メールアドレス
# Location: BCP
########################################################...
### Interface 1 >> Descr: 'lo0' | Name: 'lo0' | Ip: '127...
### The following interface is commented out because:
### * it is a Software Loopback interface
### * has no ifSpeed property
#
# Target[localhost_1]: 1:private@localhost:
# SetEnv[localhost_1]: MRTG_INT_IP="127.0.0.1" MRTG_INT_...
# MaxBytes[localhost_1]: 0
# Title[localhost_1]: Traffic Analysis for 1 -- zeus.local
# PageTop[localhost_1]: <h1>Traffic Analysis for 1 -- ze...
# <div id="sysdetails">
# <table>
# <tr>
# <td>System:</td>
# <td>zeus.local in BCP</td>
# </tr>
# <tr>
# <td>Maintainer:</td>
# <td>サーバ管理者メールアドレス</td>
# </tr>
# <tr>
# <td>Description:</td>
# <td>lo0 </td>
# </tr>
# <tr>
# <td>ifType:</td>
# <td>softwareLoopback (24)</td>
# </tr>
# <tr>
# <td>ifName:</td>
# <td>lo0</td>
# </tr>
# <tr>
# <td>Max Speed:</td>
# <td>0.0 Bytes/s</td>
# </tr>
# <tr>
# <td>Ip:</td>
# <td>127.0.0.1 (localhost)</td>
# </tr>
# </table>
# </div>
### Interface 2 >> Descr: 'gif0' | Name: 'gif0' | Ip: 'N...
### The following interface is commented out because:
### * it is administratively DOWN
### * it is operationally DOWN
### * has no ifSpeed property
#
# Target[localhost_2]: 2:private@localhost:
# SetEnv[localhost_2]: MRTG_INT_IP="No Ip" MRTG_INT_DESC...
# MaxBytes[localhost_2]: 0
# Title[localhost_2]: Traffic Analysis for 2 -- zeus.local
# PageTop[localhost_2]: <h1>Traffic Analysis for 2 -- ze...
# <div id="sysdetails">
# <table>
# <tr>
# <td>System:</td>
# <td>zeus.local in BCP</td>
# </tr>
# <tr>
# <td>Maintainer:</td>
# <td>server@ujp.jp</td>
# </tr>
# <tr>
# <td>Description:</td>
# <td>gif0 </td>
# </tr>
# <tr>
# <td>ifType:</td>
# <td>100BaseVG (55)</td>
# </tr>
# <tr>
# <td>ifName:</td>
# <td>gif0</td>
# </tr>
# <tr>
# <td>Max Speed:</td>
# <td>0.0 Bytes/s</td>
# </tr>
# <tr>
# <td>Ip:</td>
# <td>No Ip (No DNS name)</td>
# </tr>
# </table>
# </div>
### Interface 3 >> Descr: 'stf0' | Name: 'stf0' | Ip: 'N...
### The following interface is commented out because:
### * it is administratively DOWN
### * it is operationally DOWN
### * has no ifSpeed property
#
# Target[localhost_3]: 3:private@localhost:
# SetEnv[localhost_3]: MRTG_INT_IP="No Ip" MRTG_INT_DESC...
# MaxBytes[localhost_3]: 0
# Title[localhost_3]: Traffic Analysis for 3 -- zeus.local
# PageTop[localhost_3]: <h1>Traffic Analysis for 3 -- ze...
# <div id="sysdetails">
# <table>
# <tr>
# <td>System:</td>
# <td>zeus.local in BCP</td>
# </tr>
# <tr>
# <td>Maintainer:</td>
# <td>server@ujp.jp</td>
# </tr>
# <tr>
# <td>Description:</td>
# <td>stf0 </td>
# </tr>
# <tr>
# <td>ifType:</td>
# <td>HIPPI Interface (57)</td>
# </tr>
# <tr>
# <td>ifName:</td>
# <td>stf0</td>
# </tr>
# <tr>
# <td>Max Speed:</td>
# <td>0.0 Bytes/s</td>
# </tr>
# <tr>
# <td>Ip:</td>
# <td>No Ip (No DNS name)</td>
# </tr>
# </table>
# </div>
### Interface 4 >> Descr: 'EHC253' | Name: 'EHC253' | Ip...
### The following interface is commented out because:
### * it is administratively DOWN
### * it is operationally DOWN
### * has no ifSpeed property
#
# Target[localhost_4]: 4:private@localhost:
# SetEnv[localhost_4]: MRTG_INT_IP="No Ip" MRTG_INT_DESC...
# MaxBytes[localhost_4]: 0
# Title[localhost_4]: Traffic Analysis for 4 -- zeus.local
# PageTop[localhost_4]: <h1>Traffic Analysis for 4 -- ze...
# <div id="sysdetails">
# <table>
# <tr>
# <td>System:</td>
# <td>zeus.local in BCP</td>
# </tr>
# <tr>
# <td>Maintainer:</td>
# <td>server@ujp.jp</td>
# </tr>
# <tr>
# <td>Description:</td>
# <td>EHC253 </td>
# </tr>
# <tr>
# <td>ifType:</td>
# <td>Other (1)</td>
# </tr>
# <tr>
# <td>ifName:</td>
# <td>EHC253</td>
# </tr>
# <tr>
# <td>Max Speed:</td>
# <td>0.0 Bytes/s</td>
# </tr>
# <tr>
# <td>Ip:</td>
# <td>No Ip (No DNS name)</td>
# </tr>
# </table>
# </div>
### Interface 5 >> Descr: 'EHC250' | Name: 'EHC250' | Ip...
### The following interface is commented out because:
### * it is administratively DOWN
### * it is operationally DOWN
### * has no ifSpeed property
#
# Target[localhost_5]: 5:private@localhost:
# SetEnv[localhost_5]: MRTG_INT_IP="No Ip" MRTG_INT_DESC...
# MaxBytes[localhost_5]: 0
# Title[localhost_5]: Traffic Analysis for 5 -- zeus.local
# PageTop[localhost_5]: <h1>Traffic Analysis for 5 -- ze...
# <div id="sysdetails">
# <table>
# <tr>
# <td>System:</td>
# <td>zeus.local in BCP</td>
# </tr>
# <tr>
# <td>Maintainer:</td>
# <td>server@ujp.jp</td>
# </tr>
# <tr>
# <td>Description:</td>
# <td>EHC250 </td>
# </tr>
# <tr>
# <td>ifType:</td>
# <td>Other (1)</td>
# </tr>
# <tr>
# <td>ifName:</td>
# <td>EHC250</td>
# </tr>
# <tr>
# <td>Max Speed:</td>
# <td>0.0 Bytes/s</td>
# </tr>
# <tr>
# <td>Ip:</td>
# <td>No Ip (No DNS name)</td>
# </tr>
# </table>
# </div>
### Interface 6 >> Descr: 'en3' | Name: 'en3' | Ip: '192...
Target[localhost_6]: 6:private@localhost:
SetEnv[localhost_6]: MRTG_INT_IP="192.168.100.10" MRTG_I...
MaxBytes[localhost_6]: 125000000
Title[localhost_6]: Traffic Analysis for 6 -- zeus.local
PageTop[localhost_6]: <h1>Traffic Analysis for 6 -- zeus...
<div id="sysdetails">
<table>
<tr>
<td>System:</td>
<td>zeus.local in BCP</td>
</tr>
<tr>
<td>Maintainer:</td>
<td>server@ujp.jp</td>
</tr>
<tr>
<td>Description:</td>
<td>en3 </td>
</tr>
<tr>
<td>ifType:</td>
<td>ethernetCsmacd (6)</td>
</tr>
<tr>
<td>ifName:</td>
<td>en3</td>
</tr>
<tr>
<td>Max Speed:</td>
<td>125.0 MBytes/s</td>
</tr>
<tr>
<td>Ip:</td>
<td>192.168.100.10 (No DNS name)</td>
</tr>
</table>
</div>
### Interface 7 >> Descr: 'en0' | Name: 'en0' | Ip: 'No ...
### The following interface is commented out because:
### * it is operationally DOWN
### * has no ifSpeed property
#
# Target[localhost_7]: 7:private@localhost:
# SetEnv[localhost_7]: MRTG_INT_IP="No Ip" MRTG_INT_DESC...
# MaxBytes[localhost_7]: 0
# Title[localhost_7]: Traffic Analysis for 7 -- zeus.local
# PageTop[localhost_7]: <h1>Traffic Analysis for 7 -- ze...
# <div id="sysdetails">
# <table>
# <tr>
# <td>System:</td>
# <td>zeus.local in BCP</td>
# </tr>
# <tr>
# <td>Maintainer:</td>
# <td>server@ujp.jp</td>
# </tr>
# <tr>
# <td>Description:</td>
# <td>en0 </td>
# </tr>
# <tr>
# <td>ifType:</td>
# <td>ethernetCsmacd (6)</td>
# </tr>
# <tr>
# <td>ifName:</td>
# <td>en0</td>
# </tr>
# <tr>
# <td>Max Speed:</td>
# <td>0.0 Bytes/s</td>
# </tr>
# <tr>
# <td>Ip:</td>
# <td>No Ip (No DNS name)</td>
# </tr>
# </table>
# </div>
### Interface 8 >> Descr: 'p2p0' | Name: 'p2p0' | Ip: 'N...
### The following interface is commented out because:
### * it is administratively DOWN
### * it is operationally DOWN
#
# Target[localhost_8]: 8:private@localhost:
# SetEnv[localhost_8]: MRTG_INT_IP="No Ip" MRTG_INT_DESC...
# MaxBytes[localhost_8]: 1250000
# Title[localhost_8]: Traffic Analysis for 8 -- zeus.local
# PageTop[localhost_8]: <h1>Traffic Analysis for 8 -- ze...
# <div id="sysdetails">
# <table>
# <tr>
# <td>System:</td>
# <td>zeus.local in BCP</td>
# </tr>
# <tr>
# <td>Maintainer:</td>
# <td>server@ujp.jp</td>
# </tr>
# <tr>
# <td>Description:</td>
# <td>p2p0 </td>
# </tr>
# <tr>
# <td>ifType:</td>
# <td>ethernetCsmacd (6)</td>
# </tr>
# <tr>
# <td>ifName:</td>
# <td>p2p0</td>
# </tr>
# <tr>
# <td>Max Speed:</td>
# <td>1250.0 kBytes/s</td>
# </tr>
# <tr>
# <td>Ip:</td>
# <td>No Ip (No DNS name)</td>
# </tr>
# </table>
# </div>
### Interface 9 >> Descr: 'en1' | Name: 'en1' | Ip: 'No ...
### The following interface is commented out because:
### * has no ifSpeed property
#
# Target[localhost_9]: 9:private@localhost:
# SetEnv[localhost_9]: MRTG_INT_IP="No Ip" MRTG_INT_DESC...
# MaxBytes[localhost_9]: 0
# Title[localhost_9]: Traffic Analysis for 9 -- zeus.local
# PageTop[localhost_9]: <h1>Traffic Analysis for 9 -- ze...
# <div id="sysdetails">
# <table>
# <tr>
# <td>System:</td>
# <td>zeus.local in BCP</td>
# </tr>
# <tr>
# <td>Maintainer:</td>
# <td>server@ujp.jp</td>
# </tr>
# <tr>
# <td>Description:</td>
# <td>en1 </td>
# </tr>
# <tr>
# <td>ifType:</td>
# <td>ethernetCsmacd (6)</td>
# </tr>
# <tr>
# <td>ifName:</td>
# <td>en1</td>
# </tr>
# <tr>
# <td>Max Speed:</td>
# <td>0.0 Bytes/s</td>
# </tr>
# <tr>
# <td>Ip:</td>
# <td>No Ip (No DNS name)</td>
# </tr>
# </table>
# </div>
### Interface 10 >> Descr: 'bridge0' | Name: 'bridge0' |...
### The following interface is commented out because:
### * has no ifSpeed property
#
# Target[localhost_10]: 10:private@localhost:
# SetEnv[localhost_10]: MRTG_INT_IP="No Ip" MRTG_INT_DES...
# MaxBytes[localhost_10]: 0
# Title[localhost_10]: Traffic Analysis for 10 -- zeus.l...
# PageTop[localhost_10]: <h1>Traffic Analysis for 10 -- ...
# <div id="sysdetails">
# <table>
# <tr>
# <td>System:</td>
# <td>zeus.local in BCP</td>
# </tr>
# <tr>
# <td>Maintainer:</td>
# <td>server@ujp.jp</td>
# </tr>
# <tr>
# <td>Description:</td>
# <td>bridge0 </td>
# </tr>
# <tr>
# <td>ifType:</td>
# <td>Uknown Interface Type (209)</td>
# </tr>
# <tr>
# <td>ifName:</td>
# <td>bridge0</td>
# </tr>
# <tr>
# <td>Max Speed:</td>
# <td>0.0 Bytes/s</td>
# </tr>
# <tr>
# <td>Ip:</td>
# <td>No Ip (No DNS name)</td>
# </tr>
# </table>
# </div>
### Interface 11 >> Descr: 'utun0' | Name: 'utun0' | Ip:...
### The following interface is commented out because:
### * has no ifSpeed property
#
# Target[localhost_11]: 11:private@localhost:
# SetEnv[localhost_11]: MRTG_INT_IP="No Ip" MRTG_INT_DES...
# MaxBytes[localhost_11]: 0
# Title[localhost_11]: Traffic Analysis for 11 -- zeus.l...
# PageTop[localhost_11]: <h1>Traffic Analysis for 11 -- ...
# <div id="sysdetails">
# <table>
# <tr>
# <td>System:</td>
# <td>zeus.local in BCP</td>
# </tr>
# <tr>
# <td>Maintainer:</td>
# <td>server@ujp.jp</td>
# </tr>
# <tr>
# <td>Description:</td>
# <td>utun0 </td>
# </tr>
# <tr>
# <td>ifType:</td>
# <td>Other (1)</td>
# </tr>
# <tr>
# <td>ifName:</td>
# <td>utun0</td>
# </tr>
# <tr>
# <td>Max Speed:</td>
# <td>0.0 Bytes/s</td>
# </tr>
# <tr>
# <td>Ip:</td>
# <td>No Ip (No DNS name)</td>
# </tr>
# </table>
# </div>
### Interface 12 >> Descr: 'ppp0' | Name: 'ppp0' | Ip: '...
Target[localhost_12]: 12:private@localhost:
SetEnv[localhost_12]: MRTG_INT_IP="192.168.20.231" MRTG_...
MaxBytes[localhost_12]: 12500000
Title[localhost_12]: Traffic Analysis for 12 -- zeus.local
PageTop[localhost_12]: <h1>Traffic Analysis for 12 -- ze...
<div id="sysdetails">
<table>
<tr>
<td>System:</td>
<td>zeus.local in BCP</td>
</tr>
<tr>
<td>Maintainer:</td>
<td>server@ujp.jp</td>
</tr>
<tr>
<td>Description:</td>
<td>ppp0 </td>
</tr>
<tr>
<td>ifType:</td>
<td>ppp (23)</td>
</tr>
<tr>
<td>ifName:</td>
<td>ppp0</td>
</tr>
<tr>
<td>Max Speed:</td>
<td>12.5 MBytes/s</td>
</tr>
<tr>
<td>Ip:</td>
<td>192.168.20.231 (No DNS name)</td>
</tr>
</table>
</div>
$
コメントアウトされている部分は,今回利用しないのでざっ...
今回利用するのは次のように設定.
$ cat mrtg.cfg🆑
### Global Config Options
# for UNIX
WorkDir: /Users/ujpadmin/mrtg🈁
### Global Defaults
# to get bits instead of bytes and graphs growing to th...
Options[_]: growright, bits
EnableIPv6: no
########################################################...
# System: zeus.local
# Contact: 管理者のメールアドレス
# Location: BCP
########################################################...
########################################################...
#Thunderbolt LAN
########################################################...
### Interface 6 >> Descr: 'en3' | Name: 'en3' | Ip: '192...
Target[ThunderboltLAN]: 6:private@localhost:
SetEnv[ThunderboltLAN]: MRTG_INT_IP="192.168.100.10" MRT...
MaxBytes[ThunderboltLAN]: 125000000
Title[ThunderboltLAN]: Traffic Analysis for LAN -- zeus....
PageTop[ThunderboltLAN]: <h1>Traffic Analysis for LAN --...
<div id="sysdetails">
<table>
<tr>
<td>System:</td>
<td>zeus.local in BCP</td>
</tr>
<tr>
<td>Maintainer:</td>
<td>管理者メールアドレス</td>
</tr>
<tr>
<td>Description:</td>
<td>en3 </td>
</tr>
<tr>
<td>ifType:</td>
<td>ethernetCsmacd (6)</td>
</tr>
<tr>
<td>ifName:</td>
<td>en3</td>
</tr>
<tr>
<td>Max Speed:</td>
<td>125.0 MBytes/s</td>
</tr>
<tr>
<td>Ip:</td>
<td>192.168.100.10 (No DNS name)</td>
</tr>
</table>
</div>
########################################################...
#VPN
########################################################...
### Interface 12 >> Descr: 'ppp0' | Name: 'ppp0' | Ip: '...
Target[VPN]: 12:private@localhost:
SetEnv[VPN]: MRTG_INT_IP="192.168.20.231" MRTG_INT_DESCR...
MaxBytes[VPN]: 12500000
Title[VPN]: Traffic Analysis for VPN -- zeus.local
PageTop[VPN]: <h1>Traffic Analysis for VPN -- zeus.local...
<div id="sysdetails">
<table>
<tr>
<td>System:</td>
<td>zeus.local in BCP</td>
</tr>
<tr>
<td>Maintainer:</td>
<td>管理者メールアドレス</td>
</tr>
<tr>
<td>Description:</td>
<td>ppp0 </td>
</tr>
<tr>
<td>ifType:</td>
<td>ppp (23)</td>
</tr>
<tr>
<td>ifName:</td>
<td>ppp0</td>
</tr>
<tr>
<td>Max Speed:</td>
<td>12.5 MBytes/s</td>
</tr>
<tr>
<td>Ip:</td>
<td>192.168.20.231 (No DNS name)</td>
</tr>
</table>
</div>
$
これで問題ないと思う.
**MRTGを実行する
mrtg.cfgファイルを読み込ませながら,mrtgコマンドを実行...
$ mrtg mrtg.cfg🆑
--------------------------------------------------------...
ERROR: Mrtg will most likely not work properly when the ...
variable LANG is set to UTF-8. Please run mrtg in...
where this is not the case. Try the following com...
env LANG=C /usr/local/bin/mrtg mrtg.cfg🈁
--------------------------------------------------------...
$
環境変数がCである必要がある.
指定して3回実行.
$ mrtg mrtg.cfg🆑
Subroutine SNMP_Session::pack_sockaddr_in6 redefined at ...
at /usr/local/bin/../lib/mrtg2/SNMP_Session.pm line 149.
Subroutine SNMPv1_Session::pack_sockaddr_in6 redefined a...
at /usr/local/bin/../lib/mrtg2/SNMP_Session.pm line 604.
2019-05-29 12:53:17, Rateup WARNING: /usr/local/bin/rate...
2019-05-29 12:53:17, Rateup WARNING: /usr/local/bin/rate...
2019-05-29 12:53:17, Rateup WARNING: /usr/local/bin/rate...
2019-05-29 12:53:17, Rateup WARNING: /usr/local/bin/rate...
2019-05-29 12:53:17, Rateup WARNING: /usr/local/bin/rate...
2019-05-29 12:53:17, Rateup WARNING: /usr/local/bin/rate...
$
もう一度.
$ mrtg mrtg.cfg🆑
Subroutine SNMP_Session::pack_sockaddr_in6 redefined at ...
at /usr/local/bin/../lib/mrtg2/SNMP_Session.pm line 149.
Subroutine SNMPv1_Session::pack_sockaddr_in6 redefined a...
at /usr/local/bin/../lib/mrtg2/SNMP_Session.pm line 604.
$
さらにもう一度.
$ mrtg mrtg.cfg🆑
Subroutine SNMP_Session::pack_sockaddr_in6 redefined at ...
at /usr/local/bin/../lib/mrtg2/SNMP_Session.pm line 149.
Subroutine SNMPv1_Session::pack_sockaddr_in6 redefined a...
at /usr/local/bin/../lib/mrtg2/SNMP_Session.pm line 604.
$
3回実行する理由は,初回はファイルが無いのでエラーがで...
***SNMP_Session.pm line 149,SNMP_Session.pm line 604に
このエラーは,Perlのバージョンが新しい場合に出る模様.
コードを書き換えれば修正される.次のように.バックアッ...
$ cp -p /usr/local/bin/mrtg /usr/local/bin/mrtg.v00🆑
$ diff /usr/local/bin/mrtg.v00 /usr/local/bin/mrtg🆑
305c305
< import Socket6;
---
> Socket6->import(qw(inet_pton getaddrinfo));🈁
$
もう1つ.
$ cp -p /usr/local/Cellar/mrtg/2.17.7/lib/mrtg2/SNMP_Ses...
$ diff /usr/local/Cellar/mrtg/2.17.7/lib/mrtg2/SNMP_Sess...
149c149
< Socket6->import(qw(pack_sockaddr_in6 inet_pton ...
---
> Socket6->import(qw(inet_pton getaddrinfo));🈁
604c604
< Socket6->import(qw(pack_sockaddr_in6 inet_pton...
---
> Socket6->import(qw(inet_pton getaddrinfo));🈁
$
再度実行してみる.
$ mrtg mrtg.cfg
$
エラーは出なかった.ファイルを確認.
$ pwd🆑
/Users/ujpadmin/mrtg
$ ls -la🆑
total 288
drwxr-xr-x 22 ujpadmin staff 704 May 29 17:56 .
drwxr-xr-x+ 26 ujpadmin staff 832 May 29 17:29 ..
-rw-r--r-- 1 ujpadmin staff 538 May 29 12:53 mrtg-l....
-rw-r--r-- 1 ujpadmin staff 414 May 29 12:53 mrtg-m....
-rw-r--r-- 1 ujpadmin staff 1759 May 29 12:53 mrtg-r....
-rw-r--r-- 1 ujpadmin staff 2542 May 29 17:00 mrtg.cfg
-rw-r--r-- 1 ujpadmin staff 13435 May 29 12:44 mrtg.cf...
-rw-r--r-- 1 ujpadmin staff 0 May 29 17:56 mrtg.ok
-rw-r--r-- 1 ujpadmin staff 1798 May 29 17:56 thunder...
-rw-r--r-- 1 ujpadmin staff 1544 May 29 17:18 thunder...
-rw-r--r-- 1 ujpadmin staff 1688 May 29 17:56 thunder...
-rw-r--r-- 1 ujpadmin staff 1748 May 29 12:53 thunder...
-rw-r--r-- 1 ujpadmin staff 6362 May 29 17:56 thunder...
-rw-r--r-- 1 ujpadmin staff 49224 May 29 17:56 thunder...
-rw-r--r-- 1 ujpadmin staff 49206 May 29 17:29 thunder...
-rw-r--r-- 1 ujpadmin staff 1761 May 29 17:56 vpn-day...
-rw-r--r-- 1 ujpadmin staff 1514 May 29 17:18 vpn-mon...
-rw-r--r-- 1 ujpadmin staff 1629 May 29 17:56 vpn-wee...
-rw-r--r-- 1 ujpadmin staff 1748 May 29 12:53 vpn-yea...
-rw-r--r-- 1 ujpadmin staff 6309 May 29 17:56 vpn.html
-rw-r--r-- 1 ujpadmin staff 49223 May 29 17:56 vpn.log
-rw-r--r-- 1 ujpadmin staff 49204 May 29 17:29 vpn.old
$
ファイルができていることが確認できた.
**HTMLファイルを作成
MRTGのグラフをWebブラウザで参照するための,インデックス...
これは最初に1回実行すれば良いが,定義を追加した際に,...
インデックス作成用のindexmakerコマンドを探す.
$ locate indexmaker🆑
/usr/local/Cellar/mrtg/2.17.7/bin/indexmaker
/usr/local/Cellar/mrtg/2.17.7/share/doc/mrtg2/indexmaker.1
/usr/local/Cellar/mrtg/2.17.7/share/doc/mrtg2/indexmaker...
/usr/local/Cellar/mrtg/2.17.7/share/doc/mrtg2/indexmaker...
/usr/local/Cellar/mrtg/2.17.7/share/man/man1/indexmaker.1
/usr/local/bin/indexmaker
/usr/local/share/man/man1/indexmaker.1
$
コマンドヘルプを確認.
$ /usr/local/bin/indexmaker -h🆑
Option h is ambiguous (headeradd, headeradd-file, headle...
Usage:
indexmaker [options] mrtg.cfg [other.cfg ...]
Options:
--output=filename set output filename (default: s...
--filter title=~regexp select targets by matching ...
--filter pagetop=~regexp select targets by matchin...
--filter name=~regexp select targets by matchin re...
--addhead=text insert this text between </TITL...
--title=text set title of generated index file
--subtitle=text add a subtitle to the generated...
--bodyopt=text set body tag options
--headlevel=number use <Hnumber> at top of page (d...
--pagetop=text insert this text between <BODY>...
--pageend=text insert this text after the main...
--pagetopend=text use this text for pagetop or pa...
--nolegend do not add the Mrtg legend at t...
--columns=number show graphs in a table with x c...
--perhost show graphs of the same host on...
--compact try to make a vertically more c...
--optlog log the used command line in th...
--sort=title sort graphs by title
--sort=name sort graphs by their name
--sort=descr sort graphs by their description
--sort=original leave as is (default)
--enumerate add a sequence number to the ti...
--picfirst place pictures before text (def...
--width=number set width of graphs (default: n...
--height=number
--sidebyside place text / pictures side by s...
--bold use bold text (default: bold)
--clicktext make the text link to the inner...
--show=day pick which graph to show in the...
--show=week
--show=month
--show=year
--show=none
--section=h1 h1 tag from pagetop as section ...
--section=title title as section headings for g...
--section=name graph name as section heading
--section=descr graph description as section he...
--section=ifname interface name (ifName) as sect...
--section=portname port name entry in pagetop as s...
--sectionhost Try to prepend the host to the ...
--rrdviewer=path path to rrdviewer (default: /cg...
--icondir=path path to icondir
--prefix=path path from the location of the i...
--headeradd=string add string to the html page hea...
--autoprefix try to set prefix automatically
--<opt>-file=file read string argument for option...
$
今回は,パラメータを指定せずに,デフォルトで実行.
実行結果は標準出力にでてくるので,ファイルへリダイレク...
$ indexmaker mrtg.cfg > index.html🆑
$ ls -la index.html🆑
-rw-r--r-- 1 ujpadmin staff 2644 May 29 18:28 index.html🈁
$
あとは,作成されたHTMLをWebブラウザで表示させる.
**番外
こんなエラーがでるとき.
$ mrtg mrtg.cfg
Subroutine SNMP_Session::pack_sockaddr_in6 redefined at ...
at /usr/local/bin/../lib/mrtg2/SNMP_Session.pm line 149.
Subroutine SNMPv1_Session::pack_sockaddr_in6 redefined a...
at /usr/local/bin/../lib/mrtg2/SNMP_Session.pm line 604.
2020-08-11 00:55:54, Rateup WARNING: /usr/local/bin/rate...
2020-08-11 00:55:54, Rateup WARNING: /usr/local/bin/rate...
2020-08-11 00:55:54, Rateup WARNING: /usr/local/bin/rate...
$
vi /usr/bin/mrtgで開いて,次のように書き換える.
変更前:import Socket6
変更後:Socket6->import(qw(inet_pton getaddrinfo));
次に,vi /usr/local/bin/../lib/mrtg2/SNMP_Session.pm で
変更前:if (eval {local $SIG{__DIE__};require Socket6;} &&
変更後:if (eval {local $SIG{__DIE__};Socket6->import(qw...
原因は,Perlのバージョンアップとのこと.
終了行:
*macOS High SierraにMRTGを設定
**はじめに
MRTGとは,マルチルータトラフィックグラファーの略.ルー...
**インストール
インストールはHomeBrewでおこなった.特に問題もなかった.
$ brew info mrtg🆑
mrtg: stable 2.17.7 (bottled)🈁
Multi router traffic grapher
https://oss.oetiker.ch/mrtg/
/usr/local/Cellar/mrtg/2.17.7 (110 files, 2.4MB) *
Poured from bottle on 2019-05-07 at 00:48:32
From: https://github.com/Homebrew/homebrew-core/blob/mas...
==> Dependencies
Required: gd ✔
==> Analytics
install: 30 (30 days), 76 (90 days), 458 (365 days)
install_on_request: 26 (30 days), 69 (90 days), 381 (365...
build_error: 0 (30 days)
$
インストールされたか,コマンドの場所を確認.
まずは,mrtgコマンド.
$ which mrtg🆑
/usr/local/bin/mrtg🈁
$
そして,設定ファイルを自動的に作成してくれる,cfgmaker...
$ which cfgmaker🆑
/usr/local/bin/cfgmaker🈁
$
**初期設定
まずは,SNMPD.CONFにあるコミュニティ名を確認.
$ grep com2sec /etc/snmp/snmpd.conf🆑
com2sec local localhost private🈁
com2sec mynetwork NETWORK/24 public
$
"private"だとわかった.
cfgmakerコマンドを指定し,privateコミュニティの初期設定...
$ cfgmaker private@localhost > mrtg.cfg🆑
Subroutine SNMP_Session::pack_sockaddr_in6 redefined at ...
line 66. at /usr/local/bin/../lib/mrtg2/SNMP_Session.pm...
Subroutine SNMPv1_Session::pack_sockaddr_in6 redefined a...
line 66. at /usr/local/bin/../lib/mrtg2/SNMP_Session.pm...
--base: Get Device Info on private@localhost:
--base: Vendor Id: Unknown Vendor - 1.3.6.1.4.1.8072.3.2...
--base: Populating confcache
--base: Get Interface Info
--base: Walking ifIndex
--snpd: private@localhost: -> 1 -> ifIndex = 1
--snpd: private@localhost: -> 2 -> ifIndex = 2
--snpd: private@localhost: -> 3 -> ifIndex = 3
--snpd: private@localhost: -> 4 -> ifIndex = 4
--snpd: private@localhost: -> 5 -> ifIndex = 5
--snpd: private@localhost: -> 6 -> ifIndex = 6
--snpd: private@localhost: -> 7 -> ifIndex = 7
--snpd: private@localhost: -> 8 -> ifIndex = 8
--snpd: private@localhost: -> 9 -> ifIndex = 9
--snpd: private@localhost: -> 10 -> ifIndex = 10
--snpd: private@localhost: -> 11 -> ifIndex = 11
--snpd: private@localhost: -> 12 -> ifIndex = 12
--base: Walking ifType
--snpd: private@localhost: -> 1 -> ifType = 24
--snpd: private@localhost: -> 2 -> ifType = 55
--snpd: private@localhost: -> 3 -> ifType = 57
--snpd: private@localhost: -> 4 -> ifType = 1
--snpd: private@localhost: -> 5 -> ifType = 1
--snpd: private@localhost: -> 6 -> ifType = 6
--snpd: private@localhost: -> 7 -> ifType = 6
--snpd: private@localhost: -> 8 -> ifType = 6
--snpd: private@localhost: -> 9 -> ifType = 6
--snpd: private@localhost: -> 10 -> ifType = 209
--snpd: private@localhost: -> 11 -> ifType = 1
--snpd: private@localhost: -> 12 -> ifType = 23
--base: Walking ifAdminStatus
--snpd: private@localhost: -> 1 -> ifAdminStatus = 1
--snpd: private@localhost: -> 2 -> ifAdminStatus = 2
--snpd: private@localhost: -> 3 -> ifAdminStatus = 2
--snpd: private@localhost: -> 4 -> ifAdminStatus = 2
--snpd: private@localhost: -> 5 -> ifAdminStatus = 2
--snpd: private@localhost: -> 6 -> ifAdminStatus = 1
--snpd: private@localhost: -> 7 -> ifAdminStatus = 1
--snpd: private@localhost: -> 8 -> ifAdminStatus = 2
--snpd: private@localhost: -> 9 -> ifAdminStatus = 1
--snpd: private@localhost: -> 10 -> ifAdminStatus = 1
--snpd: private@localhost: -> 11 -> ifAdminStatus = 1
--snpd: private@localhost: -> 12 -> ifAdminStatus = 1
--base: Walking ifOperStatus
--snpd: private@localhost: -> 1 -> ifOperStatus = 1
--snpd: private@localhost: -> 2 -> ifOperStatus = 2
--snpd: private@localhost: -> 3 -> ifOperStatus = 2
--snpd: private@localhost: -> 4 -> ifOperStatus = 2
--snpd: private@localhost: -> 5 -> ifOperStatus = 2
--snpd: private@localhost: -> 6 -> ifOperStatus = 1
--snpd: private@localhost: -> 7 -> ifOperStatus = 2
--snpd: private@localhost: -> 8 -> ifOperStatus = 2
--snpd: private@localhost: -> 9 -> ifOperStatus = 1
--snpd: private@localhost: -> 10 -> ifOperStatus = 1
--snpd: private@localhost: -> 11 -> ifOperStatus = 1
--snpd: private@localhost: -> 12 -> ifOperStatus = 1
--base: Walking ifMtu
--snpd: private@localhost: -> 1 -> ifMtu = 16384
--snpd: private@localhost: -> 2 -> ifMtu = 1280
--snpd: private@localhost: -> 3 -> ifMtu = 1280
--snpd: private@localhost: -> 4 -> ifMtu = 0
--snpd: private@localhost: -> 5 -> ifMtu = 0
--snpd: private@localhost: -> 6 -> ifMtu = 1500
--snpd: private@localhost: -> 7 -> ifMtu = 1500
--snpd: private@localhost: -> 8 -> ifMtu = 2304
--snpd: private@localhost: -> 9 -> ifMtu = 1500
--snpd: private@localhost: -> 10 -> ifMtu = 1500
--snpd: private@localhost: -> 11 -> ifMtu = 2000
--snpd: private@localhost: -> 12 -> ifMtu = 1280
--base: Walking ifSpeed
--snpd: private@localhost: -> 1 -> ifSpeed = 0
--snpd: private@localhost: -> 2 -> ifSpeed = 0
--snpd: private@localhost: -> 3 -> ifSpeed = 0
--snpd: private@localhost: -> 4 -> ifSpeed = 0
--snpd: private@localhost: -> 5 -> ifSpeed = 0
--snpd: private@localhost: -> 6 -> ifSpeed = 1000000000
--snpd: private@localhost: -> 7 -> ifSpeed = 0
--snpd: private@localhost: -> 8 -> ifSpeed = 10000000
--snpd: private@localhost: -> 9 -> ifSpeed = 0
--snpd: private@localhost: -> 10 -> ifSpeed = 0
--snpd: private@localhost: -> 11 -> ifSpeed = 0
--snpd: private@localhost: -> 12 -> ifSpeed = 100000000
$
自動作成された設定ファイルを確認.
$ cat mrtg.cfg🆑
# Created by
# /usr/local/bin/cfgmaker private@localhost
### Global Config Options
# for UNIX
# WorkDir: /home/http/mrtg
# or for NT
# WorkDir: c:\mrtgdata
### Global Defaults
# to get bits instead of bytes and graphs growing to th...
# Options[_]: growright, bits
EnableIPv6: no
########################################################...
# System: zeus.local
# Description: Darwin zeus.local 17.7.0 Darwin Kernel Ve...
Wed Feb 27 00:43:23 PST 2019; root:xnu-4570.71.35~1/RELE...
# Contact: サーバ管理者メールアドレス
# Location: BCP
########################################################...
### Interface 1 >> Descr: 'lo0' | Name: 'lo0' | Ip: '127...
### The following interface is commented out because:
### * it is a Software Loopback interface
### * has no ifSpeed property
#
# Target[localhost_1]: 1:private@localhost:
# SetEnv[localhost_1]: MRTG_INT_IP="127.0.0.1" MRTG_INT_...
# MaxBytes[localhost_1]: 0
# Title[localhost_1]: Traffic Analysis for 1 -- zeus.local
# PageTop[localhost_1]: <h1>Traffic Analysis for 1 -- ze...
# <div id="sysdetails">
# <table>
# <tr>
# <td>System:</td>
# <td>zeus.local in BCP</td>
# </tr>
# <tr>
# <td>Maintainer:</td>
# <td>サーバ管理者メールアドレス</td>
# </tr>
# <tr>
# <td>Description:</td>
# <td>lo0 </td>
# </tr>
# <tr>
# <td>ifType:</td>
# <td>softwareLoopback (24)</td>
# </tr>
# <tr>
# <td>ifName:</td>
# <td>lo0</td>
# </tr>
# <tr>
# <td>Max Speed:</td>
# <td>0.0 Bytes/s</td>
# </tr>
# <tr>
# <td>Ip:</td>
# <td>127.0.0.1 (localhost)</td>
# </tr>
# </table>
# </div>
### Interface 2 >> Descr: 'gif0' | Name: 'gif0' | Ip: 'N...
### The following interface is commented out because:
### * it is administratively DOWN
### * it is operationally DOWN
### * has no ifSpeed property
#
# Target[localhost_2]: 2:private@localhost:
# SetEnv[localhost_2]: MRTG_INT_IP="No Ip" MRTG_INT_DESC...
# MaxBytes[localhost_2]: 0
# Title[localhost_2]: Traffic Analysis for 2 -- zeus.local
# PageTop[localhost_2]: <h1>Traffic Analysis for 2 -- ze...
# <div id="sysdetails">
# <table>
# <tr>
# <td>System:</td>
# <td>zeus.local in BCP</td>
# </tr>
# <tr>
# <td>Maintainer:</td>
# <td>server@ujp.jp</td>
# </tr>
# <tr>
# <td>Description:</td>
# <td>gif0 </td>
# </tr>
# <tr>
# <td>ifType:</td>
# <td>100BaseVG (55)</td>
# </tr>
# <tr>
# <td>ifName:</td>
# <td>gif0</td>
# </tr>
# <tr>
# <td>Max Speed:</td>
# <td>0.0 Bytes/s</td>
# </tr>
# <tr>
# <td>Ip:</td>
# <td>No Ip (No DNS name)</td>
# </tr>
# </table>
# </div>
### Interface 3 >> Descr: 'stf0' | Name: 'stf0' | Ip: 'N...
### The following interface is commented out because:
### * it is administratively DOWN
### * it is operationally DOWN
### * has no ifSpeed property
#
# Target[localhost_3]: 3:private@localhost:
# SetEnv[localhost_3]: MRTG_INT_IP="No Ip" MRTG_INT_DESC...
# MaxBytes[localhost_3]: 0
# Title[localhost_3]: Traffic Analysis for 3 -- zeus.local
# PageTop[localhost_3]: <h1>Traffic Analysis for 3 -- ze...
# <div id="sysdetails">
# <table>
# <tr>
# <td>System:</td>
# <td>zeus.local in BCP</td>
# </tr>
# <tr>
# <td>Maintainer:</td>
# <td>server@ujp.jp</td>
# </tr>
# <tr>
# <td>Description:</td>
# <td>stf0 </td>
# </tr>
# <tr>
# <td>ifType:</td>
# <td>HIPPI Interface (57)</td>
# </tr>
# <tr>
# <td>ifName:</td>
# <td>stf0</td>
# </tr>
# <tr>
# <td>Max Speed:</td>
# <td>0.0 Bytes/s</td>
# </tr>
# <tr>
# <td>Ip:</td>
# <td>No Ip (No DNS name)</td>
# </tr>
# </table>
# </div>
### Interface 4 >> Descr: 'EHC253' | Name: 'EHC253' | Ip...
### The following interface is commented out because:
### * it is administratively DOWN
### * it is operationally DOWN
### * has no ifSpeed property
#
# Target[localhost_4]: 4:private@localhost:
# SetEnv[localhost_4]: MRTG_INT_IP="No Ip" MRTG_INT_DESC...
# MaxBytes[localhost_4]: 0
# Title[localhost_4]: Traffic Analysis for 4 -- zeus.local
# PageTop[localhost_4]: <h1>Traffic Analysis for 4 -- ze...
# <div id="sysdetails">
# <table>
# <tr>
# <td>System:</td>
# <td>zeus.local in BCP</td>
# </tr>
# <tr>
# <td>Maintainer:</td>
# <td>server@ujp.jp</td>
# </tr>
# <tr>
# <td>Description:</td>
# <td>EHC253 </td>
# </tr>
# <tr>
# <td>ifType:</td>
# <td>Other (1)</td>
# </tr>
# <tr>
# <td>ifName:</td>
# <td>EHC253</td>
# </tr>
# <tr>
# <td>Max Speed:</td>
# <td>0.0 Bytes/s</td>
# </tr>
# <tr>
# <td>Ip:</td>
# <td>No Ip (No DNS name)</td>
# </tr>
# </table>
# </div>
### Interface 5 >> Descr: 'EHC250' | Name: 'EHC250' | Ip...
### The following interface is commented out because:
### * it is administratively DOWN
### * it is operationally DOWN
### * has no ifSpeed property
#
# Target[localhost_5]: 5:private@localhost:
# SetEnv[localhost_5]: MRTG_INT_IP="No Ip" MRTG_INT_DESC...
# MaxBytes[localhost_5]: 0
# Title[localhost_5]: Traffic Analysis for 5 -- zeus.local
# PageTop[localhost_5]: <h1>Traffic Analysis for 5 -- ze...
# <div id="sysdetails">
# <table>
# <tr>
# <td>System:</td>
# <td>zeus.local in BCP</td>
# </tr>
# <tr>
# <td>Maintainer:</td>
# <td>server@ujp.jp</td>
# </tr>
# <tr>
# <td>Description:</td>
# <td>EHC250 </td>
# </tr>
# <tr>
# <td>ifType:</td>
# <td>Other (1)</td>
# </tr>
# <tr>
# <td>ifName:</td>
# <td>EHC250</td>
# </tr>
# <tr>
# <td>Max Speed:</td>
# <td>0.0 Bytes/s</td>
# </tr>
# <tr>
# <td>Ip:</td>
# <td>No Ip (No DNS name)</td>
# </tr>
# </table>
# </div>
### Interface 6 >> Descr: 'en3' | Name: 'en3' | Ip: '192...
Target[localhost_6]: 6:private@localhost:
SetEnv[localhost_6]: MRTG_INT_IP="192.168.100.10" MRTG_I...
MaxBytes[localhost_6]: 125000000
Title[localhost_6]: Traffic Analysis for 6 -- zeus.local
PageTop[localhost_6]: <h1>Traffic Analysis for 6 -- zeus...
<div id="sysdetails">
<table>
<tr>
<td>System:</td>
<td>zeus.local in BCP</td>
</tr>
<tr>
<td>Maintainer:</td>
<td>server@ujp.jp</td>
</tr>
<tr>
<td>Description:</td>
<td>en3 </td>
</tr>
<tr>
<td>ifType:</td>
<td>ethernetCsmacd (6)</td>
</tr>
<tr>
<td>ifName:</td>
<td>en3</td>
</tr>
<tr>
<td>Max Speed:</td>
<td>125.0 MBytes/s</td>
</tr>
<tr>
<td>Ip:</td>
<td>192.168.100.10 (No DNS name)</td>
</tr>
</table>
</div>
### Interface 7 >> Descr: 'en0' | Name: 'en0' | Ip: 'No ...
### The following interface is commented out because:
### * it is operationally DOWN
### * has no ifSpeed property
#
# Target[localhost_7]: 7:private@localhost:
# SetEnv[localhost_7]: MRTG_INT_IP="No Ip" MRTG_INT_DESC...
# MaxBytes[localhost_7]: 0
# Title[localhost_7]: Traffic Analysis for 7 -- zeus.local
# PageTop[localhost_7]: <h1>Traffic Analysis for 7 -- ze...
# <div id="sysdetails">
# <table>
# <tr>
# <td>System:</td>
# <td>zeus.local in BCP</td>
# </tr>
# <tr>
# <td>Maintainer:</td>
# <td>server@ujp.jp</td>
# </tr>
# <tr>
# <td>Description:</td>
# <td>en0 </td>
# </tr>
# <tr>
# <td>ifType:</td>
# <td>ethernetCsmacd (6)</td>
# </tr>
# <tr>
# <td>ifName:</td>
# <td>en0</td>
# </tr>
# <tr>
# <td>Max Speed:</td>
# <td>0.0 Bytes/s</td>
# </tr>
# <tr>
# <td>Ip:</td>
# <td>No Ip (No DNS name)</td>
# </tr>
# </table>
# </div>
### Interface 8 >> Descr: 'p2p0' | Name: 'p2p0' | Ip: 'N...
### The following interface is commented out because:
### * it is administratively DOWN
### * it is operationally DOWN
#
# Target[localhost_8]: 8:private@localhost:
# SetEnv[localhost_8]: MRTG_INT_IP="No Ip" MRTG_INT_DESC...
# MaxBytes[localhost_8]: 1250000
# Title[localhost_8]: Traffic Analysis for 8 -- zeus.local
# PageTop[localhost_8]: <h1>Traffic Analysis for 8 -- ze...
# <div id="sysdetails">
# <table>
# <tr>
# <td>System:</td>
# <td>zeus.local in BCP</td>
# </tr>
# <tr>
# <td>Maintainer:</td>
# <td>server@ujp.jp</td>
# </tr>
# <tr>
# <td>Description:</td>
# <td>p2p0 </td>
# </tr>
# <tr>
# <td>ifType:</td>
# <td>ethernetCsmacd (6)</td>
# </tr>
# <tr>
# <td>ifName:</td>
# <td>p2p0</td>
# </tr>
# <tr>
# <td>Max Speed:</td>
# <td>1250.0 kBytes/s</td>
# </tr>
# <tr>
# <td>Ip:</td>
# <td>No Ip (No DNS name)</td>
# </tr>
# </table>
# </div>
### Interface 9 >> Descr: 'en1' | Name: 'en1' | Ip: 'No ...
### The following interface is commented out because:
### * has no ifSpeed property
#
# Target[localhost_9]: 9:private@localhost:
# SetEnv[localhost_9]: MRTG_INT_IP="No Ip" MRTG_INT_DESC...
# MaxBytes[localhost_9]: 0
# Title[localhost_9]: Traffic Analysis for 9 -- zeus.local
# PageTop[localhost_9]: <h1>Traffic Analysis for 9 -- ze...
# <div id="sysdetails">
# <table>
# <tr>
# <td>System:</td>
# <td>zeus.local in BCP</td>
# </tr>
# <tr>
# <td>Maintainer:</td>
# <td>server@ujp.jp</td>
# </tr>
# <tr>
# <td>Description:</td>
# <td>en1 </td>
# </tr>
# <tr>
# <td>ifType:</td>
# <td>ethernetCsmacd (6)</td>
# </tr>
# <tr>
# <td>ifName:</td>
# <td>en1</td>
# </tr>
# <tr>
# <td>Max Speed:</td>
# <td>0.0 Bytes/s</td>
# </tr>
# <tr>
# <td>Ip:</td>
# <td>No Ip (No DNS name)</td>
# </tr>
# </table>
# </div>
### Interface 10 >> Descr: 'bridge0' | Name: 'bridge0' |...
### The following interface is commented out because:
### * has no ifSpeed property
#
# Target[localhost_10]: 10:private@localhost:
# SetEnv[localhost_10]: MRTG_INT_IP="No Ip" MRTG_INT_DES...
# MaxBytes[localhost_10]: 0
# Title[localhost_10]: Traffic Analysis for 10 -- zeus.l...
# PageTop[localhost_10]: <h1>Traffic Analysis for 10 -- ...
# <div id="sysdetails">
# <table>
# <tr>
# <td>System:</td>
# <td>zeus.local in BCP</td>
# </tr>
# <tr>
# <td>Maintainer:</td>
# <td>server@ujp.jp</td>
# </tr>
# <tr>
# <td>Description:</td>
# <td>bridge0 </td>
# </tr>
# <tr>
# <td>ifType:</td>
# <td>Uknown Interface Type (209)</td>
# </tr>
# <tr>
# <td>ifName:</td>
# <td>bridge0</td>
# </tr>
# <tr>
# <td>Max Speed:</td>
# <td>0.0 Bytes/s</td>
# </tr>
# <tr>
# <td>Ip:</td>
# <td>No Ip (No DNS name)</td>
# </tr>
# </table>
# </div>
### Interface 11 >> Descr: 'utun0' | Name: 'utun0' | Ip:...
### The following interface is commented out because:
### * has no ifSpeed property
#
# Target[localhost_11]: 11:private@localhost:
# SetEnv[localhost_11]: MRTG_INT_IP="No Ip" MRTG_INT_DES...
# MaxBytes[localhost_11]: 0
# Title[localhost_11]: Traffic Analysis for 11 -- zeus.l...
# PageTop[localhost_11]: <h1>Traffic Analysis for 11 -- ...
# <div id="sysdetails">
# <table>
# <tr>
# <td>System:</td>
# <td>zeus.local in BCP</td>
# </tr>
# <tr>
# <td>Maintainer:</td>
# <td>server@ujp.jp</td>
# </tr>
# <tr>
# <td>Description:</td>
# <td>utun0 </td>
# </tr>
# <tr>
# <td>ifType:</td>
# <td>Other (1)</td>
# </tr>
# <tr>
# <td>ifName:</td>
# <td>utun0</td>
# </tr>
# <tr>
# <td>Max Speed:</td>
# <td>0.0 Bytes/s</td>
# </tr>
# <tr>
# <td>Ip:</td>
# <td>No Ip (No DNS name)</td>
# </tr>
# </table>
# </div>
### Interface 12 >> Descr: 'ppp0' | Name: 'ppp0' | Ip: '...
Target[localhost_12]: 12:private@localhost:
SetEnv[localhost_12]: MRTG_INT_IP="192.168.20.231" MRTG_...
MaxBytes[localhost_12]: 12500000
Title[localhost_12]: Traffic Analysis for 12 -- zeus.local
PageTop[localhost_12]: <h1>Traffic Analysis for 12 -- ze...
<div id="sysdetails">
<table>
<tr>
<td>System:</td>
<td>zeus.local in BCP</td>
</tr>
<tr>
<td>Maintainer:</td>
<td>server@ujp.jp</td>
</tr>
<tr>
<td>Description:</td>
<td>ppp0 </td>
</tr>
<tr>
<td>ifType:</td>
<td>ppp (23)</td>
</tr>
<tr>
<td>ifName:</td>
<td>ppp0</td>
</tr>
<tr>
<td>Max Speed:</td>
<td>12.5 MBytes/s</td>
</tr>
<tr>
<td>Ip:</td>
<td>192.168.20.231 (No DNS name)</td>
</tr>
</table>
</div>
$
コメントアウトされている部分は,今回利用しないのでざっ...
今回利用するのは次のように設定.
$ cat mrtg.cfg🆑
### Global Config Options
# for UNIX
WorkDir: /Users/ujpadmin/mrtg🈁
### Global Defaults
# to get bits instead of bytes and graphs growing to th...
Options[_]: growright, bits
EnableIPv6: no
########################################################...
# System: zeus.local
# Contact: 管理者のメールアドレス
# Location: BCP
########################################################...
########################################################...
#Thunderbolt LAN
########################################################...
### Interface 6 >> Descr: 'en3' | Name: 'en3' | Ip: '192...
Target[ThunderboltLAN]: 6:private@localhost:
SetEnv[ThunderboltLAN]: MRTG_INT_IP="192.168.100.10" MRT...
MaxBytes[ThunderboltLAN]: 125000000
Title[ThunderboltLAN]: Traffic Analysis for LAN -- zeus....
PageTop[ThunderboltLAN]: <h1>Traffic Analysis for LAN --...
<div id="sysdetails">
<table>
<tr>
<td>System:</td>
<td>zeus.local in BCP</td>
</tr>
<tr>
<td>Maintainer:</td>
<td>管理者メールアドレス</td>
</tr>
<tr>
<td>Description:</td>
<td>en3 </td>
</tr>
<tr>
<td>ifType:</td>
<td>ethernetCsmacd (6)</td>
</tr>
<tr>
<td>ifName:</td>
<td>en3</td>
</tr>
<tr>
<td>Max Speed:</td>
<td>125.0 MBytes/s</td>
</tr>
<tr>
<td>Ip:</td>
<td>192.168.100.10 (No DNS name)</td>
</tr>
</table>
</div>
########################################################...
#VPN
########################################################...
### Interface 12 >> Descr: 'ppp0' | Name: 'ppp0' | Ip: '...
Target[VPN]: 12:private@localhost:
SetEnv[VPN]: MRTG_INT_IP="192.168.20.231" MRTG_INT_DESCR...
MaxBytes[VPN]: 12500000
Title[VPN]: Traffic Analysis for VPN -- zeus.local
PageTop[VPN]: <h1>Traffic Analysis for VPN -- zeus.local...
<div id="sysdetails">
<table>
<tr>
<td>System:</td>
<td>zeus.local in BCP</td>
</tr>
<tr>
<td>Maintainer:</td>
<td>管理者メールアドレス</td>
</tr>
<tr>
<td>Description:</td>
<td>ppp0 </td>
</tr>
<tr>
<td>ifType:</td>
<td>ppp (23)</td>
</tr>
<tr>
<td>ifName:</td>
<td>ppp0</td>
</tr>
<tr>
<td>Max Speed:</td>
<td>12.5 MBytes/s</td>
</tr>
<tr>
<td>Ip:</td>
<td>192.168.20.231 (No DNS name)</td>
</tr>
</table>
</div>
$
これで問題ないと思う.
**MRTGを実行する
mrtg.cfgファイルを読み込ませながら,mrtgコマンドを実行...
$ mrtg mrtg.cfg🆑
--------------------------------------------------------...
ERROR: Mrtg will most likely not work properly when the ...
variable LANG is set to UTF-8. Please run mrtg in...
where this is not the case. Try the following com...
env LANG=C /usr/local/bin/mrtg mrtg.cfg🈁
--------------------------------------------------------...
$
環境変数がCである必要がある.
指定して3回実行.
$ mrtg mrtg.cfg🆑
Subroutine SNMP_Session::pack_sockaddr_in6 redefined at ...
at /usr/local/bin/../lib/mrtg2/SNMP_Session.pm line 149.
Subroutine SNMPv1_Session::pack_sockaddr_in6 redefined a...
at /usr/local/bin/../lib/mrtg2/SNMP_Session.pm line 604.
2019-05-29 12:53:17, Rateup WARNING: /usr/local/bin/rate...
2019-05-29 12:53:17, Rateup WARNING: /usr/local/bin/rate...
2019-05-29 12:53:17, Rateup WARNING: /usr/local/bin/rate...
2019-05-29 12:53:17, Rateup WARNING: /usr/local/bin/rate...
2019-05-29 12:53:17, Rateup WARNING: /usr/local/bin/rate...
2019-05-29 12:53:17, Rateup WARNING: /usr/local/bin/rate...
$
もう一度.
$ mrtg mrtg.cfg🆑
Subroutine SNMP_Session::pack_sockaddr_in6 redefined at ...
at /usr/local/bin/../lib/mrtg2/SNMP_Session.pm line 149.
Subroutine SNMPv1_Session::pack_sockaddr_in6 redefined a...
at /usr/local/bin/../lib/mrtg2/SNMP_Session.pm line 604.
$
さらにもう一度.
$ mrtg mrtg.cfg🆑
Subroutine SNMP_Session::pack_sockaddr_in6 redefined at ...
at /usr/local/bin/../lib/mrtg2/SNMP_Session.pm line 149.
Subroutine SNMPv1_Session::pack_sockaddr_in6 redefined a...
at /usr/local/bin/../lib/mrtg2/SNMP_Session.pm line 604.
$
3回実行する理由は,初回はファイルが無いのでエラーがで...
***SNMP_Session.pm line 149,SNMP_Session.pm line 604に
このエラーは,Perlのバージョンが新しい場合に出る模様.
コードを書き換えれば修正される.次のように.バックアッ...
$ cp -p /usr/local/bin/mrtg /usr/local/bin/mrtg.v00🆑
$ diff /usr/local/bin/mrtg.v00 /usr/local/bin/mrtg🆑
305c305
< import Socket6;
---
> Socket6->import(qw(inet_pton getaddrinfo));🈁
$
もう1つ.
$ cp -p /usr/local/Cellar/mrtg/2.17.7/lib/mrtg2/SNMP_Ses...
$ diff /usr/local/Cellar/mrtg/2.17.7/lib/mrtg2/SNMP_Sess...
149c149
< Socket6->import(qw(pack_sockaddr_in6 inet_pton ...
---
> Socket6->import(qw(inet_pton getaddrinfo));🈁
604c604
< Socket6->import(qw(pack_sockaddr_in6 inet_pton...
---
> Socket6->import(qw(inet_pton getaddrinfo));🈁
$
再度実行してみる.
$ mrtg mrtg.cfg
$
エラーは出なかった.ファイルを確認.
$ pwd🆑
/Users/ujpadmin/mrtg
$ ls -la🆑
total 288
drwxr-xr-x 22 ujpadmin staff 704 May 29 17:56 .
drwxr-xr-x+ 26 ujpadmin staff 832 May 29 17:29 ..
-rw-r--r-- 1 ujpadmin staff 538 May 29 12:53 mrtg-l....
-rw-r--r-- 1 ujpadmin staff 414 May 29 12:53 mrtg-m....
-rw-r--r-- 1 ujpadmin staff 1759 May 29 12:53 mrtg-r....
-rw-r--r-- 1 ujpadmin staff 2542 May 29 17:00 mrtg.cfg
-rw-r--r-- 1 ujpadmin staff 13435 May 29 12:44 mrtg.cf...
-rw-r--r-- 1 ujpadmin staff 0 May 29 17:56 mrtg.ok
-rw-r--r-- 1 ujpadmin staff 1798 May 29 17:56 thunder...
-rw-r--r-- 1 ujpadmin staff 1544 May 29 17:18 thunder...
-rw-r--r-- 1 ujpadmin staff 1688 May 29 17:56 thunder...
-rw-r--r-- 1 ujpadmin staff 1748 May 29 12:53 thunder...
-rw-r--r-- 1 ujpadmin staff 6362 May 29 17:56 thunder...
-rw-r--r-- 1 ujpadmin staff 49224 May 29 17:56 thunder...
-rw-r--r-- 1 ujpadmin staff 49206 May 29 17:29 thunder...
-rw-r--r-- 1 ujpadmin staff 1761 May 29 17:56 vpn-day...
-rw-r--r-- 1 ujpadmin staff 1514 May 29 17:18 vpn-mon...
-rw-r--r-- 1 ujpadmin staff 1629 May 29 17:56 vpn-wee...
-rw-r--r-- 1 ujpadmin staff 1748 May 29 12:53 vpn-yea...
-rw-r--r-- 1 ujpadmin staff 6309 May 29 17:56 vpn.html
-rw-r--r-- 1 ujpadmin staff 49223 May 29 17:56 vpn.log
-rw-r--r-- 1 ujpadmin staff 49204 May 29 17:29 vpn.old
$
ファイルができていることが確認できた.
**HTMLファイルを作成
MRTGのグラフをWebブラウザで参照するための,インデックス...
これは最初に1回実行すれば良いが,定義を追加した際に,...
インデックス作成用のindexmakerコマンドを探す.
$ locate indexmaker🆑
/usr/local/Cellar/mrtg/2.17.7/bin/indexmaker
/usr/local/Cellar/mrtg/2.17.7/share/doc/mrtg2/indexmaker.1
/usr/local/Cellar/mrtg/2.17.7/share/doc/mrtg2/indexmaker...
/usr/local/Cellar/mrtg/2.17.7/share/doc/mrtg2/indexmaker...
/usr/local/Cellar/mrtg/2.17.7/share/man/man1/indexmaker.1
/usr/local/bin/indexmaker
/usr/local/share/man/man1/indexmaker.1
$
コマンドヘルプを確認.
$ /usr/local/bin/indexmaker -h🆑
Option h is ambiguous (headeradd, headeradd-file, headle...
Usage:
indexmaker [options] mrtg.cfg [other.cfg ...]
Options:
--output=filename set output filename (default: s...
--filter title=~regexp select targets by matching ...
--filter pagetop=~regexp select targets by matchin...
--filter name=~regexp select targets by matchin re...
--addhead=text insert this text between </TITL...
--title=text set title of generated index file
--subtitle=text add a subtitle to the generated...
--bodyopt=text set body tag options
--headlevel=number use <Hnumber> at top of page (d...
--pagetop=text insert this text between <BODY>...
--pageend=text insert this text after the main...
--pagetopend=text use this text for pagetop or pa...
--nolegend do not add the Mrtg legend at t...
--columns=number show graphs in a table with x c...
--perhost show graphs of the same host on...
--compact try to make a vertically more c...
--optlog log the used command line in th...
--sort=title sort graphs by title
--sort=name sort graphs by their name
--sort=descr sort graphs by their description
--sort=original leave as is (default)
--enumerate add a sequence number to the ti...
--picfirst place pictures before text (def...
--width=number set width of graphs (default: n...
--height=number
--sidebyside place text / pictures side by s...
--bold use bold text (default: bold)
--clicktext make the text link to the inner...
--show=day pick which graph to show in the...
--show=week
--show=month
--show=year
--show=none
--section=h1 h1 tag from pagetop as section ...
--section=title title as section headings for g...
--section=name graph name as section heading
--section=descr graph description as section he...
--section=ifname interface name (ifName) as sect...
--section=portname port name entry in pagetop as s...
--sectionhost Try to prepend the host to the ...
--rrdviewer=path path to rrdviewer (default: /cg...
--icondir=path path to icondir
--prefix=path path from the location of the i...
--headeradd=string add string to the html page hea...
--autoprefix try to set prefix automatically
--<opt>-file=file read string argument for option...
$
今回は,パラメータを指定せずに,デフォルトで実行.
実行結果は標準出力にでてくるので,ファイルへリダイレク...
$ indexmaker mrtg.cfg > index.html🆑
$ ls -la index.html🆑
-rw-r--r-- 1 ujpadmin staff 2644 May 29 18:28 index.html🈁
$
あとは,作成されたHTMLをWebブラウザで表示させる.
**番外
こんなエラーがでるとき.
$ mrtg mrtg.cfg
Subroutine SNMP_Session::pack_sockaddr_in6 redefined at ...
at /usr/local/bin/../lib/mrtg2/SNMP_Session.pm line 149.
Subroutine SNMPv1_Session::pack_sockaddr_in6 redefined a...
at /usr/local/bin/../lib/mrtg2/SNMP_Session.pm line 604.
2020-08-11 00:55:54, Rateup WARNING: /usr/local/bin/rate...
2020-08-11 00:55:54, Rateup WARNING: /usr/local/bin/rate...
2020-08-11 00:55:54, Rateup WARNING: /usr/local/bin/rate...
$
vi /usr/bin/mrtgで開いて,次のように書き換える.
変更前:import Socket6
変更後:Socket6->import(qw(inet_pton getaddrinfo));
次に,vi /usr/local/bin/../lib/mrtg2/SNMP_Session.pm で
変更前:if (eval {local $SIG{__DIE__};require Socket6;} &&
変更後:if (eval {local $SIG{__DIE__};Socket6->import(qw...
原因は,Perlのバージョンアップとのこと.
ページ名: