
ホストリソースMIBによる管理
「実践SNMP教科書」第10章からの復刻です。
mib-2は、基本的にTCP/IPプロトコルの管理を目的としています。SNMPエージェントが動作するコンピュータのCPU負荷、メモリ搭載量、使用量、ディスクの搭載量、使用量、接続されているデバイスなどのリソースを管理するためにホストリソースMIBが定義されています。
mib-2
+--host(25)
|
+--hrSystem(1)
|
+--hrStorage(2)
|
+--hrDevice(3)
| |
| +--hrDeviceTable(2)
| |
| +--hrProcessorTable(3)
| |
| +--hrNetworkTable(4)
| |
| +--hrPrinterTable(5)
| |
| +--hrDiskStorageTable(6)
| |
| +--hrPartitionTable(7)
| |
| +--hrFSTable(8)
|
+--hrSWRun(4)
|
+--hrSWRunPerf(5)
|
+--hrSWInstalled(6)
ホストリソースMIBのグループのうち、SNMPマネージャからの管理に有効なものを抜粋して説明します。
hrSystemグループ
hrSystemグループは、OSに関連した基本的な情報を提供します。
+--hrSystem(1)
|
+-- -R-- TimeTicks hrSystemUptime(1)
+-- -RW- String hrSystemDate(2)
| Textual Convention: DateAndTime
| Size: 8 | 11
+-- -RW- Integer32 hrSystemInitialLoadDevice(3)
| Range: 1..2147483647
+-- -RW- String hrSystemInitialLoadParameters(4)
| Textual Convention: InternationalDisplayString
| Size: 0..128
+-- -R-- Gauge hrSystemNumUsers(5)
+-- -R-- Gauge hrSystemProcesses(6)
+-- -R-- Integer32 hrSystemMaxProcesses(7)
Range: 0..2147483647
①時計
hrSystemDateによって、OSの管理するローカルタイムを取得又は設定できます。
②OS起動
OSの起動デバイス(hrSystemInitialLoadDevice)と起動パラメータ(hrSystemInitialLoadParameters)を取得設定できます。しかし、これらをセキュリティ機能のないSNMPv1,v2Cから設定できるようにすることは非常に危険です。間違った設定によって、OS自体が起動できないなる可能性があるからです。
③OS情報
OSにログオンしているユーザ数(hrSystemNumUsers)、OSが起動しているプロセス数(hrSystemProcesses)と最大起動可能なプロセス数が(hrSystemMaxProcesses)取得できます。サーバ管理では、異常なプロセス数の増加などを監視するのに役立ちます。


TWSNMP FCには、hrSystemの取得値を

のように表示する機能があります。
シン・TWSNMPだと

です。
hrStorageグループ
hrStorageグループは、ホストに搭載されたメモリやディスクなどの記憶装置を管理するためのMIBです。
+--hrStorage(2)
|
+--hrStorageTypes(1)
|
+-- -R-- Integer32 hrMemorySize(2)
| Textual Convention: KBytes
| Range: 0..2147483647
|
+--hrStorageTable(3)
|
+--hrStorageEntry(1)
| Index: hrStorageIndex
|
+-- -R-- Integer32 hrStorageIndex(1)
| Range: 1..2147483647
+-- -R-- ObjID hrStorageType(2)
| Textual Convention: AutonomousType
+-- -R-- String hrStorageDescr(3)
| Textual Convention: DisplayString
| Size: 0..255
+-- -R-- Integer32 hrStorageAllocationUnits(4)
| Range: 1..2147483647
+-- -RW- Integer32 hrStorageSize(5)
| Range: 0..2147483647
+-- -R-- Integer32 hrStorageUsed(6)
| Range: 0..2147483647
+-- -R-- Counter hrStorageAllocationFailures(7)
①メモリ搭載量
hrMemorySizeによって、管理対象ノードのメモリ容量を取得できます。
②メモリ、ディスク搭載/使用量
メモリー、ハードディスク、リムーバブルディスクなどの種類は、hrStorageTableのhrStorageTypeの値によって、判断します。hrStorageSizeによって搭載容量を、hrStorageUsedによって使用量を取得できます。単位は、hrStorageAllocationUnitsによって判断する必要がありますが、(100*hrStorageUsed)/hrStorageSizeによって使用率に変換すれば、ディスクやメモリの空き容量監視が行えます。

