我试图将SNMP配置为在Linux(RHEL 7)上公开多个进程以进行监视。我已经在proc中添加了适当的snmp.conf指令,并对snmpd执行了重新加载和重新启动,以尝试使其工作,但这些进程的信息不可见。
我不是那个做基本配置的人,我也不是非常熟悉snmpd配置的“how-to”,但在我看来,snmpd几乎是默认配置文件,所以我怀疑我遗漏了一些需要添加的简单内容。
这是消毒版的snmpd.conf

###############################################################################
#
# snmpd.conf:
#
###############################################################################
#
# Many more configuration directives exist than are mentioned in this file.
# For full details, see the snmpd.conf(5) manual page.
#
# All lines beginning with a '#' are comments and are intended for you
# to read.  All other lines are configuration commands for the agent.

###############################################################################
# Access Control
###############################################################################

# As shipped, the snmpd demon will only respond to queries on the
# system mib group until this file is replaced or modified for
# security purposes.

####
# First, map the community name "changeme" into a "security name"

#       sec.name  source          community
com2sec notConfigUser  default       changeme

####
# Second, map the security name into a group name:

#       groupName      securityModel securityName
group   notConfigGroup v1           notConfigUser
group   notConfigGroup v2c           notConfigUser

####
# Third, create a view for us to let the group have rights to:

# Make at least  snmpwalk -v 1 localhost -c public system fast again.
#       name           incl/excl     subtree         mask(optional)
view    systemview    included   .1.3.6.1.2.1.1
view    systemview    included   .1.3.6.1.2.1.25.1.1

####
# Finally, grant the group read-only access to the systemview view.

#       group          context sec.model sec.level prefix read   write  notif
access  notConfigGroup ""      any       noauth    exact  systemview none none

###############################################################################

###########################################################################
# SECTION: Monitor Various Aspects of the Running Host
#
#   The following check up on various aspects of a host.

# proc: Check for processes that should be running.
#     proc NAME [MAX=0] [MIN=0]
#
#     NAME:  the name of the process to check for.  It must match
#            exactly (ie, http will not find httpd processes).
#     MAX:   the maximum number allowed to be running.  Defaults to 0.
#     MIN:   the minimum number to be running.  Defaults to 0.
#
#   The results are reported in the prTable section of the UCD-SNMP-MIB tree
#   Special Case:  When the min and max numbers are both 0, it assumes
#   you want a max of infinity and a min of 1.

proc  httpd

以下是snmpd.conf的消毒输出:
[user@host ~]$ snmptable -v1 -Ci -Cb -c changeme localhost .1.3.6.1.4.1.2021.2
End of MIB
UCD-SNMP-MIB::ucdavis: No entries
[user@host ~]$

最佳答案

结果发现我在snmpd.conf中遗漏了以下内容:

# UCD Process & Disk Tables.
view    systemview    included   .1.3.6.1.4.1.2021.2
view    systemview    included   .1.3.6.1.4.1.2021.9

添加后,以下命令将生成以下结果:
[user@host ~]$ snmptable -v1 -Ci -Cb -c changeme localhost .1.3.6.1.4.1.2021.2
End of MIB
SNMP table: UCD-SNMP-MIB::prTable

 index Index        Names Min Max Count ErrorFlag                  ErrMessage  ErrFix ErrFixCmd
     1     1        httpd   1   0    10   noError                             noError
[user@host ~]$

关于linux - 无法在RHEL中通过SNMP查看特定进程,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/36062152/

10-11 08:10