无法通过SNMP终止进程

时间:2016-05-20 23:19:22

标签: snmp net-snmp snmpd

我正在尝试使用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

1 个答案:

答案 0 :(得分:0)

  

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

上面的消息可能就是它所说的。该变量是只读的,无法编辑。如果在MIB中指定了变量是否可写。你最好先检查一下MIB。如果变量是只读的,那么无关紧要。

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