Конфигурационный файл /etc/snmp/snmpd.conf

По умолчанию файл /etc/snmp/snmpd.conf выглядит следующим образом:

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

# Listen for connections from the local system only.

agentaddress  udp:127.0.0.1:161

# Listen for connections on all interfaces.

#agentaddress udp:161

 

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

# ATTENTION: change community and restrict access to SNMP requests #

#            from the specified sources for security reasons.      #

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

 

# Read-only access from anywhere with 'public' community.

rocommunity public default -V customview

# Read-only access from 10.0.0.0/16 with 'public' community.

#rocommunity public 10.0.0.0/16 -V customview

 

# .iso.org.dod.internet.mgmt.mib-2

view customview included .1.3.6.1.2.1

# .iso.org.dod.internet.private.enterprises.cisco

view customview included .1.3.6.1.4.1.9

# S-TERRA-CSP-MIB.

view customview included .1.3.6.1.4.1.31342

# .iso.org.dod.internet.private.enterprises.Debian.project.keepalived

view customview included .1.3.6.1.4.1.9586.100.5

# .iso.identified-organization.dod.internet.private.enterprise.ucdavis

view customview included .1.3.6.1.4.1.2021

# .iso.identified-organization.dod.internet.private.enterprise.netSnmpObjects.nsExtensions

# For using 'extend' directive (NET-SNMP-EXTEND-MIB).

view customview included 1.3.6.1.4.1.8072.1.3

 

# Getting the number of days until the the local certificate expires.

# Usage example: snmpget -v 2c -c public 127.0.0.1:161 NET-SNMP-EXTEND-MIB::nsExtendOutputFull.\"get_days_until_local_cert_exp\"

extend get_days_until_local_cert_exp /bin/bash /opt/snmp_monitoring/snmp_extend/get_days_until_local_cert_exp/get_days_until_local_cert_exp.extend.bash

 

# Configures  monitoring  of all disks found on the system, using the specified (percentage) threshold.

includeAllDisks 10%

 

# Proxy directive to pass part of the OID tree to S-Terra CSP SNMP agent to retrieve IKE and IPsec stats.

# Example of S-Terra Gate SNMP configuration in Cisco-like console:

#   snmp-server community public RO

#   snmp-server polling address 127.0.0.1

#   snmp-server polling udp-port 1161

proxy -v 2c -c "public" 127.0.0.1:1161 .1.3.6.1.4.1.9

proxy -v 2c -c "public" 127.0.0.1:1161 .1.3.6.1.2.1.1.1.0

proxy -v 2c -c "public" 127.0.0.1:1161 .1.3.6.1.4.1.31342

 

# Enable the AgentX functionality and cause the agent to start listening for incoming AgentX registrations

# (for example used by a Keepalived).

master agentx

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

Пояснения:

agentaddress <IP адрес шлюза>:<порт> – локальный адрес шлюза, на котором SNMPD слушает запросы от систем мониторинга; 161 – локальный порт (стандартный).

rocommunity – задает значение community-строки (в данном случае – “public”) с правами только на чтение, а следующее за ним ключевое слово default -V <имя> указывает какие объектные идентификаторы (OID) будут выдаваться. Если нужны права не только на чтение, но и на запись значений OID, замените rocommunity на rwcommunity.

view <имя> included <OID> –задает значения, объектных идентификаторов, доступные для использования. В качестве <OID> в конфигурации указаны поддеревья идентификаторов, т.е. доступными для использования становятся все присутствующие в системе значения, являющиеся дочерними к указанным.

includeAllDisks <число>% – включает мониторинг дискового пространства. Числом указывается процент оставшегося свободного места на разделе. В случае, если свободного места оказывается меньше указанного, переменная UCD-SNMP-MIB::dskErrorFlag.<номер> для соответствующего раздела примет значение «1».

proxy -v 2c -c "public" 127.0.0.1:1161 <OID> – указывает, что запросы к <OID> нужно перенаправлять встроенному агенту VPNGATE.