CONTENT
  • CHANGES
Szukaj
counter

#top SNMPd

[<<]|[<]|[^]|[v]|[>]|[>>]|[Zwiń]|[#top]|[X]

#top SNMP RFC


Management Information Base for Network Management of TCP/IP-based internets
https://tools.ietf.org/html/rfc1156

A Simple Network Management Protocol (SNMP)
https://tools.ietf.org/html/rfc1157



#top snmpd


Konfiguracja demona snmpd znajduje się w pliku konfiguracyjnym /etc/snmp/snmpd.conf w przypadku zastosowania innej lokalizacji niezbędne jest przekazanie tej informacji demonowi w postaci argumentu -c /path/to/snmpd-file.conf. Niniejszą informację należy umieścić w zmiennej OPTIONS zdefiniowanej w pliku /etc/sysconfig/snmpd (lub zdefiniowanej w pliku /etc/sysconfig/snmpd.options w dystrybucji CentOS w wersji 5.*) wczytywanym przez skrypt startowy demona. Dostępny po instalacji plik /etc/sysconfig/syslog wygląda analogicznie jak poniżej:
# snmpd command line options
# OPTIONS="-Lsd -Lf /dev/null -p /var/run/snmpd.pid -a"

Standardowo informacje związane z połączeniem do demona snmpd logowane są do pliku /var/log/daemon/daemon.log oraz /var/log/messages, co w przypadku monitorowania dużej ilości parametrów Systemu Operacyjnego poprzez odpytywanie demona snmpd może zaciemniać obserwację innych informacji o Systemie Operacyjnym, dlatego też wskazane jest skonfigurowanie demona snmpd, aby logował wszystkie informacje do osobnego pliku. Aby to zrobić należy ustawić zmienną OPTIONS analogicznie jak przedstawiono poniżej usuwając domyślnie włączoną opcję -Lsd nakazującą logwanie informacji poprzez demona syslog a następnie dodać opcję -Lf /var/log/snmpd/snmpd.log wskazującą ścieżkę do pliku, do którego będą logowane informacje o połączeniach (tak jak przedstawiono poniżej). Należy przedtem utworzyć katalog /var/log/snmpd na pliki logów, który prawdopodobnie nie istnieje.
# snmpd command line options
# OPTIONS="-Lsd -Lf /dev/null -p /var/run/snmpd.pid -a"
OPTIONS="-Lf /var/log/snmpd/snmpd.log -p /var/run/snmpd.pid -a"

SYNOPSIS
snmpd [OPTIONS] [LISTENING ADDRESSES]

Poniżej przedstawiono argumenty, które można przekazać demonowi snmpd podczas uruchamiania by zmienić jego zachowanie:
OPTIONS
-a
Log the source addresses of incoming requests.

-A
Append to the log file rather than truncating it.

-c FILE
Read FILE as a configuration file (or a comma-separated list of configuration files). Note that the loaded file will only understand snmpd.conf tokens, unless the configuration type is specified in the file as described in the snmp_config man page under SWITCHING CONFIGURATION TYPES IN MID-FILE.

-C
Do not read any configuration files except the ones optionally specified by the -c option. Note that this behaviour also covers the persistent configuration files. This may result in dynamically-assigned values being reset following an agent restart, unless the relevant persistent config files are explicitly loaded using the -c option.

-d
Dump (in hexadecimal) the sent and received SNMP packets.

-D[TOKEN[,...]]
Turn on debugging output for the given TOKEN(s). Without any tokens specified, it defaults to printing all the tokens (which is equivalent to the keyword "ALL"). You might want to try ALL for extremely verbose output. Note: You can not put a space between the -D flag and the listed TOKENs.

-f
Do not fork() from the calling shell.

-g GID
Change to the numerical group ID GID after opening listening sockets.

-h, --help
Display a brief usage message and then exit.

-H
Display a list of configuration file directives understood by the agent and then exit.

-I [-]INITLIST
Specifies which modules should (or should not) be initialized when the agent starts up. If the comma-separated INITLIST is preceded with a '-', it is the list of modules that should not be started. Otherwise this is the list of the only modules that should be started.

To get a list of compiled modules, run the agent with the arguments -Dmib_init -H (assuming debugging support has been compiled in).

-L[efos]
Specify where logging output should be directed (standard error or output, to a file or via syslog). See LOGGING OPTIONS in snmpcmd(5) for details.

-m MIBLIST
Specifies a colon separated list of MIB modules to load for this application. This overrides the environment variable MIBS. See snmpcmd(1) for details.

-M DIRLIST
Specifies a colon separated list of directories to search for MIBs. This overrides the environment variable MIBDIRS. See snmpcmd(1) for details.

-n NAME
Set an alternative application name (which will affect the configuration files loaded). By default this will be snmpd, regardless of the name of the actual binary.

-p FILE
Save the process ID of the daemon in FILE.

-q
Print simpler output for easier automated parsing.

-r
Do not require root access to run the daemon. Specifically, do not exit if files only accessible to root (such as /dev/kmem etc.) cannot be opened.

-u UID
Change to the user ID UID (which can be given in numerical or textual form) after opening listening sockets.

-U
Instructs the agent to not remove its pid file (see the -p option) on shutdown. Overrides the leave_pidfile token in the snmpd.conf file, see snmpd.conf(5).

-v, --version
Print version information for the agent and then exit.

-V
Symbolically dump SNMP transactions.

-x ADDRESS
Listens for AgentX connections on the specified address rather than the default '/var/agentx/master'. The address can either be a Unix domain socket path, or the address of a network interface. The format is the same as the format of listening addresses described below.

-X
Run as an AgentX subagent rather than as an SNMP master agent.

--name="value"
Allows to specify any token ("name") supported in the snmpd.conf file and sets its value to "value". Overrides the corresponding token in the snmpd.conf file. See snmpd.conf(5) for the full list of tokens.



#top snmpd.conf


Po zainstalowaniu plik konfiguracyjny /etc/snmp/snmpd.conf nie zawiera konfiguracji pozwalającej monitorować standardowe niezbędne parametry działania Systemu Operacyjnego. Aby zmienić tę sytuację należy fragment (przedstawiony poniżej) znajdujący się na początku pliku konfiguracyjnego uzupełnić o dodatkowe informacje:
####
# First, map the community name "public" into a "security name"

#       sec.name  source          community
com2sec notConfigUser  default       public

####
# 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

# -----------------------------------------------------------------------------

Powyżej przedstawiony fragment pliku konfiguracyjnego /etc/snmp/snmpd.conf należy zastąpić fragmentem przedstawionym poniżej zawierającym niezbędne opcje pozwalające monitorować standardowe niezbędne parametry działania Systemu Operacyjnego.
####
# First, map the community name (COMMUNITY) into a security name
# (local and mynetwork, depending on where the request is coming
# from):

#       sec.name  source          community
#com2sec paranoid  default         public
#com2sec readonly  default          public
com2sec readonly  127.0.0.1         public
com2sec readonly  10.5.5.5          public
#com2sec readwrite default         private

####
# Second, map the security names into group names:

#               sec.model  sec.name
group MyROSystem v1        paranoid
group MyROSystem v2c       paranoid
group MyROSystem usm       paranoid
group MyROGroup v1         readonly
group MyROGroup v2c        readonly
group MyROGroup usm        readonly
group MyRWGroup v1         readwrite
group MyRWGroup v2c        readwrite
group MyRWGroup usm        readwrite

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

#           incl/excl subtree                          mask
view all    included  .1                               80
view system included  .iso.org.dod.internet.mgmt.mib-2.system

####
# Finally, grant the 2 groups access to the 1 view with different
# write permissions:

#                context sec.model sec.level match  read   write  notif
access MyROSystem ""     any       noauth    exact  system none   none
access MyROGroup ""      any       noauth    exact  all    none   none
access MyRWGroup ""      any       noauth    exact  all    all    none

# -----------------------------------------------------------------------------


Zmodyfikowany ostatnio: 2015/07/01 16:45:34 (8 lat temu), textsize: 10,5 kB, htmlsize: 14,2 kB

Zapraszam do komentowania, zgłaszania sugestii, propozycji, własnych przykładów, ...
Dodaj komentarzKomentarze użytkowników