今日のどこにでもあるネットワークを管理する手頃なツール
David Guerrero <david@boe.es>
June 1997
和訳:nogami 2001.2.23 ver.0.1 なお本文書はGNU の文書ライセンスに基づくものとして翻訳しています。
今や世界中でネットワーキングという考え方でコンピュータが使われており、システム管理業務がますます厳しくなってきています。ネットワークでの、ルータとかハブ、サーバなどの生命線とも言えるデバイスの機能を維持するのが、システム管理者の仕事です。
There are many reasons managers would like to monitor network devices:bandwidth utilization, operational state of links, bottlenecks, problemswith the cabling or routing information distributed between its devices,etc. Monitoring network activity is also a good starting point for discoveringsecurity problems and misbehaviors.
帯域幅が使えるかとか、リンク状態がどうか、ボトルネックがないか、ケーブルに異常がないか、ルーティング情報が正しいかなど、ネットワークデバイスの監視を管理者が行いたいと思うには十分な理由があります。ネットワーク監視はセキュリティ問題とか誤りを発見するための良き出発点でもあります。
In many cases, the network of an organization includes expensive linksto remote networks (WAN) or the Internet, whose costs may be based on trafficvolume. It's very important to maintain statistics of traffic going throughthese links. This is a very common task in Europe, where X.25 links arestill very common. These links are charged on the basis of packets transmittedand received.
多くの場合、組織のネットワークでは外部のネットワーク(WAN)とかインターネットにつなげる高価なリンクを持ちます、その値段はトラフック量によるでしょう。そのようなリンクを流れるトラフィックの統計を取るのは重要なことです。まだ X.25のリンクがよく使われるヨーロッパでは、トラフィック統計は非常に一般的に行われます。このようなリンクでは送受信されるパケットで課金されるのです。
Other types of links, like Point to Point or Frame Relay, are usuallycharged on a flat rate. In these, the telco ensures a bandwidth that isimportant to monitor.
In the final part of this article we focus on a tool designed to monitortraffic in router interfaces, with a great graphical representation ofthis information. It can be easily modified to monitor other kinds of information.
また別の、ポイントツーポイントとかフレームリレーなどのリンクでは、固定料金が普通です。その場合には、帯域幅が確保されているかの監視が重要になってきます。
本文書での最後では、ルータのインターフェースでのトラフィックをモニターするツールを主に述べます、これにはトラフィック情報をきれいに画像で見せてくれるものです。このツールはまた違う種類の情報をモニターするように簡単に修正できます。
What's SNMP?
SNMPって何?
The answer to all these needs is a protocol named Simple Network ManagementProtocol (SNMP). Designed in the '80s, SNMP's initial aim was to integratethe management of different types of networks with a simple design thatcaused very little stress on the network.
ネットワークとかデバイスの監視の必要性に全て応えるのが、Simple Network ManagementProtocol (SNMP)といわれるものなのです。80年代に設計されたSNMPは、多様な形式のネットワークを総合的に管理すること、そして簡単な設計で、ネットワークにあまり負担を与えないことが当初の目標でした。
SNMP operates at the application level using TCP/IP transport-levelprotocols so it can ignore the underlying network hardware. This meansthe management software uses IP, and so can control devices on any connectednetwork:not just those attached to its physical network. This also hasdisadvantages: if the IP routing is not working correctly between two devices,it's impossible to reach the target to monitor or reconfigure it.
SNMPはTCP/IPトランスポートレベルプロトコルを使ったアプリケーションレベルで動きますので、利用するネットワークのハードウエアを無視できます。つまり、この管理ソフトウエアはIPを使いますので、物理的ネットワークに接続されたデバイスだけでなくて、ネットワークでの接続ができる任意の出刃要るのコントロールができることになります。これには欠点もあります、二つのデバイスの間でのIPルーティングがうまく動かない場合には、目標に到達不可能で再設定も不可能ということです。
There are two main elements in the SNMP architecture: the agent andthe manager. It's a client-server architecture, where the agent is theserver and the manager is the client.
SNMPアーキテクチャには主に二つの要素があります、エージェントとマネージャです。SNMPはクライアントサーバーのアーキテクチャで、エージェントがサーバで、マネージャがクライアントです。
The agent is a program running in each of the monitored or managed nodesof the network. It provides an interface to all the items of their configuration.These items are stored in a data structure called a management informationbase (MIB), which we explain later. It's the server side, as long as itmaintains the information being managed and waits for commands from theclient.
エージェントは、モニターしたり管理するネットワークの各ノードで走るプログラムです。エージェントは設定されたアイテムの全てへのインターフェースを提供します。各アイテムは management information base (MIB)と呼ばれるデータ構造の中に保存されます。MIB は後程説明します。これは、管理される情報を保持し、クライアントからのコマンドを待ちうけている間は、サーバ側にあります。
The manager is the software that runs in the monitoring station of thenetwork, and its role is contacting the different agents running in thenetwork to poll for values of its internal data. It's the client side ofthe communication.
マネージャは、ネットワークの監視を行うマシンで走るソフトウエアで、ネットワーク上で走っているエージェント達と連絡をとって、エージェント内部のデータの値を問い合わせるのが役目です。これがクライアント側での通信です。
There is a special command in the SNMP command set called trapthat permits an agent to send unsolicited data to the manager, to informit of events, such as errors, shutdowns, etc.
SNMP のコマンドセットの中には trap トラップと呼ばれる特別なコマンドがあり、エラーとかシャットダウンだどのイベントをマネージャに通知するために、マネージャへエージェントが自発的にデータを送信できるようにしています。
In essence, SNMP is a very simple protocol as long as all the operationsit performs deal with the fetch-and-store paradigm, and this allows fora small commands set. A manager can perform only two different operationson an agent: request or set the value of a variable in the MIB of the agent.These two operations are known as get-request and set-request. There'sa command to respond to a get-request called get-response, which is usedonly by the agent.
まとめますと、フェッチしてストアするというパラダイムで全てを実行するという点でSNMPは非常に単純なプロトコルで、そのおかげで少ないコマンドセットになっています。マネージャはエージェントに対してたった二つの動作しかできません、そのエージェントのMIB中にある変数の値をリクエストするかセットするかです。この二つの動作はget-request と set-request と呼ばれます。呼ばれた get-request に対して応答するコマンドが get-response ですが、こちらはエージェントだけしか行えません。
The extensibility of the protocol is directly related to the capabilityof the MIB to store new items. If a manufacturer wants to add some newcommands to a device such as a router, he must add the appropriate variablesto its database (MIB).
このプロトコルの拡張性は、新規アイテムを保管できるMIBの機能から直接くるものです。ルータとかのデバイスの製造業者が新規コマンドを追加したければ、デバイスのデータベース(MIB)に適切な変数を追加しなければなりません。
Almost all manufacturers implement versions of SNMP agents in theirdevices: routers, hubs, operating systems, and so on. Linux is not an exceptionto this, and publicly available SNMP agents for Linux can be found on theInternet.
ルータとかハブ、オペレーティングシステムなどの殆ど全ての製造業者はそれぞれのデバイスにSNMPエージェントのどれかの版を実装しています。Linuxも例外ではなくて、インターネット上でLinux用のSNMPエージェントをだれでも入手できるものが見つかります。
Dealing with Security
セキュリティのこと
SNMP provides very little support for authentication schemes. It supportsonly a two-password scheme. The public allows managers to requestthe values of variables, and the private allows these values tobe set. These passwords in SNMP are called communities. Every deviceconnected to an SNMP-managed network must have these two communities configured.
SNMPでは極めて貧弱な認証スキームしかサポートしません。二つのパスワードスキームしかサポートしません。その一つの public では変数の値のリクエストをマネージャができるようにし、もう一つの private では変数値のセットができます。この二つのパスワードはSNMPでは communities と呼ばれます。SNMPで管理されるネットワークに接続するデバイスは全て、この二つの communities を持っていなければなりません。 It is very common to have the public community set to "public" and theprivate community to "private", but it's very important to change thesevalues to reflect the security policy of your organization.
よくあるのは、 public community を"public" に、private community を "private"に設定することですが、あなたの組織でのセキュリティポリシーに合わせてこれらを変更するのが非常に重要です。
What's the MIB? MIB って何?
SNMP defines a separate standard for the data managed by the protocol.This standard defines the data maintained by a device in the network andwhat operations are allowed on it. The data is structured in a tree form,and there is a unique path to reach each variable. This structured treeis called the Management Information Base (MIB) and is documented in severalRFCs.
SNMPは、このプロトコルで管理するデータについて、別に標準を定義しています。その標準では、ネットワーク中のデバイスが保持するデータと、そのデータにどの動作が許されるかを定義しています。このデータはツリー形式に構造化されており、各変数に到達する一つのユニークなパスがあります。この構造化されたツリーは Management Information Base (MIB)と呼ばれ、いくつかのRFCで文書化されています。
The current version of the TCP/IP MIB is MIB-II and is defined in RFC-1213.It divides the information a TCP/IP device should maintain into eight categories(shown in Table 1), and each variable included in this information mustfall in one of them.
現行版の TCP/IP MIB は MIB-II で、 RFC-1213 で定義されています。これでは情報が分類されていて、TCP/IP デバイスは8つのカテゴリに入れて保持することになっています(Table 1 に示します)、また、MIB の中の各変数はどれかのカテゴリに入らないといけません。
| Category | Information |
|---|---|
| system | The host or router operating system information ホストあるいはルータのオペレーティングシステム情報 |
| interfaces | Network interrfaces informationネットワークインターフェース情報 |
| addr-translation | Address translation informationアドレス変換情報 |
| ip | IP protocol information IPプロトコル情報 |
| icmp | ICMP protocol information ICMPプロトコル情報 |
| tcp | TCP protocol information TCPプロトコル情報 |
| udp | UDP protocol information UDPプロトコル情報 |
| egp | Exterior Gateway protocol information Exterior Gateway プロトコル情報 |
特定アイテムのMIB定義では、そこに入れられるデータタイプも指定します。普通は、MIBのアイテムは整数一つを保管できますが、文字列とかテーブルなどのもっと複雑な構造も入れられます。MIB中のアイテムはオブジェクトと呼ばれます。オブジェクトはMIBツリーの端っこノードですが、オブジェクトは一つ以上のインスタンスも持てます、例えば、テーブルオブジェクトです。あるオブジェクト中の値を参照するには、そのインスタンスの番号を追加しなければなりません。あるオブジェクトに一つのインスタンスだけが存在する場合には、 それが0インスタンスです。
For example, the object ifNumber from category "interfaces"contains an integer with the number of interfaces present in this device,but the objectipRoutingTable from category "ip" contains therouting table of the device.
例えば、 "interfaces"カテゴリからの ifNumberオブジェクトには、そのデバイスに存在するインターフェースの数の整数が入っていますが、 "ip" カテゴリからのipRoutingTableオブジェクトにはそのデバイスのルーティングテーブルが入っています。
Remember to use the number of the instance to retrieve the value foran object. In this case, the number of interfaces present in a router canbe viewed with the instance ifNumber.0.
あるオブジェクトの値を取り出すのに、そのインスタンスの番号を使うのを忘れないようにしましょう。この場合には、あるルータにあるインターフェースの数を見るには、ifNumber.0インスタンスを使います。
In the case of a table object, you must use the index of the table asthe last number to indicate a specific instance (row of the table).
テーブルオブジェクトの場合には、特定のインスタンスを示す最後の番号として、そのテーブルのインデックスを使わねばなりません(そのテーブルの row )。
There is another standard by which to define and identify MIB variables,called Structure of Management Information (SMI). SMI specifies MIB variablesmust be declared in an ISO formal language called ASN.1 that makes theform and contents of these variables unambiguous.
MIB変数を定義して特定するのに使うもう一つの標準があり、Structure of Management Information (SMI)と呼ばれます。SMIの仕様によれば、ASN.1 と呼ばれる ISO formal Language でMIB変数が宣言されなければなりません。これによって、MIB変数の形式と無いようが曖昧にならないようにしているのです。
The ISO name space is within a global name space with other trees forother standards organizations. Within the ISO name space there is a specifictree for the MIB information. Within that MIB part of the tree are areasfor objects from all protocols and applications so their information canbe represented unambiguously.
このISO名前空間は、別の標準機関用の別のツリーが含まれるグローバルな名前空間の一部になっています。ISO名前空間の内部で、MIB情報用の特定のツリーが存在します。
Figure 1 shows the TCP/IP MIB name space is located just down the mgmtname space of the IAB. The hierarchy also specifies a number for each ofthe levels.
Figure 1 で TCP/IP MIB 名前空間の位置が IAB の mgmt 名前空間の直下にあることを示します。
. | -------------------------------------------------- | | | | ccitt(0) iso(1) itu(2) joint-iso-ccitt(3) | --------------------- | | | | org(3) | dod(6) | internet(1) | mgmt(2) | mib-2(1) | ---------------------------------------------------------------- | | | | | | | | system interfaces addr-translation ip icmp tcp udp egp (1) (2) (3) (4) (5) (6) (7) (8) |
MIB 中のオブジェクトの位置を示すのに、最初のドット(ルート)が殆どのソフトウエアで必要になることは重要です。最初のドットを入れなければ、 .iso.org.dod.internet.mgmt.mib-2 からの相対パスだと見なされてしまいます。
This way the object ifNumber from category "interfaces" canbe named:
このやり方で ifNumber オブジェクトを "interfaces" カテゴリで示すと:
.iso.org.dod.internet.mgmt.mib-2.interfaces.ifnumberor its numerical equivalent:
.1.3.6.1.2.1.2.1and the instance as:
.iso.org.dod.internet.mgmt.mib-2.interfaces.ifnumber.0or its numerical equivalent:
.1.3.6.1.2.1.2.1.0Additional MIBs can be added to this tree as vendors create them and publishthe suitable RFCs.
ベンダーが新しいものを作って、適正なRFCを出版するなら、このツリーに MIB を追加できます。
What's the Future of SNMP? SNMP の将来は?
A new specification called SNMPv2 is being actively developed. It addressesthe lack of security of the actual protocol with mechanisms that focuson privacy, authentication and access control. It also allows more complexspecification of variables and has some additional commands. The problemwith SNMPv2 is it still is not a commonly accepted standard, unlike SNMPv1.It is not easy to find SNMPv2 versions of the agents and software to takeadvantage of the new commands. Let's see what happens in the near future...
SNMPv2 と呼ばれる新仕様が活発に開発中です。新仕様では、実際のプロトコルで欠けているセキュリティを、プライバシーと認証とアクセス制御に注目したメカニズムで解決するそうです。また新仕様では、変数のもっと複雑な指定を可能とし、いくつかのコマンドを追加します。SNMPv2 の問題点は、SNMPv1 とは違って、共通して受け入れる標準にはまだなっていないことです。SNMPv2 版の新コマンドの利点を生かせるエージェントとソフトウエアを見つけるのが容易ではありません。近い将来にどうなるかを一緒にみてみましょう。
SNMP with Linux Linux でのSNMP
One of the most popular SNMP packages is CMU-SNMP. Originally designedby Carnegie Mellon University, it has been ported to Linux by Juergen Schoenwaelderand Erik Schoenfelder. It's fully compliant with the SNMPv1 standard andincludes some of the new proposed functionalities of SNMPv2.
最もはやりのSNMPパッケージは CMU-SNMP です。もともとはカーネギーメロン大学で設計されたCMU-SNMPは、Juergen Schoenwaelder と Erik Schoenfelder がLinuxに移植しました。これはSNMPv1 完全準拠で、SNMPv2 の新規提案の機能をいくつか含みます。
The distribution contains some manager tools that permit, in a commandline style, send requests to devices running SNMP agents. It also containsan SNMP agent program, designed to run under Linux, that provides managersrunning on the network (or the same system) information about the statusof the interfaces, routing table, uptime, contact information, etc.
CMU-SNMP ディストリビューションには、SNMP エージェントが走っているデバイスへのリクエスト送信をコマンドラインからできる管理ツールがいくつか入っています。また SNMP エージェントプログラムが一つ入っていて、これは Linux で走るように設計されており、インターフェースとか、ルーティングテーブル、アップタイム、コンタクト情報などのステータス情報を、ネットワーク上(か同じシステム上か)で走っているマネージャに提供するものです。
One very valuable add-on that comes with CMU-SNMP is a SNMP C-API, whichlets programmers build more complex management tools based on the networkingcapabilities of the distribution.
CMU-SNMP と一緒に付いてくるアドオンでとても価値あるのは、 SNMP C-API で、これは このディストリビューションのネットワーク機能を元にして、更に複雑な管理ツールをプログラムできるものです。
The installation on a Linux system is easy, but a little different fromthe orig inal CMU distribution. The distribution comes with precompiledbinary versions of the manager tools, the daemon and the API library.
Linux システムへのインストールは簡単ですが、オリジナルの CMU ディストリビューションと若干違いがあります。このディストリビューションにはコンパイル済のバイナリ版の管理ツールとデーモンと API ライブラリがあります。
First of all, you must decide whether to get the binary or the sourcedistribution. It's easy to locate the package on the Internet (check theresources sidebar). The binary distribution runs cleanly with the 2.0 kernelseries and is ELF-based. We will explain how to install the binary distribution.It's a good practice to get binary distributions only from trusted sitesto avoid viruses, Trojan-horse style attacks and other security problems.
まず始めに、バイナリディストリビューションかソースのディストリビューションのどちらを入手するかを決めなければなりません。パッケージをインターネット上で探すのは簡単です。バイナリディストリビューションはカーネル2.0シリーズできれいに走り、ELFを基にしています。バイナリディストリビューションのインストール方法を説明することにしましょう。ビールスとか、トロイの木馬型の攻撃などのセキュリティ問題を避けるために信用できるサイトからだけバイナリディストリビューションを入手するのは良い心がけです。
Put the file cmu-snmp-linux-3.2-bin.tar.gz in the root directory (/)of your Linux system and decompress it with the command:
Linux システムのルートディレクトリ(/)に cmu-snmp-linux-3.2-bin.tar.gz ファイルを置いて、次のコマンドで解凍します:
gunzip cmu-snmp-linux-3.2-bin.tar.gzThen, untar the distribution to its final location with the command:
tar xvf cmu-snmp-linux-3.2-bin.tarNow you will have all the utilities and libraries properly installed onyour system, except the SNMP agent configuration file /etc/snmpd.conf.You can create it by running the script:
/tmp/cmu-snmp-linux-3.2/etc/installconfwith these options:
/tmp/cmu-snmp-linux-3.2/etc/installconf -mini where password is the public community you want to use. Now youcan edit the newly installed configuration file /etc/snmpd.conf. In it,you can change the values for the UDP port used by the agent, the systemContact,systemLocation and systemName variables and the interface speed parametersfor your network cards and PPP ports.
ここでのpasswordは、使おうとする public community です。
The most important management tools you get are:
入手した中で一番大事な管理ツールは次のものです:
エージェントは /usr/sbin/snmpd です。
CMU-SNMP also installs an MIB file in /usr/lib/mib.txt. It's a goodreference to search for information we can request from a device.
また、CMU-SNMP は一つの MIB ファイルを /usr/lib/mib.txt にインストールします。これはデバイスにリクエストできる情報を探すのによい参考になります。(訳注:Red Hat 系では/usr/share/snmp/mibs/ 以下に多数のMIBファイルが入るようです。)
The agent must be run at startup time, and can be set up with this linein one of your system boot files (/etc/rc.d/rc.local, for example):
このエージェント snmpd はスタートアップ時に走らせなければなりません、次の行をシステムをブートするファイルのどれかに入れて設定できます(例えば、/erc/rc.d/rc.local ):
/usr/sbin/snmpd -f ; echo 'starting snmpd'Once you have the SNMP agent running for your Linux box, you can test itwith one of the management tools, entering:
/usr/bin/snmpget -v 1 localhost public interfaces.ifNumber.0which will return the number of network interfaces configured in the system,and:
/usr/bin/snmpwalk -v 1 localhost public systemwill return all the values in the system subtree of the MIB. (See Figure2 for the output of this command.)
dragon:~$ /usr/bin/snmpwalk usage: snmpwalk [-p |
C用APIは /lib/libsnmp.so.3.1 にあります(訳注:私のマシンでは/usr/lib/libsnmp.so に libsnmp.so.0.4.0.1 がありました)。
You can check the related header files as follows:
関係するヘッダーファイルは次のところでチェックできるでしょう(訳注:私のマシンでは デーモン関係は /usr/sbin/に snmpd、snmpdtrapd、ヘッダー関係は /usr/include/ecd-snmp/ に snmp.h など、/usr/bin/ に snmpbulkwalk,snmpdelta,snmpget,snmpgetnext,snmpstat,snmpset,snmpstatus,snmptable,snmptest,snmptranslate,snmptrap,snmpusm,snmpwalkがあり、/etc/snmp に snmpd設定ファイルの snmpd.conf,snmpd.local.conf がありました)。
また、マニュアルページの snmp_api(3) and variables(5) にはもっと情報があります。
There's also a Perl extension module to interface with the CMU C-APIthat easily integrates calls to this library in Perl scripts.
さらに、Perl スクリプトで CMU C-API 呼び出しを簡単に統合化できるPerl拡張モジュールもあります。
MRTG: Multi Router Traffic Grapher
MRTG is an advanced tool written by Tobias Oetiker and Dave Rand tographically represent the data SNMP agents brings to SNMP managers. Itgenerates nice HTML pages with GIF graphics about inbound and outboundtraffic in network interfaces inalmost real time. This abstractsthe idea of dealing directly with objects of an MIB with a command linetool like CMU-SNMP. This is the simplest and most powerful tool to monitormy routers I have found on the Internet.
MRTGは Tobias Oetiker と Dave Rand が作った高度なツールで、SNMPエージェントがSNMPマネージャに持ってくるデータを視覚的に表示してくれるものです。MRTGは、ほとんどリアルタイムでネットワークインターフェースでの帯域内と帯域外のトラフィックをGIF画像を使ったきれいなHTMLページに作ってくれます(訳注:GIFの特許上の問題のため、PNG画像を使うようになっているようです)。これによって、CMU-SNMPでのコマンドラインツールでMIBのオブジェクトを直接操作するのを抽象化してくれます。インターネット上で私が見つけた中ではMRTGが私のルータを監視する最も簡単で最も強力なツールです。
MRTG uses an SNMP implementation coded entirely in Perl, so there isno need to install other packages. The main program is written in C tospeed up the logging process and the generation of GIF images. The graphicsare generated with the help of the GD library from Thomas Boutell, authorof the WWW FAQ.
MRTGは完全にPerlで書かれたSNMP実装を使いますので、別のパッケージをインストールする必要はありません。記録プロセスとGIFイメージ生成を高速化するために主プログラムはCで書かれています。WWW FAQの著者の Thomas Boutell のGDライブラリの助けを得てグラフィックスは生成されます。
One of the highlights of MRTG is its expandability and powerful configuration.It's very easy to monitor any SNMP variables instead of traffic, like errorpackets, system load, modem availability and others. It's even possibleto import data from an external program to feed the data, so you can useit to monitor login sessions and other information not available throughSNMP.
MRTGの一つのハイライトは、拡張性と強力な設定です。トラフィックのかわりにエラーパケットとか、システムロード、モデム利用可能性その他の任意のSNMPを監視するのは容易です。データとして外部プログラムから取り入れることさえできますので、ログインセッションその他の、SNMPからでは入手できないものをモニターするのに使えます。
It comes with some tools to watch your router for interfaces, extracttheir characteristics and generate a base configuration file you can easilytweak to accommodate your needs.
ルータのインターフェースを監視して、ルータの特性を取り出して基本設定ファイルを生成するツールがMRTGと一緒に付いてきており、あなたの必要に応じた修正が簡単にできます。
Another interesting feature of MRTG is the amount of information itgenerates. It permits four levels of detail for each interface: trafficin the last 24 hours, the last week, the last month and a yearly graphic.This allows you to gather information for statistical purposes. It maintainsan accumulated database with all this information with the help of a consolidationalgorithm that prevents the data in the logs from eating up your disk space.
もう一つの興味深いMRTGの特性は、MRTGが生成する情報の量です。各インターフェースごとに詳細さのレベルを4レベル使えます:過去24時間、各1週間、過去1月間、過去1年間のトラフックをグラフにできます。これによって、統計目的での情報収集ができます。MRTGは、ログであなたのディスク空間を食い尽くすのを避けるような統合化アルゴリズムの助けを得て全てのデータを一つの累積データベースに保持します。
It also generates a main page that contains the GIF images of the dailydetails of every interface of a router, which lets you have a completeidea of what's happening in your router with a simple look. You can seethe main page and a detail page generated by MRTG in Figures 3 and 4.
また、MRTGは、あなたが一目見てルータに何が起きているのかを完全に把握できるように、ルータの全インターフェースの詳細日報のGIFイメージが入っているメインページを作成します。MRTGが生成するメインページと詳細ページの例を図3と4で見れます。
基本的インストール手順を見てみましょう。まず最初に、MRTGディストリビューションが必要です。記述時点での最新版は2.1でした;最新版のチェックには参照URLをチェックしましょう。
A package you must install before compiling MRTG is the GD graphic library.The URL is in the references sidebar, too. The current version of GD is1.2, and you shouldn't have any problems compiling and installing it. Simplyrun make in the directory you unpacked the distribution and afile called libgd.a will be generated. Copy this file to /usr/local/liband all the .h files to the directory /usr/local/include/gd.
MRTGをコンパイルする以前にインストールしておく必要があるのはGDグラフィックライブラリパッケージです。これのURLも参照URLにあります。現行版のGDは1.2で、コンパイルとインストールに何の問題も無いでしょう。単にディストリビューションを解答したディレクトリで makeを走らせるだけで libgd.a という名前のファイルが作成されます。このファイルを/usr/local/lib に、また .h ファイルを/usr/local/include/gd ディレクトリにコピーします。(訳注:私のシステムではGDライブラリは、/usr/lib/libgd.so.1.2 など、インクルードファイルは/usr/include/以下に入っていました。)
At this point you should have GD up and running. Now is the time tobuild the MRTG package. Unpack the distribution, and edit the Makefile,indicating where to find the GD libraries and header files, and the Perl5.003 binary:usually /usr/bin/perl or /usr/local/bin/perl. This is donethrough the variables GD_LIB,GD_INCLUDE and PERL.
これでGD は動きます。次に、MRTGパッケージを構築する段階です。MRTGディストリビューションを解答し、Makefileを編集してGDライブラリとヘッダーファイルとPerl5.003バイナリを見つける場所を示します:Perlは多分 /usr/bin/perl か /usr/local/bin/perl でしょう。これはMakefile中の変数のGD_LIB,GD_INCLUDE と PERLに記述して行います。
Build the main program by typing make rateup, and when thecompilation finished, enter make substitute to include the correctPATH to the Perl interpreter within the set of Perl scripts that MRTG uses.
主プログラムの構築には make rateup と入力し、コンパイルが終わったときに、 make substitute と入力して、MRTGが使用するPerlスクリプトたちの中でのPerlインタープリタへの正しいパスを含めるようにさせます。
Copy the following files to the final destination of the binaries (forexample, /usr/local/mrtg): BER.pm, SNMP_Session.pm, mrtg and rateup. Youcan also copy to this location the two configuration programs, indexmakerand cfgmaker.
以下のファイルをバイナリの最終目的地にコピーします(例えば /usr/local/mrtg ): BER.pm, SNMP_Session.pm, mrtg と rateup です。また、この場所へ二つのコンフィグレーションプログラムの indexmaker と cfgmaker をコピーしてもよいでしょう。
(訳注:私はmrtg-2.9.10.tar.gzをダウンロードしてきて、zlib,libpng,GDが既にインストールされていたので、単に
tar zxvf mrtg-2.9.10.tar.gz
cd mrtg-2.9.10
./configure
make
su
make install
としただけで、/usr/local/mrtg-2 以下に各ファイルがインストールされました。
)
Ensure that all the programs have the execution bit set. Now we're readyto build a simple configuration file. At this point you should have SNMPread access to your router. In a Cisco router, the configuration linesto allow this are the following:
全プログラムに実行ビットが設定されているのを確認します。これで、簡単な設定ファイルの構築の準備ができました。これを行うには、あなたのルータへのSNMP読み取り権限を持っていなければなりません。Cisco ルータでは、SNMP読み取り権限を与えるコンフィグレーションファイルは次のようになります:
access-list 99 permit 193.147.0.8This allows read-only requests from the addresses specified in the accesslist 99 using "public" as a password (community). If you want to allowevery node in the network Read Only (RO) access to the router, you canhave a line like this one:
access-list 99 permit 193.147.0.9
access-list 99 permit 193.147.0.130
snmp-server community public RO 99
snmp-server community public ROIf you have another brand of router, check the manuals to determine howto allow SNMP access to them.
別の会社製のルータなら、SNMPアクセスを許可する方法についてはマニュアルを調べましょう。
The cfgmaker script greatly simplifies the task of buildingthe configuration file. All you have to do is run it with the followingarguments:
cfgmakerスクリプトはコンフィグレーションファイル作成業務をとても簡単にしてくれます。次のような引数を付けて走らせるだけです:
cfgmaker <community>@<router-host-name or IP>For example:
cfgmaker public@mec-router.rediris.es > mrtg.cfgIt will discover every interface in your router and write a section inthe file with its specifications of numbers of interfaces, maximum speed,description, etc, with some HTML tags to include them in the detail page.It's possible to edit this HTML layout to suit your language, preferences,etc. You can see in Figure 5 the output for one of the interfaces of myrouter.
Target[mec-router.1]: 1:public@mec-router MaxBytes[mec-router.1]: 1250000 Title[mec-router.1]: mec-router.rediris.es (mec-router.mec.es): Ethernet0 PageTop[mec-router.1]: <H1>Estadisticas del puerto Ethernet0<BR> Red del MEC (MECNET)</H1> <TABLE> <TR><TD>System:</TD><TD>mec-router.rediris.es en RedIRIS </TD></TR> <TR><TD>Maintainer:</TD><TD>david@mec.es</TD></TR> <TR><TD>Interface:</TD><TD>Ethernet0 (1)</TD></TR> <TR><TD>IP:</TD><TD>mec-router.mec.es (193.147.0.1)</TD></TR> <TR><TD>Max Speed:</TD> <TD>1250.0 kBytes/s (ethernetCsmacd)</TD></TR> </TABLE> |
./mrtg mrtg.cfgIf all goes well, it will contact your router, request some values, andgenerate some log files and several GIFs in the current directory. Don'tworry about the complaints about the log and graphs not found, as thiswill happen only the first time. Remove the graphs and run the programagain. The graph generated shows the traffic in the interval since youlast ran the program. It also generates HTML pages for each interface.
もし全部うまく運べば、あなたのルータに接触して、いくつかの値をリクエストし、カレントディレクトリにログファイルをいくつかとGIFファイルをいくつか生成します。ログとグラフが見当たらないという文句は気にすることはありません、最初だけ文句を言うだけですから。そのグラフを削除してから再びプログラムを走らせます。このプログラムを最後に走らせてからの期間中のトラフィックを示すグラフを生成します。各インターフェースごとのHTMLページも生成します。
Now it's time to instruct MRTG to run properly in your system. First,create a directory under the Document Root of your web server (assumingyou run a web server on the same system) to accommodate the pages and graphsMRTG will generate each time it runs. Add this directory to the top ofyour configuration file with the directiveWorkDir: /usr/local/web/mrtg(assuming that your Document Root is located in/usr/local/web).The next time MRTG runs, it will create the logs and graphs in this directory,allowing you to access them via http://your_host.domain/mrtg.
place Figure 3 around here -- 2140f3.gif
次には、あなたのシステム中でMRTGを正しく走らせるよう教え込む段階になりました。始めに、、MRTG が走るたびに生成するページとグラフをまとめておくために、あなたのウエブサーバのドキュメントルートの下にディレクトリを作成します(同じマシンでウエブサーバを走らせているものとします)。コンフィグレーションファイルの中の一番上でWorkDir: /usr/local/web/mrtg 項目に今作成したディレクトリを追加します(ドキュメントルートが/usr/local/webにあるものとしています)。次に MRTG が走るときに、このディレクトリの中にログとグラフが生成され、 http://your_host.domain/mrtg でアクセスできるようにします。
place Figure 3 around here -- 2140f3.gif
Figure 3. Interface Main Page
Now, you would like to build a main page for all the interfaces likethe one shown in Figure 3. This can't be accomplished with the indexmakertool. Run:
図3のように見える、全インターフェース用のメインページを作ることになります。これはindexmakertool でできます。次のように走らせます:
indexmaker mrtg.cfg <router-name regexp> > /usr/local/web/mrtg/index.htmlIt will generate an HTML page with the daily graphs of interfaces whoserouter name matches the previous regular expression and links to theirsingle detail pages.
これで、上記の正規表現に適合するルータ名のインターフェースの一日のグラフと個別詳細ページへのリンクが入った一つのHTMLページが作成されます。
As you can imagine the MRTG program must be run on a regular basis tocollect the data for each interval and generate the graphs periodically,in order to maintain the illusion of real-time monitoring. This is donethrough the following line in the crontab (assuming /usr/local/mrtg-binas the mrtg program final destination):
ご想像の通り、リアルタイムでの監視をしているように見せかけるために、各期間でのデータを集めて定期的にグラフを生成するように、MRTGは日常的に走らせなければなりません。それを行うには、次の行をcrontab中に置いて行えます(/usr/local/mrtg-bin が mrtg プログラムの場所であるとしています):
0,5,10,15,20,25,30,35,40,45,50,55 * * * * \In a Red Hat distribution, the correct line to append to the /etc/crontabfile would be:
/usr/local/mrtg-bin/mrtg \
/usr/local/mrtg-bin/mrtg.cfg > \
/dev/null 2>&1
0,5,10,15,20,25,30,35,40,45,50,55 * * * * root \If everything is working fine, you can spend some time tuning your configurationand HTML index page. A good enhancement is to include in the <HEAD>section of the index page a <META .....> to force the browser to reloadevery 300 seconds to maintain the latest information on the screen.
/usr/local/mrtg-bin/mrtg \
/usr/local/mrtg-bin/mrtg.cfg > \
/dev/null 2>&1
全部うまくいっているなら、あなたのコンフィグレーションとHTMLインデックスページが調整される時間だけ待ちましょう。うまいやり方としては、インデックスページの <HEAD> セクションに <META .....> を入れて、最新情報が画面上に保持されるように300秒ごとにブラウザに強制的に再読み込みさせるようにします。
Another enhancement you can include in your configuration file is theWriteExpire directive, which forces MRTG to create .meta files for eachGIF and HTML page, eliminating unnecessary caching time by proxy serversand browsers. For this to work, you must also configure your Apache server(assuming you run the Apache web server) to read these .meta files andsend the correct "Expire" headers with the MetaDir directive inthe XXXX file.
もう一つ、コンフィグレーションファイルに入れると良いのは WriteExpire 項目で、これにより、各GIFとHTMLページ用の .meta ファイルを強制的にMRTGが作成するようにし、プロキシサーバと数千のブラウザによる不要なキャッシング時間を減らします。これが機能するためには、あなたのApacheサーバの設定(Apacheウエブサーバを使っているとしています)で、この .meta ファイルを読み込ませて、XXXX ファイル中のヘッダーで正しい "Expire" MetaDir 指示子が送信されるようにしなければなりません。
You can look for additional directives in the example configurationfrom the distribution; it's very well documented. It's possible to alterall the layout of the images and pages generated by MRTG.
ディストリビューションにはコンフィグレーション例が入っていますので、別の指示子をご覧ください;これらの例は十分説明されています。MRTGが生成する画像とページのレイアウトを全部換えることもできます。
I hope you enjoy this program. If you do, send the authors a postcard;you can find their address on the MRTG home page.
このMRTGプログラムはきっと役立つでしょう。役立ったなら、MRTG ホームページにある住所あての著者達にはがきを送ってやってください。
Other programs その他のプログラム
There is a similar program called Router-Stats, written by Iain Lea,the author of the well-known tin news reader. Router-Stats updates itsgraphics once a day and shows very interesting stats about hourly usageand other aspects. One problem with Router-Stats is it uses a lot of externalprograms to do its work (CMU-SNMP for SNMP tasks, GNUPLOT to draw the graphics,NetPBM to make some graphic conversions, and GIFTOOL to convert them tothe final GIFs). You can check the URL for Router-Stats in the referencessidebar.
同じようなプログラムで、tin ニュースリーダの著者として有名なIain Lea が書いたRouter-Statsというのがあります。Router-Statsは一日に一回画像を更新し、一時間ごとの利用頻度その他の、とても興味深い統計を見せてくれます。Router-Statsの一つの問題は、自分の仕事を行うために外部プログラムを多数使うことです(CMU-SNMP を SNMP 業務用に、 GNUPLOT を画像描画用に、NetPBM を画像変換用に、 GIFTOOL を最後の GIF への変換用に)。Router-StatsのURLは参照のところをチェックしてください。
There is another category of software that goes one step beyond in networkmanagement tasks and offers a complete solution for both monitoring andmaintaining the distinct configuration of a whole network. This kind ofsolution permits us to draw a complex graphic representation of our networkand browse through the nodes, checking specific items of the configurationand other interesting features.
ネットワーク管理業務より一歩外に踏み出したもう一つのカテゴリのソフトウエアがあり、ネットワーク全体の特定の設定の監視と維持の両方を行うための完全なソリューションを提供します。この種のソリューションを使えば、ネットワークの複雑な図面を描いて、ネットワークのノードを通じて見ることができて、コンフィグレーションの特定の項目をチェックするなどの興味深い機能を実現できます。
At this level, we can talk about two commercial solutions broadly used:HP-OpenView from Hewlett-Packard and SunNet Manager from Sun. They providea complete platform for managing all the resources of the network fromgreat graphical interfaces. They also come with network discovery toolsto find all the network's elements that have running SNMP agents and databasesto store all the data gathered from the network for statistical purposes.One important feature of these environments is their ability to be integratedwith other vendors' more specific products, like Cisco's CiscoWorks, thatallows a network manager to maintain a database with all its router configurationand even monitor graphically the back panels of their routers and all theirconnections.
この段階では、広く使われている商用ソリューションを二つあげることができます:ヒューレットパッカードのHP-OpenView と、Sun のSunNet Manager です。これらを使えば、きれいなグラフィックインターフェースで、ネットワークの全資源を管理するための完全なプラットフォームを提供します。これらには、SNMPエージェントが走るネットワークの全要素を発見するためのnetwork dicsovery ツールと、統計用にネットワークから集めたデータ全部を保管するデータベースがついています。これらの環境の大事な機能の一つは、他のベンダーのもっと特殊な製品と統合化できる能力です。例えば、CiscoのCiscoWorksでは、ルータの設定の全てのデータベースを維持して、Ciscoのルータの背面パネルとかルータの全接続をグラフィック的に監視することもできます。このような各ベンダごとのツールと統合化できるかどうかが問題なのです。
There are two drawbacks to these products: they are commercial and theyhave no ports to Linux. Of course, there are also public domain solutionsfor these tasks. One of the best packages I've found for this is Scotty.Scotty is a TCL-based package that allows you to implement site-specificnetwork management software using high-level, string-based APIs. Its companionproduct, Tkined, is a network editor that provides extensions to builda complete framework, integrating some tools designed to discover IP networks,support the network layout process or troubleshoot IP networks using SNMPin combination with other standard tools (e.g., traceroute). Scotty alsoincludes a graphical MIB browser to allow you to explore MIB information.
このような製品の欠点は二つあります:商用であり、Linuxへ移植されていないことです。もちろん、このような業務用のパブリックドメインのソリューションもあります。この用途で私が知っている一番よいパッケージはScottyです。ScottyはTCLを基にしたパッケージで、高水準で文字列ベースのAPIを使って、各サイト固有のネットワーク管理ソフトウエアを作成できるものです。Scottyには兄弟分があって、TKined といい、完全なフレームワークを構築するために拡張したネットワークエディタで、IPネットワークを発見するために設計されたいくつかのツールを統合化しており、ネットワークをレイアウトするのをサポートしたり、別の標準ツール(tracerouteなど)と組み合わせてIPネットワークのトラブルシューティングをサポートするものです。Scottyにはグラフィック的なMIBブラウザも入っており、MIB情報を探すことができます。
You can check the references listing for both commercial and publicdomain network management software pointers.
商用とパブリックドメインのネットワーク管理ソフトウエアの両方を探すのに、参照表をチェックしてみましょう。
Conclusions まとめ
SNMP is a simple but powerful protocol that can help us monitor ourresources with little stress to the network. It's possible the extensionsbeing developed now will increase the complexity and capabilities of thistool but they will also increase the resources needed to implement them.
SNMPはシンプルですが強力なプロトコルで、ネットワークに殆ど負担を与えずに資源を監視する役に立ちます。まだ現在開発中の拡張機能では、複雑さを増して機能をアップさせるかもしれませんが、これらのツールを使うのに必要な資源もまた増加させることになります。
In this article, we have explored a couple of tools found on the Net.There are a lot of tools being developed each day. You can check the Usenetnewsgroup comp.protocols.snmp for announcements of new software and MIBS.
本論文では、ネット上で見つかるいくつかのツールを見てきました。毎日のように新たに開発されるツールが一杯あります。 Usenet のニュースグループ comp.protocols.snmp で新ソフトウエアとMIBの発表をチェックしましょう。
CMU-SNMP for Linux: Linux用CMU-SNMP
ftp://sunsite.unc.edu/pub/Linux/system/network/admin/cmu-snmp-linux-3.2-bin.tar.gz(訳注:CMU-SNMPは最近net-snmpという名前で開発されている模様で、http://net-snmp.sourceforge.net/ も参照しましょう。)PERL 5 module extension for CMU-SNMP: ftp:/ftp.wellfleet.com/netman/snmp/perl5/SNMP.tar.gzMulti Router Traffic Grapher (MRTG): http://www.ee.ethz.ch/~oetiker/webtools/mrtg/mrtg.htmlGD Graphic Library: (required by MRTG) http://www.boutell.com/gd/Perl 5.003: (required by MRTG) http://www.perl.com/perl/info/software.htmlMRTG mailing lists: Router Stats: http://www.scn.de/~iain/router-stats/SNMP Network Management Software: http://wwwsnmp.cs.utwente.nl/software/Scotty: http://wwwsnmp.cs.utwente.nl/~schoenw/scotty/Scotty for Linux: ftp://sunsite.unc.edu/pub/Linux/system/network/admin/tkined-1.3.4+scotty-ELF.tar.gz |