在 RHEL 中无法通过 SNMP 查看特定进程
Unable to View Specific Processes via SNMP in RHEL
我正在尝试配置 SNMP 以在 Linux (RHEL 7) 框上公开多个进程以用于监视目的。我已将适当的 proc
指令添加到 snmp.conf
并为 snmpd
重新加载和重新启动以尝试使其正常工作,但这些进程的信息不可见。
我不是基本 snmpd
配置的人,我对 snmpd
配置的 "how-to" 不是很熟悉,但在我看来, 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 ~]$
原来我在 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 ~]$
我正在尝试配置 SNMP 以在 Linux (RHEL 7) 框上公开多个进程以用于监视目的。我已将适当的 proc
指令添加到 snmp.conf
并为 snmpd
重新加载和重新启动以尝试使其正常工作,但这些进程的信息不可见。
我不是基本 snmpd
配置的人,我对 snmpd
配置的 "how-to" 不是很熟悉,但在我看来, 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 ~]$
原来我在 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 ~]$