Projekt

Általános

Profil

SNMP Agent Telepítés és Beállítása

Pesta KI adta hozzá 2 hónapja

Telepítése
UFW vagy egyéb tűzfal esetén az UDP/161 es portot engedélyezd!

sudo apt install snmpd
sudo rm -rf /etc/snmp/snmpd.conf

SNMP konfig

sudo nano /etc/snmp/snmpd.conf

FIGYELEM!
A Következőket módosítsd a mintakonfigban, miután az alapot felülírattad.

  • sysLocation
  • sysContact
  • rocommunity
  • rocommunity6
###########################################################################
#
# snmpd.conf
# An example configuration file for configuring the Net-SNMP agent ('snmpd')
# See snmpd.conf(5) man page for details
#
###########################################################################
# SECTION: System Information Setup
#

# syslocation: The [typically physical] location of the system.
#   Note that setting this value here means that when trying to
#   perform an snmp SET operation to the sysLocation.0 variable will make
#   the agent return the "notWritable" error code.  IE, including
#   this token in the snmpd.conf file will disable write access to
#   the variable.
#   arguments:  location_string
sysLocation    <Lokáció>
sysContact     <Kontakt>
#sysContact konvencio: Vezetek Keresztnev (06-xx-xxx-xxxx)

# sysservices: The proper value for the sysServices object.
#   arguments:  sysservices_number
sysServices    72

###########################################################################
# SECTION: Agent Operating Mode
#
#   This section defines how the agent will operate when it
#   is running.

# master: Should the agent operate as a master agent or not.
#   Currently, the only supported master agent type for this token
#   is "agentx".
#
#   arguments: (on|yes|agentx|all|off|no)

master  agentx

# agentaddress: The IP address and port number that the agent will listen on.
#   By default the agent listens to any and all traffic from any
#   interface on the default SNMP port (161).  This allows you to
#   specify which address, interface, transport type and port(s) that you
#   want the agent to listen on.  Multiple definitions of this token
#   are concatenated together (using ':'s).
#   arguments: [transport:]port[@interface/address],...

agentAddress udp:161

###########################################################################
# SECTION: Access Control Setup
#
#   This section defines who is allowed to talk to your running
#   snmp agent.

# Views
#   arguments viewname included [oid]

#  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

view   systemonly  included   .1.3.6.1
#SYS uptime
view   systemonly  included   .1.3.6.1.2.1.1
#
view   systemonly  included   .1.3.6.1.2.1.25.1
#CPU parameters
view   systemonly  included   .1.3.6.1.4.1.2021.11
#memory parameter
view   systemonly  included   .1.3.6.1.4.1.2021.4
view   systemonly  included   .1.3.6.1.4.1.2021.4
#Network parameter
view   systemonly  included   .1.3.6.1.2.1.2.2.1.10
view   systemonly  included   .1.3.6.1.2.1.2.2.1.2
view   systemonly  included   .1.3.6.1.2.1.2.2.1.10.4
view   systemonly  included   .1.3.6.1.2.1.2.2.1.16

# rocommunity: a SNMPv1/SNMPv2c read-only access community name
#   arguments:  community [default|hostname|network/bits] [oid | -V view]

# Read-only access to everyone to the systemonly view
rocommunity  <SNMP Community> default -V systemonly
rocommunity6 <SNMP Community> default -V systemonly

# SNMPv3 doesn't use communities, but users with (optionally) an
# authentication and encryption string. This user needs to be created
# with what they can view with rouser/rwuser lines in this file.
#
# createUser username (MD5|SHA|SHA-512|SHA-384|SHA-256|SHA-224) authpassphrase [DES|AES] [privpassphrase]
# e.g.
# createuser authPrivUser SHA-512 myauthphrase AES myprivphrase
#
# This should be put into /var/lib/snmp/snmpd.conf
#
# rouser: a SNMPv3 read-only access username
#    arguments: username [noauth|auth|priv [OID | -V VIEW [CONTEXT]]]
rouser authPrivUser authpriv -V systemonly

# include a all *.conf files in a directory
includeDir /etc/snmp/snmpd.conf.d

SNMPD Újraindítás

sudo systemctl restart snmpd