2

我正在尝试使用 SNMP 终止进程。我知道可以将进程的“状态”字段设置为 4,例如:

snmpset -v 2c -c community_string ipaddress 1.3.6.1.2.1.25.4.2.1.7.PID i 4

我总是收到同样的信息:

数据包错误。原因:不可写(该对象不支持修改) 失败对象:iso.3.6.1.2.1.25.4.2.1.7.PID

我不知道为什么,但是当我使用通常具有所有权限的“localhost”时也会发生这种情况。也许我的设置有问题?这是我的 snmpd.conf 文件:

#  AGENT BEHAVIOUR
#

#  Listen for connections from the local system only
agentAddress  udp:161
#  Listen for connections on all interfaces (both IPv4 *and* IPv6)
#agentAddress udp:161,udp6:[::1]:161

###############################################################################
#
#  ACCESS CONTROL
#

                                                 #  system + hrSystem groups only
view   systemonly  included   .1.3.6.1.2.1.1
view   systemonly  included   .1.3.6.1.2.1.25.1

                                                 #  Full access from the local host
rwcommunity public  localhost

rwcommunity ubuntulaptop
                                                 #  Default access to basic system info
 rocommunity public  default    -V systemonly
                                                 #  rocommunity6 is for IPv6
 rocommunity6 public  default   -V systemonly

                                                 #  Full access from an example network
                                                 #     Adjust this network address to match your local
                                                 #     settings, change the community string,
                                                 #     and check the 'agentAddress' setting above
#rocommunity secret  10.0.0.0/16

                                                 #  Full read-only access for SNMPv3
 rouser   authOnlyUser
                                                 #  Full write access for encrypted requests
                                                 #     Remember to activate the 'createUser' lines above
#rwuser   authPrivUser   priv

#  It's no longer typically necessary to use the full 'com2sec/group/access' configuration
#  r[ow]user and r[ow]community, together with suitable views, should cover most requirements



###############################################################################
#
#  SYSTEM INFORMATION
#

#  Note that setting these values here, results in the corresponding MIB objects being 'read-only'
#  See snmpd.conf(5) for more details
sysLocation    Sitting on the Dock of the Bay
sysContact     Me <me@example.org>
                                                 # Application + End-to-End layers
sysServices    72


#
#  Process Monitoring
#
                               # At least one  'mountd' process
proc  mountd
                               # No more than 4 'ntalkd' processes - 0 is OK
proc  ntalkd    4
                               # At least one 'sendmail' process, but no more than 10
proc  sendmail 10 1

#  Walk the UCD-SNMP-MIB::prTable to see the resulting output
#  Note that this table will be empty if there are no "proc" entries in the snmpd.conf file


#
#  Disk Monitoring
#
                               # 10MBs required on root disk, 5% free on /var, 10% free on all other disks
disk       /     10000
disk       /var  5%
includeAllDisks  10%

#  Walk the UCD-SNMP-MIB::dskTable to see the resulting output
#  Note that this table will be empty if there are no "disk" entries in the snmpd.conf file


#
#  System Load
#
                               # Unacceptable 1-, 5-, and 15-minute load averages
load   12 10 5

#  Walk the UCD-SNMP-MIB::laTable to see the resulting output
#  Note that this table *will* be populated, even without a "load" entry in the snmpd.conf file

4

1 回答 1

0

数据包错误。原因:不可写(该对象不支持>修改)失败对象:iso.3.6.1.2.1.25.4.2.1.7.PID

上面的这条消息可能就是它所说的。该变量是只读的,不能编辑。MIB 中指定变量是否可写。你最好先检查 MIB。如果一个变量是只读的,那么你做什么都没关系。

据我所知,使用 SNMP 杀死进程并不常见。至少你通常不会那样做。SNMP 用于管理网络。但是如果你有一个专有的 MIB,你必须检查它,看看它在那里说了什么。

于 2016-06-06T23:42:46.310 回答