无法在RHEL中通过SNMP查看特定进程

时间:2016-03-17 13:35:53

标签: linux snmp net-snmp

我尝试配置SNMP以在Linux(RHEL 7)盒上公开多个进程以进行监视。我已向proc添加了相应的snmp.conf指令,并为snmpd重新加载和重新启动以尝试使其生效,但这些流程的信息不是&#39 ; t可见。

我不是那个进行基本snmpd配置的人,而且我并不是非常熟悉"操作方法" snmpd配置,但我觉得snmpd.conf几乎是默认的配置文件,所以我怀疑我错过了一些我需要添加的简单内容。

这是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

这是snmptable的清理输出:

[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 ~]$

1 个答案:

答案 0 :(得分:0)

事实证明我在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 ~]$