1.Environmental description:
There are three configuration methods for snmp in the AIX environment:
- The snmp that comes with the AIX system;
- The compiled rpm package specifically for the AIX platform, the version found online is usually 5.7.2;
- A compilation package suitable for general platforms, which needs to be compiled and installed;
The configurations of the three methods are quite different, and some operations are not universal. The operation in this article only applies to method 1, which is the snmp method that comes with the system.
Operating environment:
Platform: POWER
OS: AIX7.2, AIX7.1, AIX6.1 snmp: The system comes with snmp server
by default : linux host, IP: 10.10.94.90 snmp client: aix host, IP: 10.10.93.119
After the AIX system is installed, the system comes with the snmp service by default:
The default path of the snmpd program is /usr/sbin/snmpd.
The snmpd.conf file has two versions by default. The paths are as follows:
-rw-r----- 1 root system 10206 Jun 16 02:18 /etc/snmpd.conf
-rw-r----- 1 root system 10239 Jul 14 15:22 /etc/snmpdv3.conf
# ls -l /usr/sbin/snmpd* #查看系统默认使用的snmp版本
lrwxrwxrwx 1 root system 9 Jun 16 02:13 /usr/sbin/snmpd -> snmpdv3ne
-rwxr-x--- 1 root system 374579 Jun 12 2018 /usr/sbin/snmpd64v1
-rwxr-x--- 1 root system 354488 Jun 12 2018 /usr/sbin/snmpdv1
-rwxr-x--- 1 root system 346328 Jan 18 2017 /usr/sbin/snmpdv3ne
Currently snmpd uses snmpdv3ne, which means it supports the non-encrypted version of SNMPv3. ne=no encryption (non-encrypted)
can be used in SNMPv1 as long as /etc/snmpdv3.conf is configured. Therefore, this version is generally used by default. can meet the requirements.
If you have special needs, you can also use the snmpv3_ssw command to change the version:
snmpv3_ssw -1 切换至SNMPv1
snmpv3_ssw -n 切换至SNMPv3非加密版本
snmpv3_ssw -e 切换至SNMPv3的加密版本(该版本默认并未安装)
2. Configure snmp
There are quite some differences between the snmp that comes with the aix system and the net-snmp that was compiled and installed by *** in terms of the configuration file snmpd.conf and the startup command. The commands in this article are for the snmp program that comes with the AIX system by default.
2.1 Modify configuration file
# vi /etc/snmpdv3.conf #使用V3版本的配置文件
# 使用shift + g 快捷键快速跳转到最后一行
The source file format is as follows:
modified as follows:
--------------------------------------------------------------------------------------------
VACM_GROUP group1 SNMPv1 cmsnmp -
VACM_VIEW defaultView internet - included -
VACM_VIEW defaultView 1.3.6.1.4.1.2.2.1.1.1.0 - included -
VACM_VIEW defaultView 1.3.6.1.4.1.2.6.191.1.6 - included -
# exclude snmpv3 related MIBs from the default view
VACM_VIEW defaultView snmpModules - excluded -
VACM_VIEW defaultView 1.3.6.1.6.3.1.1.4 - included -
VACM_VIEW defaultView 1.3.6.1.6.3.1.1.5 - included -
# exclude aixmibd managed MIBs from the default view
VACM_VIEW defaultView 1.3.6.1.4.1.2.6.191 - included -
VACM_ACCESS group1 - - noAuthNoPriv SNMPv1 defaultView - defaultView -
NOTIFY notify1 traptag trap -
TARGET_ADDRESS Target1 UDP 127.0.0.1 traptag trapparms1 - - -
TARGET_PARAMETERS trapparms1 SNMPv1 SNMPv1 cmsnmp noAuthNoPriv -
COMMUNITY cmsnmp cmsnmp noAuthNoPriv 0.0.0.0 0.0.0.0 -
--------------------------------------------------------------------------------------------------------
All publics are changed to the self-defined community name cmsnmp
After confirming that everything is correct, save and exit.
2.2 Start snmp service
# ps -ef | grep snmpd #确认snmpd服务是否已经运行了,需要先停止
# stopsrc -s aixmibd;stopsrc -s hostmibd;stopsrc -s snmpmibd #默认snmp已运行
# stopsrc -s snmpd
# chssys -s aixmibd -a "-c cmsnmp" #这三条命令只需要操作一次即可。其中cmsnmp为自己定义的共同体名称。
# chssys -s hostmibd -a "-c cmsnmp"
# chssys -s snmpmibd -a "-c cmsnmp"
# startsrc -s snmpd
# startsrc -s aixmibd;startsrc -s hostmibd;startsrc -s snmpmibd
# ps -ef | grep snmpd
3. Verify snmpd service
3.1 Client-side verification
# snmpinfo -md -v -c cmsnmp aixSeCPUUtilization
aixSeCPUUtilization.0 = 1
# snmpinfo -md -c cmsnmp aixSeCPUUtilization
1.3.6.1.4.1.2.6.191.1.2.1.0 = 1
# snmpinfo -md -v -c cmsnmp aixPagingSpace
aixPageThreshold.0 = 95
aixPageName.1 = "hd6"
aixPageNameVG.1 = "rootvg"
aixPageNamePV.1 = "hdisk0"
aixPageSize.1 = 16384
aixPagePercentUsed.1 = 0
aixPageStatus.1 = 1
aixPageType.1 = 1
aixPageIndex.1 = 1
# snmpinfo -md -v -c cmsnmp aixSeMachineType
aixSeMachineType.0 = "IBM,8233-E8B"
3.2 Server-side verification
# 10.10.93.119为client端地址
# snmpwalk -v 1 -c cmsnmp 10.10.93.119 1.3
SNMPv2-MIB::sysDescr.0 = STRING: IBM PowerPC CHRP Computer
Machine Type: 0x0800004c Processor id: 00F854C74C00
Base Operating System Runtime AIX version: 07.02.0002.0015
TCP/IP Client Core Support version: 07.02.0002.0016
SNMPv2-MIB::sysObjectID.0 = OID: SNMPv2-SMI::enterprises.2.3.1.2.1.1.3
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (375200) 1:02:32.00
SNMPv2-MIB::sysContact.0 = STRING:
SNMPv2-MIB::sysName.0 = STRING: jsnewdb1
SNMPv2-MIB::sysLocation.0 = STRING:
SNMPv2-MIB::sysServices.0 = INTEGER: 72
SNMPv2-MIB::sysORLastChange.0 = Timeticks: (500) 0:00:05.00
SNMPv2-MIB::sysORID.1 = OID: SNMPv2-SMI::enterprises.2.3.1.2.1.1.3
SNMPv2-MIB::sysORID.2 = OID: SNMPv2-SMI::enterprises.2.6.191
SNMPv2-MIB::sysORID.3 = OID: HOST-RESOURCES-MIB::host
SNMPv2-MIB::sysORID.4 = OID: SNMPv2-SMI::enterprises.2.3.1.2.1.6
SNMPv2-MIB::sysORDescr.1 = STRING: AIX SNMP Agent
SNMPv2-MIB::sysORDescr.2 = STRING: AIX Enterprise MIB Support subagent
SNMPv2-MIB::sysORDescr.3 = STRING: Host Resources DPI sub-agent Version 1
SNMPv2-MIB::sysORDescr.4 = STRING: AIX SNMP MIB SubAgent
SNMPv2-MIB::sysORUpTime.1 = Timeticks: (100) 0:00:01.00
SNMPv2-MIB::sysORUpTime.2 = Timeticks: (500) 0:00:05.00
SNMPv2-MIB::sysORUpTime.3 = Timeticks: (500) 0:00:05.00
SNMPv2-MIB::sysORUpTime.4 = Timeticks: (500) 0:00:05.00
....
# snmpwalk -v 1 -c cmsnmp 10.10.93.119 1.3 | wc -l #监控项数量统计
17501
#如果监控项数量很少,说明配置有问题,请返回检查配置文件后,重新启停snmpd服务。