YAMAHA RT57i -> NVR510

  • 2003/07/24に購入したRT57iから13年ぶりにルータを買い換えました。まさか13年も使うことになろうとは思わなかったけど、故障もせずによく働いてくれたという点では冷蔵庫以上の信頼度でした。
  • 設定自体はかんたんに終わったけど、小型ONUの扱いで勘違いが発覚してちょっとだけトラブルが。ONU取り外して設備的にすっきりするかなと思ったのだが、ちょっと思惑が外れた。ISPに連絡して、工事に来てもらう必要がありそう。
  • NVR510はsnmpによる監視が出来るようなので、さっそくMRTGに登録してみようと思うも、何故か動かない。snmpwalkを見る限り問題ないと思うのだが、mrtg.cfgの設定ミスだろうか...

% snmpwalk -v2c -c public 192.168.100.1 .1.3.6.1.4.1.1182.2.3.9.1.16.5
SNMPv2-SMI::enterprises.1182.2.3.9.1.16.5 = Counter32: 3029606
% snmpwalk -v2c -c public 192.168.100.1 .1.3.6.1.4.1.1182.2.3.9.1.10.5
SNMPv2-SMI::enterprises.1182.2.3.9.1.10.5 = Counter32: 3825983

#!/usr/bin/perl

# getstat-rta50i -- Get statistic information for 'mrtg' from RTA50i.

# Copyright (C) 1999 by Yoshiyuki Kondo

# You may redistribute and/or modify this file under the terms of
# the GNU General Public Licence as published by the Free Software
# Foundation.

# NO WARRANTY

# 2000/3/21
# RTA50iが返す送受信バイト数の単位が、(octetsではなく)octet
# になっていることがあるので、それに対応した。

# ルーターの名前
$routername = '192.168.100.1';

# ルーターのパスワード
$passwd = '########';

# ----------------------------------------------------------------------
# これ以降の部分はいじらないこと。

$prompt = '/>\s+/';

use Net::Telnet ();
$t = new Net::Telnet;

# RTA50iにログインする
# いきなりPassword:プロンプトが出るので、標準のlogin()メソッドが使えない
$t->open($routername);
$t->waitfor('/assword: $/');
$t->print($passwd);
$t->waitfor($prompt);

# プロンプトをセットする
$t->prompt($prompt);

# 表示を英語モードに設定
$t->cmd("console character ascii");

# 転送バイト数を取得する
@lines = $t->cmd("show status pp 1");
foreach (@lines) {
if (/^Received: /) { # 受信バイト数
/\[(\d+) octets?]/; # [2000/3/21] 変更
$recv = $1;
}
if (/^Transmitted:/) { # 送信バイト数
/\[(\d+) octets?]/; # [2000/3/21] 変更
$trans = $1;
}
}

# uptimeを取得する
@lines = $t->cmd("show environment");
foreach (@lines) {
if (/Elapsed time from boot: (.+)/) {
$uptime = $1;
last;
}
}

# 結果を出力する
print $recv, "\n";
print $trans, "\n";
print $uptime, "\n";
print $routername, "\n";