27
System/Network monitoring SNMP Trap Translator

Nllgg - Nagios Cacti Snmp Traps

Embed Size (px)

Citation preview

Page 1: Nllgg - Nagios Cacti Snmp Traps

System/Network monitoring

SNMP Trap Translator

Page 2: Nllgg - Nagios Cacti Snmp Traps

Introductie

Welkom Voorstellen Doel van deze presentatie

Page 3: Nllgg - Nagios Cacti Snmp Traps

Waarom monitoring

Capaciteitsplanning Disk gebruik Netwerk belasting Geheugen gebruik Proces beheer Licenties

SLA rapportages

Status informatie Overschrijding

parameters Beschikbaarheid services Hardware failures Intrusion attempts

Page 4: Nllgg - Nagios Cacti Snmp Traps

Informatie bronnen

Systeem logging Utilities beschikbaar op het systeem

Raid status Temperatuur Ping

WMI (Windows Measurement Interface) SNMP (Simple Network Management Protocol)

Polling Traps

Page 5: Nllgg - Nagios Cacti Snmp Traps

Centraal monitoren

Alle informatie overzicht beschikbaar Checks worden geautomatiseerd uitgevoerd Eenvoudig om 'volcontinue' te monitoren Informatie beschikbaar over defecte hardware, gecrashte

service

Page 6: Nllgg - Nagios Cacti Snmp Traps

Open source tools voor eenCentraal Management Station

syslogd, rsyslogd, syslog-ng Remote ontvangst van log informatie verstuurd door nodes

snmpget, snmpwalk Commando's om remote SNMP servers te ondervragen

snmptrapd, snmptt Proces dat snmptraps van nodes ontvangt en daarna vertaalt naar

'leesbare' meldingen.

Page 7: Nllgg - Nagios Cacti Snmp Traps

Open source tools voor eenCentraal Management Station

nagios Service monitor die actief en passief de status van services

monitort, bewaakt en eventueel 'notifications' verstuurt. cacti

Periodieke poller die data verzameld in zgn. RRD files op basis waarvan historische overzichten en trends getoont worden

splunk Analyseert logfiles en maakt het eenvoudiger om oorzaken te

achterhalen

Page 8: Nllgg - Nagios Cacti Snmp Traps

Cacti

Page 9: Nllgg - Nagios Cacti Snmp Traps

cacti

Poller Vraagt iedere 5 minuten gegevens op via SNMP en/of scripts Bewaart data in RRD databases met een resolutie van 5 min, 30 min, 2

uur en 1 dag

Web interface Configuratie en beheer Toont grafieken op basis van de gegevens in de RRD database

Geen alarmering in geval van overschrijding drempelwaardes/uitval van services

Page 10: Nllgg - Nagios Cacti Snmp Traps

nagios

Page 11: Nllgg - Nagios Cacti Snmp Traps

nagios

Status monitor Actief, circulaire scheduler die via plugins status informatie opvraagt en

toont Passief, ontvangt externe informatie en geeft deze weer nagios begrijpt netwerk hierarchie Alarmerings functie in geval van uitval van nodes/services

Rapportage tool Beschikbaarheid van nodes/services SLA Houdt rekening met geplande downtime

Page 12: Nllgg - Nagios Cacti Snmp Traps

splunk

Page 13: Nllgg - Nagios Cacti Snmp Traps

splunk

Analyseert logfiles Presenteert informatie overzichtelijk Eenvoudige filtermogelijkheden Overzichtelijke weergave van events in de tijd Kan rapportages verzorgen

Page 14: Nllgg - Nagios Cacti Snmp Traps

nagiosadmin

Page 15: Nllgg - Nagios Cacti Snmp Traps

nagiosadmin

Webinterface om nagios te configureren Op basis van data in een database worden iedere keer nieuwe

nagios configuratie files gecreeerd Eenvoudig te bedienen Flexibel, staat toe nieuwe services toe te voegen

Page 16: Nllgg - Nagios Cacti Snmp Traps

nagtrap

Page 17: Nllgg - Nagios Cacti Snmp Traps

Het totaal plaatje

Node 1 Node 2 Node 3

cactipoller

scripts snmptrapd rsyslog

nagios

plugins

snmpttRRD

Logfiles

nagiosadmin

cactipoller

cactiweb

Trapsdb

nagios.cgi nagtrap splunk

cactidb

nagiosdb

Page 18: Nllgg - Nagios Cacti Snmp Traps

snmptrapd

May 7 12:45:01 spider snmptrapd[6109]: 2009-05-07 12:45:01 switch105 [UDP: [192.168.76.105]:161]:#012.1.3.6.1.2.1.1.3.0 = Timeticks: (320942996) 37 days, 3:30:29.96#011.1.3.6.1.6.3.1.1.4.1.0 = OID: .1.3.6.1.6.3.1.1.5.4#011.1.3.6.1.2.1.2.2.1.1.18 = INTEGER: 18#011.1.3.6.1.2.1.2.2.1.7.18 = INTEGER: up(1)#011.1.3.6.1.2.1.2.2.1.8.18 = INTEGER: up(1)

