Print

 LNXシリーズ SNMP機能の使用例

 Windowsコマンドプロンプト上でNet-SNMPのコマンドを使い、当社LNX製品のSNMP機能の動作を確認する例をお示しします。
SNMP(Simple Network Management Protocol)は、同一ネットワーク上に接続された機器に対し、ネットワーク経由で監視、制御するためのアプリケーション層プロトコルです。




Net-SNMPは、SNMPプロトコルを実装したオープンソースソフトウェア(OSS)です。

ここから Net-SNMPをダウンロードします。



ダウンロードした実行ファイル.exeをダブルクリックしインストールします。
インストールフォルダが、デフォルトの c:\usr として以降の説明を行います。


インストールが完了したら、設定ファイルを作成します。
以下をメモ帳などにコピーし、ファイル名 snmpd.conf で C:\usr\etc\snmpフォルダに保存してください。
※すでに保存されている snmp.conf に上書きしないように注意してください。

 

snmpd.conf
## Of the following Net-SNMP agent features
## NONE are supported on Net-SNMP-5.1.1 Win32 platforms
## Process checks "proc" config token
## Executable scripts "exec" config token
## Disk checks "disk" config token
## Load average checks "load" config token
## Extensible sections "exec" config token with shelltest
## Pass-through control "pass" config token


###############################################################################
#
# EXAMPLE.conf:
# An example configuration file for configuring the ucd-snmp snmpd agent.
#
###############################################################################
#
# This file is intended to only be an example. If, however, you want
# to use it, it should be placed in c:/usr-mingw/etc/share/snmp/snmpd.conf.
# When the snmpd agent starts up, this is where it will look for it.
#
# You might be interested in generating your own snmpd.conf file using
# the "snmpconf" program (perl script) instead. It's a nice menu
# based interface to writing well commented configuration files. Try it!
#
# Note: This file is automatically generated from EXAMPLE.conf.def.
# Do NOT read the EXAMPLE.conf.def file! Instead, after you have run
# configure & make, and then make sure you read the EXAMPLE.conf file
# instead, as it will tailor itself to your configuration.


# All lines beginning with a '#' are comments and are intended for you
# to read. All other lines are configuration commands for the agent.


#
# PLEASE: read the snmpd.conf(5) manual page as well!
#


###############################################################################
# Access Control
###############################################################################


# YOU SHOULD CHANGE THE "COMMUNITY" TOKEN BELOW TO A NEW KEYWORD ONLY
# KNOWN AT YOUR SITE. YOU *MUST* CHANGE THE NETWORK TOKEN BELOW TO
# SOMETHING REFLECTING YOUR LOCAL NETWORK ADDRESS SPACE.


# By far, the most common question I get about the agent is "why won't
# it work?", when really it should be "how do I configure the agent to
# allow me to access it?"
#
# By default, the agent responds to the "public" community for read
# only access, if run out of the box without any configuration file in
# place. The following examples show you other ways of configuring
# the agent so that you can change the community names, and give
# yourself write access as well.
#
# The following lines change the access permissions of the agent so
# that the COMMUNITY string provides read-only access to your entire
# NETWORK (EG: 10.10.10.0/24), and read/write access to only the
# localhost (127.0.0.1, not its real ipaddress).
#
# For more information, read the FAQ as well as the snmpd.conf(5)
# manual page.


####
# First, map the community name (COMMUNITY) into a security name
# (local and mynetwork, depending on where the request is coming
# from):


# sec.name source community
com2sec local localhost public
com2sec mynetwork default public


####
# Second, map the security names into group names:


# sec.model sec.name
group MyRWGroup v1 local
group MyRWGroup v2c local
group MyRWGroup usm local
group MyROGroup v1 mynetwork
group MyROGroup v2c mynetwork
group MyROGroup usm mynetwork


####
# Third, create a view for us to let the groups have rights to:


# incl/excl subtree mask
view all included .1 80


