sakura vps : snmpでrubyしてみる
Date:2013-09-20 17:27:10 +0900
Categories: TECHNOLOGY
Categories: TECHNOLOGY
会社の先輩と話していたら、snmpでサーバの情報持ってくると色々楽しくなりそうっていうことで、
とりあえず試験でvpsにいろいろ環境をしてみた。
まず、snmpがわからないので
http://yosilove.blogspot.jp/2012/07/snmpnet-snmpsnmpd.html
を参考に確認してみた。
$ sudo yum list snmp =============================================================================================== Package Arch Version Repository Size =============================================================================================== Installing: net-snmp x86_64 1:5.5-44.el6_4.4 updates 303 k Installing for dependencies: lm_sensors-libs x86_64 3.1.1-17.el6 base 38 k net-snmp-libs x86_64 1:5.5-44.el6_4.4 updates 1.5 M Transaction Summary =============================================================================================== Install 3 Package(s) $ sudo yum install net-snmp-utils =============================================================================================== Package Arch Version Repository Size =============================================================================================== Installing: net-snmp-utils x86_64 1:5.5-44.el6_4.4 updates 172 k Transaction Summary =============================================================================================== Install 1 Package(s) いらっしゃった。 $ ls /usr/bin |grep snmp net-snmp-create-v3-user snmpbulkget snmpbulkwalk snmpconf snmpdelta snmpdf snmpget snmpgetnext snmpinform snmpnetstat snmpset snmpstatus snmptable snmptest snmptranslate snmptrap snmpusm snmpvacm snmpwalk とりあえずデータは取れたっぽいですね。 $ snmpwalk -v 1 -c public localhost SNMPv2-MIB::sysDescr.0 = STRING: XXXX SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10 DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (2412) 0:00:24.12 SNMPv2-MIB::sysContact.0 = STRING: Root (configure /etc/snmp/snmp.local.conf) SNMPv2-MIB::sysName.0 = STRING: XXX SNMPv2-MIB::sysLocation.0 = STRING: Unknown (edit /etc/snmp/snmpd.conf) SNMPv2-MIB::sysORLastChange.0 = Timeticks: (11) 0:00:00.11 SNMPv2-MIB::sysORID.1 = OID: SNMP-MPD-MIB::snmpMPDMIBObjects.3.1.1 SNMPv2-MIB::sysORID.2 = OID: SNMP-USER-BASED-SM-MIB::usmMIBCompliance SNMPv2-MIB::sysORID.3 = OID: SNMP-FRAMEWORK-MIB::snmpFrameworkMIBCompliance SNMPv2-MIB::sysORID.4 = OID: SNMPv2-MIB::snmpMIB SNMPv2-MIB::sysORID.5 = OID: TCP-MIB::tcpMIB SNMPv2-MIB::sysORID.6 = OID: IP-MIB::ip SNMPv2-MIB::sysORID.7 = OID: UDP-MIB::udpMIB SNMPv2-MIB::sysORID.8 = OID: SNMP-VIEW-BASED-ACM-MIB::vacmBasicGroup SNMPv2-MIB::sysORDescr.1 = STRING: The MIB for Message Processing and Dispatching. SNMPv2-MIB::sysORDescr.2 = STRING: The MIB for Message Processing and Dispatching. SNMPv2-MIB::sysORDescr.3 = STRING: The SNMP Management Architecture MIB. SNMPv2-MIB::sysORDescr.4 = STRING: The MIB module for SNMPv2 entities SNMPv2-MIB::sysORDescr.5 = STRING: The MIB module for managing TCP implementations SNMPv2-MIB::sysORDescr.6 = STRING: The MIB module for managing IP and ICMP implementations SNMPv2-MIB::sysORDescr.7 = STRING: The MIB module for managing UDP implementations SNMPv2-MIB::sysORDescr.8 = STRING: View-based Access Control Model for SNMP. SNMPv2-MIB::sysORUpTime.1 = Timeticks: (10) 0:00:00.10 SNMPv2-MIB::sysORUpTime.2 = Timeticks: (10) 0:00:00.10 SNMPv2-MIB::sysORUpTime.3 = Timeticks: (10) 0:00:00.10 SNMPv2-MIB::sysORUpTime.4 = Timeticks: (10) 0:00:00.10 SNMPv2-MIB::sysORUpTime.5 = Timeticks: (10) 0:00:00.10 SNMPv2-MIB::sysORUpTime.6 = Timeticks: (10) 0:00:00.10 SNMPv2-MIB::sysORUpTime.7 = Timeticks: (10) 0:00:00.10 SNMPv2-MIB::sysORUpTime.8 = Timeticks: (11) 0:00:00.11 HOST-RESOURCES-MIB::hrSystemUptime.0 = Timeticks: (638505284) 73 days, 21:37:32.84 End of MIB 動いてる。Tweet