Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
| Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
| centos:web_c7:icinga:snmp [31.05.2020 10:39. ] – [Konfiguration Netzwerkswitch] django | centos:web_c7:icinga:snmp [18.11.2024 19:14. ] (aktuell) – Externe Bearbeitung 127.0.0.1 | ||
|---|---|---|---|
| Zeile 24: | Zeile 24: | ||
| * **authPriv** : Benutzerbasierte Authentifizierung wie auch bei authNoPriv, zusätzlich werden alle Daten verschlüsselt. Hier müssen Sie einen Schlüssel manuell austauschen, | * **authPriv** : Benutzerbasierte Authentifizierung wie auch bei authNoPriv, zusätzlich werden alle Daten verschlüsselt. Hier müssen Sie einen Schlüssel manuell austauschen, | ||
| | | ||
| - | Als nächstes definieren wir uns eine SNMP-Gruppe mit Security-Level v3. | + | Als nächstes definieren wir uns eine SNMP-Gruppe mit Security-Level v3. Mit SNMPv3-Gruppen können Benutzer in Gruppen mit unterschiedlichen Berechtigungen und Zugriffsrechten zusammenfassen werden. |
| {{ : | {{ : | ||
| Zeile 34: | Zeile 34: | ||
| ===== SNMP-Clientkonfiguration des CentOS 7 Hosts ===== | ===== SNMP-Clientkonfiguration des CentOS 7 Hosts ===== | ||
| - | Zur Abfrage unseres Netzwerkswitchs auf der Konsole unseres **[[https:// | + | Zur Abfrage unseres Netzwerkswitchs auf der Konsole unseres **[[https:// |
| Wir installieren also dieses Paket mit Hilfe des Paketverwaltungstool **YUM**. | Wir installieren also dieses Paket mit Hilfe des Paketverwaltungstool **YUM**. | ||
| Zeile 121: | Zeile 121: | ||
| V5.7.2 | V5.7.2 | ||
| - | # snmpwalk -v3 -l authPriv -u monwalk -a SHA -A 1mi55MY8357fr13nd511V14 | + | # snmpwalk -v3 -l authPriv -u monwalk -a SHA -A 1mi55MY8F511V14 |
| < | < | ||
| SNMPv2-MIB:: | SNMPv2-MIB:: | ||
| DISMAN-EVENT-MIB:: | DISMAN-EVENT-MIB:: | ||
| - | SNMPv2-MIB:: | + | SNMPv2-MIB:: |
| SNMPv2-MIB:: | SNMPv2-MIB:: | ||
| SNMPv2-MIB:: | SNMPv2-MIB:: | ||
| Zeile 211: | Zeile 211: | ||
| In folgendem Beispiel wollen wir den Hostnamen des Switchs erfragen. Hierzu nutzen wir den Parameter **'' | In folgendem Beispiel wollen wir den Hostnamen des Switchs erfragen. Hierzu nutzen wir den Parameter **'' | ||
| - | # snmpget -v3 -l authPriv -u monwalk -a SHA -A 1mi55MY8357fr13nd511V14 | + | # snmpget -v3 -l authPriv -u monwalk -a SHA -A 1mi55MY8F511V14 |
| SNMPv2-MIB:: | SNMPv2-MIB:: | ||
| Natürlich können wir auch mehrere Werte abfragen, wie z.B. den Einbauort mit **'' | Natürlich können wir auch mehrere Werte abfragen, wie z.B. den Einbauort mit **'' | ||
| - | # snmpget -v3 -l authPriv -u monwalk -a SHA -A 1mi55MY8357fr13nd511V14 | + | # snmpget -v3 -l authPriv -u monwalk -a SHA -A 1mi55MY8F511V14 |
| | | ||
| SNMPv2-MIB:: | SNMPv2-MIB:: | ||
| DISMAN-EVENT-MIB:: | DISMAN-EVENT-MIB:: | ||
| + | |||
| + | ==== check_snmp ==== | ||
| + | Für die Checks verwenden wir **'' | ||
| + | # yum install nagios-plugins-snmp -y | ||
| + | |||
| + | Die zum Plugin gehörigen Option können wir wie folgt abfragen. | ||
| + | # / | ||
| + | |||
| + | < | ||
| + | Copyright (c) 1999-2018 Nagios Plugin Development Team | ||
| + | < | ||
| + | |||
| + | Check status of remote machines and obtain system information via SNMP | ||
| + | |||
| + | |||
| + | Usage: | ||
| + | check_snmp -H < | ||
| + | [-C community] [-s string] [-r regex] [-R regexi] [-t timeout] [-e retries] | ||
| + | [-l label] [-u units] [-p port-number] [-d delimiter] [-D output-delimiter] | ||
| + | [-m miblist] [-P snmp version] [-N context] [-L seclevel] [-U secname] | ||
| + | [-a authproto] [-A authpasswd] [-x privproto] [-X privpasswd] [--strict] | ||
| + | |||
| + | Options: | ||
| + | -h, --help | ||
| + | Print detailed help screen | ||
| + | -V, --version | ||
| + | Print version information | ||
| + | | ||
| + | Read options from an ini file. See | ||
| + | https:// | ||
| + | for usage and examples. | ||
| + | -4, --use-ipv4 | ||
| + | Use IPv4 connection | ||
| + | -6, --use-ipv6 | ||
| + | Use IPv6 connection | ||
| + | -H, --hostname=ADDRESS | ||
| + | Host name, IP Address, or unix socket (must be an absolute path) | ||
| + | -p, --port=INTEGER | ||
| + | Port number (default: 161) | ||
| + | -n, --next | ||
| + | Use SNMP GETNEXT instead of SNMP GET | ||
| + | -P, --protocol=[1|2c|3] | ||
| + | SNMP protocol version | ||
| + | -N, --context=CONTEXT | ||
| + | SNMPv3 context | ||
| + | -L, --seclevel=[noAuthNoPriv|authNoPriv|authPriv] | ||
| + | SNMPv3 securityLevel | ||
| + | -a, --authproto=[MD5|SHA] | ||
| + | SNMPv3 auth proto | ||
| + | -x, --privproto=[DES|AES] | ||
| + | SNMPv3 priv proto (default DES) | ||
| + | -C, --community=STRING | ||
| + | Optional community string for SNMP communication (default is " | ||
| + | -U, --secname=USERNAME | ||
| + | SNMPv3 username | ||
| + | -A, --authpasswd=PASSWORD | ||
| + | SNMPv3 authentication password | ||
| + | -X, --privpasswd=PASSWORD | ||
| + | SNMPv3 privacy password | ||
| + | -o, --oid=OID(s) | ||
| + | Object identifier(s) or SNMP variables whose value you wish to query | ||
| + | -m, --miblist=STRING | ||
| + | List of MIBS to be loaded (default = none if using numeric OIDs or ' | ||
| + | for symbolic OIDs.) | ||
| + | -d, --delimiter=STRING | ||
| + | Delimiter to use when parsing returned data. Default is " | ||
| + | Any data on the right hand side of the delimiter is considered | ||
| + | to be the data that should be used in the evaluation. | ||
| + | -w, --warning=THRESHOLD(s) | ||
| + | Warning threshold range(s) | ||
| + | -c, --critical=THRESHOLD(s) | ||
| + | Critical threshold range(s) | ||
| + | | ||
| + | Enable rate calculation. See 'Rate Calculation' | ||
| + | | ||
| + | Converts rate per second. For example, set to 60 to convert to per minute | ||
| + | | ||
| + | Add/ | ||
| + | -s, --string=STRING | ||
| + | Return OK state (for that OID) if STRING is an exact match | ||
| + | -r, --ereg=REGEX | ||
| + | Return OK state (for that OID) if extended regular expression REGEX matches | ||
| + | -R, --eregi=REGEX | ||
| + | Return OK state (for that OID) if case-insensitive extended REGEX matches | ||
| + | | ||
| + | Invert search result (CRITICAL if found) | ||
| + | -l, --label=STRING | ||
| + | Prefix label for output from plugin | ||
| + | -u, --units=STRING | ||
| + | Units label(s) for output data (e.g., ' | ||
| + | -D, --output-delimiter=STRING | ||
| + | Separates output on multiple OID requests | ||
| + | -t, --timeout=INTEGER:< | ||
| + | Seconds before connection times out (default: 10) | ||
| + | Optional ":< | ||
| + | -e, --retries=INTEGER | ||
| + | Number of retries to be used in the requests | ||
| + | -O, --perf-oids | ||
| + | Label performance data with OIDs instead of --label' | ||
| + | | ||
| + | Enable strict mode: arguments to -o will be checked against the OID | ||
| + | returned by snmpget. If they don't match, the plugin returns UNKNOWN. | ||
| + | -v, --verbose | ||
| + | Show details for command-line debugging (Nagios may truncate output) | ||
| + | |||
| + | This plugin uses the ' | ||
| + | if you don't have the package installed, you will need to download it from | ||
| + | http:// | ||
| + | |||
| + | Notes: | ||
| + | - Multiple OIDs (and labels) may be indicated by a comma or space-delimited | ||
| + | list (lists with internal spaces must be quoted). | ||
| + | - See: | ||
| + | | ||
| + | for THRESHOLD format and examples. | ||
| + | - When checking multiple OIDs, separate ranges by commas like '-w 1: | ||
| + | - Note that only one string and one regex may be checked at present | ||
| + | - All evaluation methods other than PR, STR, and SUBSTR expect that the value | ||
| + | | ||
| + | |||
| + | Rate Calculation: | ||
| + | In many places, SNMP returns counters that are only meaningful when | ||
| + | | ||
| + | saves the last state information in a file so that the rate per second | ||
| + | can be calculated. Use the --rate option to save state information. | ||
| + | On the first run, there will be no prior state - this will return with OK. | ||
| + | The state is uniquely determined by the arguments to the plugin, so | ||
| + | | ||
| + | |||
| + | Send email to help@nagios-plugins.org if you have questions regarding use | ||
| + | of this software. To submit patches or suggest improvements, | ||
| + | devel@nagios-plugins.org | ||
| + | |||
| + | </ | ||
| + | |||
| + | Analog dem vorherigen Beispiel mit **[[# | ||
| + | /* # ./ | ||
| + | # / | ||
| + | -X " | ||
| + | |||
| + | SNMP OK - Timeticks: (1696245576) 196 days, 7:47:35.76 | iso.3.6.1.2.1.1.3.0=1696245576 | ||
| + | |||
| + | In der nachfolgenden Tabelle sind ein paar der gängigen **[[https:// | ||
| + | |||
| + | ^ Node ^ OID ^ check-command | ||
| + | | sysDescr | ||
| + | -A " | ||
| + | | sysUpTime | ||
| + | -A " | ||
| + | | sysContact | ||
| + | -A " | ||
| + | | sysName | ||
| + | -A " | ||
| + | | sysLocation | ||
| + | -A " | ||
| + | |||
| + | Nun wollen wir den Zustand einzelner Ports unseres Switchs abfragen. In der Administrations-WEB-GUI sehen wir z.B. folgende Übersicht. | ||
| + | |||
| + | {{ : | ||
| + | |||
| + | Die blau markierten Ports sind **down** und die gelb und grün markierten Ports sind up, also in Verwendung. | ||
| + | Mit **'' | ||
| + | # snmpwalk -v3 -l authPriv -u monwalk -a SHA -A 1mi55MY8F511V14 -x DES -X 1mi55MY8F511V14 \ | ||
| + | | ||
| + | < | ||
| + | IF-MIB:: | ||
| + | IF-MIB:: | ||
| + | IF-MIB:: | ||
| + | IF-MIB:: | ||
| + | IF-MIB:: | ||
| + | IF-MIB:: | ||
| + | IF-MIB:: | ||
| + | IF-MIB:: | ||
| + | IF-MIB:: | ||
| + | IF-MIB:: | ||
| + | IF-MIB:: | ||
| + | IF-MIB:: | ||
| + | IF-MIB:: | ||
| + | IF-MIB:: | ||
| + | IF-MIB:: | ||
| + | IF-MIB:: | ||
| + | IF-MIB:: | ||
| + | IF-MIB:: | ||
| + | IF-MIB:: | ||
| + | IF-MIB:: | ||
| + | IF-MIB:: | ||
| + | IF-MIB:: | ||
| + | IF-MIB:: | ||
| + | IF-MIB:: | ||
| + | IF-MIB:: | ||
| + | IF-MIB:: | ||
| + | IF-MIB:: | ||
| + | IF-MIB:: | ||
| + | IF-MIB:: | ||
| + | IF-MIB:: | ||
| + | IF-MIB:: | ||
| + | IF-MIB:: | ||
| + | IF-MIB:: | ||
| + | IF-MIB:: | ||
| + | IF-MIB:: | ||
| + | IF-MIB:: | ||
| + | IF-MIB:: | ||
| + | IF-MIB:: | ||
| + | IF-MIB:: | ||
| + | IF-MIB:: | ||
| + | IF-MIB:: | ||
| + | IF-MIB:: | ||
| + | IF-MIB:: | ||
| + | IF-MIB:: | ||
| + | IF-MIB:: | ||
| + | IF-MIB:: | ||
| + | IF-MIB:: | ||
| + | IF-MIB:: | ||
| + | IF-MIB:: | ||
| + | IF-MIB:: | ||
| + | IF-MIB:: | ||
| + | IF-MIB:: | ||
| + | Error: OID not increasing: IP-MIB:: | ||
| + | >= IP-MIB:: | ||
| + | |||
| + | Wollen wir nun gezielt einen Netzwerkport überprüfen verwenden wir nachfolgenden check-Optionen. In dem Beispiel bezieht sich das "-o ifOperStatus.49200" | ||
| + | # / | ||
| + | -X " | ||
| + | SNMP OK - up(1) | | ||
| + | |||
| + | Fragen wir hingegen einen bekannt unbenutzten Port **46** ab, benutzen wir die **''' | ||
| + | # / | ||
| + | -X " | ||
| + | SNMP OK - down(2) | | ||
| + | |||
| + | Manchmal wollen wir denn Status mehrerer Ports zusammen überwachen, | ||
| + | |||
| + | # / | ||
| + | -X " | ||
| + | -o ifOperStatus.49192 -m RFC1213-MIB, | ||
| + | -o ifOperStatus.49193 -m RFC1213-MIB, | ||
| + | -o ifOperStatus.49194 -m RFC1213-MIB | ||
| + | |||
| + | SNMP OK - up(1) up(1) up(1) up(1) | | ||
| + | |||
| + | Nun wollen wir uns im nächsten Schritt den IO-Traffic eines Ports ansehen, den dieser emfpfängt und auch verschickt. | ||
| + | |||
| + | Im folgenden Beispiel wollen wir sehen wieviele Datenverkehr am Port **41** ansteht, der z.B. in dem speziellen Fall den Uplink zum Transitknoten in das Internet zur Verfügung stellt. Wie wir bereits aus vorhergehenden Überlegungen wissen, werden die Ports des betreffenden Kupfer-Links des Netzwerkswitches mit den Nummern **49153** bis **49200** definiert. der Port **41** wird also durch den Wert **49193** repräsentiert. | ||
| + | |||
| + | In der Übersicht der gängigen **[[https:// | ||
| + | |||
| + | ^ Node ^ OID ^ check-command | ||
| + | | ifInOctets | ||
| + | -A " | ||
| + | | ifOutOctets | ||
| + | -A " | ||
| + | |||
| + | Auch hier können wir natürlich beide Werte mit einem check ermitteln und ausgeben lassen. | ||
| + | # / | ||
| + | -A " | ||
| + | |||
| + | SNMP OK - 2784727717 3185448505 | iso.3.6.1.2.1.2.2.1.10.49191=2784727717c iso.3.6.1.2.1.2.2.1.16.49191=3185448505c | ||
| FIXME **//... do gehds weida!//** FIXME | FIXME **//... do gehds weida!//** FIXME | ||