linkUp NOTIFICATION-TYPE OBJECTS { ifIndex, ifAdminStatus, ifOperStatus } STATUS current DESCRIPTION "A linkUp trap signifies that the SNMP entity, acting in an agent role, has detected that the ifOperStatus object for one of its communication links left the down state and transitioned into some other state (but not into the notPresent state). This other state is indicated by the included value of ifOperStatus." ::= { snmpTraps 4 }

Page 19: Nllgg - Nagios Cacti Snmp Traps

/etc/snmp/snmptrapd.conf

authCommunity log,execute,net community-string

traphandle default /usr/sbin/snmptthandler

Page 20: Nllgg - Nagios Cacti Snmp Traps

snmptt

Thu May 7 12:45:01 2009 IF-MIB::linkUp Normal "Status Events" switch105 - A linkUp trap signifies that the SNMP entity, acting in an 18 up up

EVENT linkUp .1.3.6.1.6.3.1.1.5.4 "Status Events" NormalFORMAT A linkUp trap signifies that the SNMP entity, acting in an $*SDESCA linkUp trap signifies that the SNMP entity, acting in an agent role, has detected that the ifOperStatus object for one of its communication links left the down state and transitioned into some other state (but not into thenotPresent state). This other state is indicated by the ncluded value of ifOperStatus.Variables: 1: ifIndex 2: ifAdminStatus 3: ifOperStatusEDESC

Page 21: Nllgg - Nagios Cacti Snmp Traps

/etc/snmp/snmptt.ini

# Configures how the OID of the received trap is handled when outputting to a log file /# database. It does NOT apply to the $O variable.# Set to 0 to use the default of numerical OID# Set to 1 to translate the trap OID to short text (symbolic form) (eg: linkUp)# Set to 2 to translate the trap OID to short text with module name (eg: IF-MIB::linkUp)# Set to 3 to translate the trap OID to long text (eg: iso...snmpTraps.linkUp)# Set to 4 to translate the trap OID to long text with module name (eg:# IF-MIB::iso...snmpTraps.linkUp)translate_log_trap_oid = 2

[TrapFiles]# A list of snmptt.conf files (this is NOT the snmptrapd.conf file). The COMPLETE path# and filename. Ex: '/etc/snmp/snmptt.conf'snmptt_conf_files = <<END/etc/snmp/snmptt-nagtrap.confEND

Page 22: Nllgg - Nagios Cacti Snmp Traps

/etc/snmp/snmptt-nagtrap.conf

outfile="snmptt-nagtrap.conf"# Remove existing filerm -f $outfile

# Convert the MIBS to something that snmptt can handlefor mibfile in /usr/share/snmp/mibs/* /usr/share/mibs/*/* /usr/local/share/mibs/*do /usr/sbin/snmpttconvertmib --in="$mibfile" --out="$outfile"done

# The converted file contains various words to describe the severity of# a trap.# We have to normalize them in such a way that nagtrap will understand them.sed -i -e '/^EVENT/s/SEVERE/CRITICAL/' \ -e '/^EVENT/s/MAJOR/CRITICAL/' \ -e '/^EVENT/s/MINOR/WARNING/' \ -e '/^EVENT/s/INFORMATIONAL/NORMAL/' \ $outfile

Page 23: Nllgg - Nagios Cacti Snmp Traps

/etc/nagios/commands.cfg

define command{ command_name check_snmptraps command_line $USER1$/check_snmp_traps -H $HOSTNAME$ }

Page 24: Nllgg - Nagios Cacti Snmp Traps

/usr/lib/nagios/plugins/check_snmp_trap

# Anzahl der Critical TrapsCOUNT_CRITICAL=`echo "select count(*) from snmptt where hostname like '%$HOST%' and severity = 'CRITICAL' and trapread = '0'" | mysql -s -u $MYSQL_USER --password=$MYSQL_PASS $MYSQL_DB`

if [ $COUNT_CRITICAL -gt 0 ] then echo "CRITICAL: $COUNT_CRITICAL Critical Traps for $HOST. $COUNT Traps in Database" exit $STATE_CRITICALelif [ $COUNT_WARNING -gt 0 ] then echo "WARNING: $COUNT_WARNING Warning Traps for $HOST. $COUNT Traps in Database" exit $STATE_WARNINGelse echo "OK: No Warning or Critical Traps for $HOST. $COUNT Traps in Database" exit $STATE_OKfi

Page 25: Nllgg - Nagios Cacti Snmp Traps

/usr/local/share/mibs/UCD-TRAP-TEST-MIB.txt

UCD-TRAP-TEST-MIB DEFINITIONS ::= BEGIN IMPORTS ucdExperimental FROM UCD-SNMP-MIB;

demotraps OBJECT IDENTIFIER ::= { ucdExperimental 990 }

demoTrap TRAP-TYPE ENTERPRISE demotraps VARIABLES { sysLocation } DESCRIPTION "An example of an SMIv1 trap" ::= 17

END

Page 26: Nllgg - Nagios Cacti Snmp Traps

test trap

snmptrap -v 1 -c communitystring hostname UCD-TRAP-TEST-MIB::demotraps "" 6 17 "" SNMPv2-MIB::sysLocation.0 s "Just here"

Page 27: Nllgg - Nagios Cacti Snmp Traps

Vragen?