シン・TWSNMPで取得すると

です。
hrDeviceグループ
hrDeviceグループは、管理対象に接続されたCPU、ネットワークI/F、プリンタ、ディスク装置等のデバイスを管理するための情報を提供します。ネットワークI/Fは、interfaceグループで、プリンタはプリンタMIBで、ディスク装置は、hrStorageグループで管理できます。
+--hrDevice(3)
|
+--hrDeviceTypes(1)
| |
| +--hrDeviceOther(1)
| +--hrDeviceUnknown(2)
| +--hrDeviceProcessor(3)
| +--hrDeviceNetwork(4)
| +--hrDevicePrinter(5)
| +--hrDeviceDiskStorage(6)
| +--hrDeviceVideo(10)
| +--hrDeviceAudio(11)
| +--hrDeviceCoprocessor(12)
| +--hrDeviceKeyboard(13)
| +--hrDeviceModem(14)
| +--hrDeviceParallelPort(15)
| +--hrDevicePointing(16)
| +--hrDeviceSerialPort(17)
| +--hrDeviceTape(18)
| +--hrDeviceClock(19)
| +--hrDeviceVolatileMemory(20)
| +--hrDeviceNonVolatileMemory(21)
|
+--hrDeviceTable(2)
| |
| +--hrDeviceEntry(1)
| | Index: hrDeviceIndex
| |
| +-- -R-- Integer32 hrDeviceIndex(1)
| | Range: 1..2147483647
| +-- -R-- ObjID hrDeviceType(2)
| | Textual Convention: AutonomousType
| +-- -R-- String hrDeviceDescr(3)
| | Textual Convention: DisplayString
| | Size: 0..64
| +-- -R-- ObjID hrDeviceID(4)
| | Textual Convention: ProductID
| +-- -R-- EnumVal hrDeviceStatus(5)
| | Values: unknown(1), running(2), warning(3), testing(4), down(5)
| +-- -R-- Counter hrDeviceErrors(6)
|
+--hrProcessorTable(3)
| |
| +--hrProcessorEntry(1)
| | Index: hrDeviceIndex
| |
| +-- -R-- ObjID hrProcessorFrwID(1)
| | Textual Convention: ProductID
| +-- -R-- Integer32 hrProcessorLoad(2)
| Range: 0..100
|
+--hrNetworkTable(4)
| |
| +--hrNetworkEntry(1)
| | Index: hrDeviceIndex
| |
| +-- -R-- Integer32 hrNetworkIfIndex(1)
| Textual Convention: InterfaceIndexOrZero
| Range: 0..2147483647
|
+--hrPrinterTable(5)
| |
| +--hrPrinterEntry(1)
| | Index: hrDeviceIndex
| |
| +-- -R-- EnumVal hrPrinterStatus(1)
| | Values: other(1), unknown(2), idle(3), printing(4), warmup(5)
| +-- -R-- String hrPrinterDetectedErrorState(2)
|
+--hrDiskStorageTable(6)
| |
| +--hrDiskStorageEntry(1)
| | Index: hrDeviceIndex
| |
| +-- -R-- EnumVal hrDiskStorageAccess(1)
| | Values: readWrite(1), readOnly(2)
| +-- -R-- EnumVal hrDiskStorageMedia(2)
| | Values: other(1), unknown(2), hardDisk(3), floppyDisk(4), opticalDiskROM(5), opticalDiskWORM(6), opticalDiskRW(7), ramDisk(8)
| +-- -R-- EnumVal hrDiskStorageRemoveble(3)
| | Textual Convention: TruthValue
| | Values: true(1), false(2)
| +-- -R-- Integer32 hrDiskStorageCapacity(4)
| Textual Convention: KBytes
| Range: 0..2147483647
|
+--hrPartitionTable(7)
| |
| +--hrPartitionEntry(1)
| | Index: hrDeviceIndex, hrPartitionIndex
| |
| +-- -R-- Integer32 hrPartitionIndex(1)
| | Range: 1..2147483647
| +-- -R-- String hrPartitionLabel(2)
| | Textual Convention: InternationalDisplayString
| | Size: 0..128
| +-- -R-- String hrPartitionID(3)
| +-- -R-- Integer32 hrPartitionSize(4)
| | Textual Convention: KBytes
| | Range: 0..2147483647
| +-- -R-- Integer32 hrPartitionFSIndex(5)
| Range: 0..2147483647
|
+--hrFSTable(8)
| |
| +--hrFSEntry(1)
| | Index: hrFSIndex
| |
| +-- -R-- Integer32 hrFSIndex(1)
| | Range: 1..2147483647
| +-- -R-- String hrFSMountPoint(2)
| | Textual Convention: InternationalDisplayString
| | Size: 0..128
| +-- -R-- String hrFSRemoteMountPoint(3)
| | Textual Convention: InternationalDisplayString
| | Size: 0..128
| +-- -R-- ObjID hrFSType(4)
| | Textual Convention: AutonomousType
| +-- -R-- EnumVal hrFSAccess(5)
| | Values: readWrite(1), readOnly(2)
| +-- -R-- EnumVal hrFSBootable(6)
| | Textual Convention: TruthValue
| | Values: true(1), false(2)
| +-- -R-- Integer32 hrFSStorageIndex(7)
| | Range: 0..2147483647
| +-- -RW- String hrFSLastFullBackupDate(8)
| | Textual Convention: DateAndTime
| | Size: 8 | 11
| +-- -RW- String hrFSLastPartialBackupDate(9)
| Textual Convention: DateAndTime
| Size: 8 | 11
|
+--hrFSTypes(9)
|
+--hrFSOther(1)
+--hrFSUnknown(2)
+--hrFSBerkeleyFFS(3)
+--hrFSSys5FS(4)
+--hrFSFat(5)
+--hrFSHPFS(6)
+--hrFSHFS(7)
+--hrFSMFS(8)
+--hrFSNTFS(9)
+--hrFSVNode(10)
+--hrFSJournaled(11)
+--hrFSiso9660(12)
+--hrFSRockRidge(13)
+--hrFSNFS(14)
+--hrFSNetware(15)
+--hrFSAFS(16)
+--hrFSDFS(17)
+--hrFSAppleshare(18)
+--hrFSRFS(19)
+--hrFSDGCFS(20)
+--hrFSBFS(21)
+--hrFSFAT32(22)
+--hrFSLinuxExt2(23)
このグループで注目すべきは、hrProcessorTableのMIBです。
+--hrProcessorTable(3)
|
+--hrProcessorEntry(1)
| Index: hrDeviceIndex
|
+-- -R-- ObjID hrProcessorFrwID(1)
| Textual Convention: ProductID
+-- -R-- Integer32 hrProcessorLoad(2)
Range: 0..100
①CPUの種類
hrProcessorFrwIDによってCPUの種類が取得できます。
②CPU負荷
hrProcessorLoadによって、CPU負荷が取得できます。但し、1%単位なので、よほど負荷のかかるホストでない限り0%になってしまいます。

他にhrFSTableも取得できます。

hrSWRunグループ
hrSWRunによって管理対象で動作中のソフトウェアの情報を取得できます。また、hrSWRunPerfによって、動作中のソフトウェアのCPU使用量、メモリ使用量取得できます。hrSWInstalledにより管理対象にインストールされたソフトウェアの情報を取得できます。

コラム;ホストリソースMIBの実装状況
ホストリソースMIBは、WindowsやNET-SNMPで実装されています。しかし、現時点では、正しい値を返さない場合があるので、注意が必要です。サーバ管理などにおいて、ホストリソースMIBは、非常に有益なので、今後正しい実装になって行くことを期待しています。
ここから先は

実践SNMP教科書 復刻版
20年近く前に書いた「実践SNMP教科書」を現在でも通用する部分だけ書き直して復刻するマガジンです。最近MIBの設計で困っている人に遭遇し…
開発のための諸経費(機材、Appleの開発者、サーバー運用)に利用します。 ソフトウェアのマニュアルをnoteの記事で提供しています。 サポートによりnoteの運営にも貢献できるのでよろしくお願います。