####
# Finally, grant the 2 groups access to the 1 view with different
# write permissions:


# context sec.model sec.level match read write notif
access MyROGroup "" any noauth exact all none none
access MyRWGroup "" any noauth exact all all none


# -----------------------------------------------------------------------------


###############################################################################
# System contact information
#


# It is also possible to set the sysContact and sysLocation system
# variables through the snmpd.conf file. **PLEASE NOTE** that setting
# the value of these objects here makes these objects READ-ONLY
# (regardless of any access control settings). Any attempt to set the
# value of an object whose value is given here will fail with an error
# status of notWritable.


syslocation Right here, right now.
syscontact Me <This email address is being protected from spambots. You need JavaScript enabled to view it.>


# Example output of snmpwalk:
# % snmpwalk -v 1 -c public localhost system
# system.sysDescr.0 = "Windows NT 2000 SP4"
# system.sysObjectID.0 = OID: enterprises.ucdavis.ucdSnmpAgent.win32
# system.sysUpTime.0 = Timeticks: (595637548) 68 days, 22:32:55
# system.sysContact.0 = "Me <This email address is being protected from spambots. You need JavaScript enabled to view it.>"
# system.sysName.0 = "name"
# system.sysLocation.0 = "Right here, right now."
# system.sysServices.0 = 72


# -----------------------------------------------------------------------------


###############################################################################
# Subagent control
#


# The agent can support subagents using a number of extension mechanisms.
# From the 4.2.1 release, AgentX support is being compiled in by default.
# However, this is still experimental code, so should not be used on
# critical production systems.
# Please see the file README.agentx for more details.
#
# If having read, marked, learnt and inwardly digested this information,
# you decide that you do wish to make use of this mechanism, simply
# uncomment the following directive.
#
# master agentx
#
# I repeat - this is *NOT* regarded as suitable for front-line production
# systems, though it is probably stable enough for day-to-day use.
# Probably.
#
# No refunds will be given.


###############################################################################
# Further Information
#
# See the snmpd.conf manual page, and the output of "snmpd -H".
# MUCH more can be done with the snmpd.conf than is shown as an
# example here.

 

Net-SNMP Agentを開始します。[コントロールパネル]>[すべてのコントロール パネル項目]>[管理ツール]>[サービス]を開きます。
Windows標準のSNMPサービスが起動している場合は先に停止する必要があります。起動している場合はSNMPサービスを右クリックして停止します。


Net-SNMP Agentを右クリックして[開始]します。

 

コマンドプロンプトを開き、c:\usr\bin\へ移動します。
cd c:\usr\bin\


以下のコマンドは、LNX製品のIPアドレスが192.168.0.100に設定されている例です。
LNX製品のSNMPコミュニティ名はデフォルトで「public」に設定されています。

 

・snmpgetコマンドにより、LNX製品内のデバイスサーバのバージョンを取得する例
snmpget -v 1 -c public 192.168.0.100 .1.3.6.1.2.1.1.1.0


・snmpgetコマンドにより、LNX製品が起動してからの経過時間を取得する例
snmpget -v 1 -c public 192.168.0.100 .1.3.6.1.2.1.1.3.0


・snmpwalkコマンドにより、利用できるOIDの一覧を取得する例
snmpwalk -v 1 -c public 192.168.0.100

※RFC1213、RFC1317で記載されているスタンダードMIBが使用されています(カスタムMIBなし)
 

[注意事項]
本ページでお示しするのはあくまでもご参考用です(SNMP機能については仕様に明記しておりません)
当社のLNXシリーズはデモ機を無償貸出ししておりますので、どうぞ実機にてご確認をお願いいたします。
LNX-007L LANアイソレータは、デバイスサーバを搭載していないため、SNMP機能は使えません。

 


[kw] 2019-07-16 LNX LAN SNMP Net-SNMP 通信確認 TEC-FA


[]