Aula 009 de Gerenciamento de Redes - SNMP

27
Gerência e Desempenho De Redes Pillares Consulting 2015 – 01 Halexsandro de Freitas Sales [email protected] +55 81 8802 30 11 Aula 09 | Rev. 0.1 – Abr/2015 http://www.pillares.net

Transcript of Aula 009 de Gerenciamento de Redes - SNMP

Page 1: Aula 009 de Gerenciamento de Redes - SNMP

Gerência e DesempenhoDe Redes

Pillares Consulting2015 – 01

Halexsandro de Freitas [email protected]

+55 81 8802 30 11

Aula 09 | Rev. 0.1 – Abr/2015

http://www.pillares.net

Page 2: Aula 009 de Gerenciamento de Redes - SNMP

Gerência e Desempenho de Redes | Aula 09

Cronograma

Planejamento das Aulas

1 Gerenciamento de ativos de TI

Conteúdo:

● Apresentação do professor ● Apresentação dos alunos● Apresentação da ementa da disciplina● Conceitos de Gerenciamento de ICs● Documentação de Redes● Técnica de Gerenciamento de Problemas● GLPI

● Dump do banco de dados GLPI

2 Monitoramento de redes

● Desempenho e monitoramento de rede● Protocolos e ferramentas de

gerenciamento● SNMP e MIBs● NMSs, Zabbix● Estrategia de monitoramento de Ics● Apresentação da proposta do trabalho

● Entrega da proposta de trabalho

3 Desenvolver Trabalhos

● Desenvolvimento do trabalho● Apresentação do trabalho

● Trabalho individual a ser apresentado e entregue em data combinada

6 aulas – 24 horas 7 aulas – 28 horas 7 aulas – 28 horas

Metodologia para a Avaliação:

Carga Aula

Fase 1 Fase 2 Fase 3

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

Page 3: Aula 009 de Gerenciamento de Redes - SNMP

Gerência e Desempenho de Redes | Aula 09

Relembrando

Arquitetura Geral

Modelo Conceitual Básico de Gerenciamento de Rede

Coleta de dados: um processo que consiste de monitoração sobre os recursos gerenciados;

Diagnóstico: consiste no tratamento e análise realizados a partir dos dados coletados.

Ação ou controle: Uma vez diagnosticado um problema, torna-se necessário uma interação ou controle da anomalia.

Fonte: http://www.projetoderedes.com.br/artigos/artigo_gerenciamento_de_redes_de_computadores.php Acessado em Abril de 2015 ESTAÇÃO DE MONITORAMENTO

APLICAÇÕES

GERENTE

Dispositivo Gerenciável

AGENTE

Sistema de Monitoramento

Equipamento a ser monitorado

Consulta Resposta

Page 4: Aula 009 de Gerenciamento de Redes - SNMP

Gerência e Desempenho de Redes | Aula 09

AGENTESPROTOCOLOS

Relembrando

Arquitetura Geral

Definições

Sistema de Gerenciamento de Redes (NMS – Network Management System)

Trata-se de uma coleção de ferramentas de monitoração e controle que é integrado no sentido de possuir:

● Uma única interface de operação,● Uma quantidade mínima de equipamentos separados. Ou seja, os recursos necessários para a monitoria e

controle são distribuídos também entre os itens a serem monitorados.

fonte:http://www.di.ufpe.br/~flash/ais98/gerrede/gerrede.htmlAcessado em Abril de 2015

Dispositivos Gerenciáveis

ESTAÇÃO DE MONITORAMENTO

APLICAÇÕES

GERENTE

Sistema de Monitoramento

Equipamentos monitorados

Consulta Resposta

Page 5: Aula 009 de Gerenciamento de Redes - SNMP

Gerência e Desempenho de Redes | Aula 09

Introdução ao Gerenciamento de Rede

Protocolos de Monitoramento de Redes

Método de Trabalho do Protocolo SNMP

Gerente AgenteRequisição SNMP:UDP:161

Resposta SNMP:UDP:161

Trap SNMP:UDP:162

MIBs

Page 6: Aula 009 de Gerenciamento de Redes - SNMP

Gerência e Desempenho de Redes | Aula 09

Relembrando

SNMP

Notas importantes

● O SNMP trabalha na porta 161, UDP● Para consultar um Agente SNMP, é necessário que o Gerente a enxergue.

Dados de nossa rede10.10.224.0/255.255.248.0

IP Servidor10.10.224.195

IP Switch10.10.224.222

Switch Communitycisco

Consulta SNMPsnmpget -v 2c -c <$COMMUNITY> <$IP_AGENTE> <$OID>

Page 7: Aula 009 de Gerenciamento de Redes - SNMP

Gerência e Desempenho de Redes | Aula 09

Explorando as OIDs via SNMP

Protocolos de Monitoramento de Redes

Estrutura de OIDs da MIB-2 1.3.6.1.2.1→ iso(1)

org(3)

dod(6)

internet(1)

mgmt(2)mib-2(1)

system(1)

interfaces(2)

at(3)

ip(4)

icmp(5)

tcp(6)

udp(7)

egp(8)

snmp(11)

Descrições doSistema

InformaçõesDas interfaces private(4)

enterprises(1)

GNU/Linux(2021)cisco(9)

IBM(2)

Page 8: Aula 009 de Gerenciamento de Redes - SNMP

Gerência e Desempenho de Redes | Aula 09

Explorando as OIDs via SNMP

Protocolos de Monitoramento de Redes

Estrutura de OIDs da MIB-2 (system)

mib-2(1.3.6.1.2.1)

system(1.3.6.1.2.1.1)

interfaces(1.3.6.1.2.1.2)

SysDescr(1)

SysObjectID(2)

SysUpTime(3)

SysContact(4)

SysName(5)

SysLocation(6)

SysServices(7)

SysORLastChange(8)

SysORTable(9)

SysDescr = 1.3.6.1.2.1.1.1.0

Link para pesquisa de outras OIDs Cisco:http://tools.cisco.com/Support/SNMP/do/BrowseOID.do?local=en&translate=Translate&objectInput=1.3.6.1.4.1.9Link para pesquisa de OIDs Padrão:http://www.alvestrand.no/objectid/

Referência do Objeto

Page 9: Aula 009 de Gerenciamento de Redes - SNMP

Gerência e Desempenho de Redes | Aula 09

Explorando as OIDs via SNMP

Protocolos de Monitoramento de Redes

Estrutura de OIDs da MIB-2 (system)

mib-2(1.3.6.1.2.1)

interfaces(1.3.6.1.2.1.2)

system(1.3.6.1.2.1.1)

ifNumber(1)

ifTable(2)

Link para auxílio à consultas diversas:http://pillares.net/mapaoids/

ifEntry(1.3.6.1.2.1.2.2.1)

(1)

(2)

(3)

(4)

(5)

(6)

(7)

(8)

(...)

(21)

(22)

Page 10: Aula 009 de Gerenciamento de Redes - SNMP

Gerência e Desempenho de Redes | Aula 09

Explorando as OIDs

ifNumber – 1.3.6.1.2.1.2.1

Specific Object Information

Object ifNumberOID 1.3.6.1.2.1.2.1Type Integer32Permission read-onlySYNTAX Integer32 (1..2147483647)

Description

"The number of network interfaces (regardless of their current state) present on this system."

Page 11: Aula 009 de Gerenciamento de Redes - SNMP

Gerência e Desempenho de Redes | Aula 09

Explorando as OIDs

ifNumber - 1.3.6.1.2.1.2.1

Retornará a quantidade de interfaces presentes no sistema:

snmpget -v 2c -c <community> <IP_AGENTE> 1.3.6.1.2.1.2.1.0

NOTA: as interfaces virtuais também contam.

Page 12: Aula 009 de Gerenciamento de Redes - SNMP

Gerência e Desempenho de Redes | Aula 09

Entendendo o ID das Interfaces do Switch Cisco 2960 24 Portas + 2 Gbps

Como funciona a numeração das interfaces?

As interfaces são enumeradas de 1 a 10102 neste modelo.● De 1 a 4094 Reservadas para Vlans→● De 10001 a 10024 Interfaces FastEthernet→● De 10101 a 10102 Interfaces Gigabit→

Interfaces FastEthernet1.3.6.1.2.1.2.2.1.2.10001

a1.3.6.1.2.1.2.2.1.2.10024

Interfaces GigabitEthernet1.3.6.1.2.1.2.2.1.2.10101

a1.3.6.1.2.1.2.2.1.2.10102

Page 13: Aula 009 de Gerenciamento de Redes - SNMP

Gerência e Desempenho de Redes | Aula 09

Explorando as OIDs via SNMP

Protocolos de Monitoramento de Redes

ifIndex(1)

ifDescr(2)

ifType(3)

ifMtu(4)

ifSpeed(5)

ifPhysAddress(6)

ifAdminStatus(7)

ifOperStatus(8)

ifLastChange(9)

ifInOctets(10)

ifEntry(1.3.6.1.2.1.2.2.1)

ifInUcastPkts(11)

ifInNUcastPkts(12)

ifInDiscards(13)

ifInErrors(14)

ifInUnknownProtos(15)

ifOutOctets(16)

ifOutUcastPkts(17)

ifOutNUcastPkts(18)

ifOutDiscards(19)

ifOutErrors(20)

ifOutQLen(21)

ifSpecific(22)

ifTable

Page 14: Aula 009 de Gerenciamento de Redes - SNMP

Gerência e Desempenho de Redes | Aula 09

Explorando as OIDs

ifIndex - 1.3.6.1.2.1.2.2.1.1

Specific Object Information

Object ifIndexOID 1.3.6.1.2.1.2.2.1.1Type InterfaceIndexPermission read-onlySYNTAX Integer32 (1..2147483647)

Description

"A unique value, greater than zero, for each interface. It is recommended that values are assigned contiguously starting from 1. The value for each interface sub-layer must remain constant at least from one re-initialization of the entity's network management system to the next reinitialization."

Page 15: Aula 009 de Gerenciamento de Redes - SNMP

Gerência e Desempenho de Redes | Aula 09

Explorando as OIDs

ifIndex - 1.3.6.1.2.1.2.2.1.1

Retornará o ID de todas as interfaces existentes no sistema com seus respectivos IDs:

snmpwalk -v 2c -c <community> <IP_AGENTE> 1.3.6.1.2.1.2.2.1.1 Retorna apenas a ID da porta FastEthernet 0/1 (no cisco 2960)

snmpget -v 2c -c <community> <IP_AGENTE> 1.3.6.1.2.1.2.2.1.1.10001

Page 16: Aula 009 de Gerenciamento de Redes - SNMP

Gerência e Desempenho de Redes | Aula 09

Explorando as OIDs

ifDescr – 1.3.6.1.2.1.2.2.1.2

Specific Object Information

Object ifDescrOID 1.3.6.1.2.1.2.2.1.2.$NType InterfaceIndexPermission read-onlySYNTAX Integer32 (1..2147483647)

Description

"A unique value, greater than zero, for each interface. It is recommended that values are assigned contiguously starting from 1. The value for each interface sub-layer must remain constant at least from one re-initialization of the entity's network management system to the next reinitialization."

Page 17: Aula 009 de Gerenciamento de Redes - SNMP

Gerência e Desempenho de Redes | Aula 09

Explorando as OIDs

ifDescr - 1.3.6.1.2.1.2.2.1.2

Retornará a descrição de todas as interfaces existentes no sistema:

snmpwalk -v 2c -c <community> <IP_AGENTE> 1.3.6.1.2.1.2.2.1.2 Retorna apenas a descrição da porta FastEthernet 0/1 (no cisco 2960)

snmpget -v 2c -c <community> <IP_AGENTE> 1.3.6.1.2.1.2.2.1.1.10001

Page 18: Aula 009 de Gerenciamento de Redes - SNMP

Gerência e Desempenho de Redes | Aula 09

Explorando as OIDs

ifType - 1.3.6.1.2.1.2.2.1.3

Specific Object Information

Type IANAifType (234 tipos diferentes)

Description

"The type of interface. Additional values for ifType are assigned by the Internet Assigned Numbers Authority (IANA),through updating the syntax of the IANAifType textual aconvention."

NOTA: O retorno se dá em número inteiro. Uma tabela completa pode ser obtida AQUI.

6 Ethernet→53 Virtual→1 Outro (não reconhecido)→

Page 19: Aula 009 de Gerenciamento de Redes - SNMP

Gerência e Desempenho de Redes | Aula 09

Explorando as OIDs

ifSpeed – 1.3.6.1.2.1.2.2.1.5

Specific Object Information

Type Gauge32

Description

"An estimate of the interface's current bandwidth in bits per second. For interfaces which do not vary in bandwidth or for those where no accurate estimation can be made, this object should contain the nominal bandwidth. If the bandwidth of the interface is greater than the maximum value reportable by this object then this object should report its maximum value (4,294,967,295) and ifHighSpeed must be used to report the interace's speed. For a sub-layer which has no concept of bandwidth, this object should be zero."

Fast 0/1 snmpget -v 2c -c cisco 10.10.224.222 1.3.6.1.2.1.2.2.1.5.10001→Gig 0/1 snmpget -v 2c -c cisco 10.10.224.222 1.3.6.1.2.1.2.2.1.5.10101→

Page 20: Aula 009 de Gerenciamento de Redes - SNMP

Gerência e Desempenho de Redes | Aula 09

Explorando as OIDs

ifPhysAddress – 1.3.6.1.2.1.2.2.1.6

Specific Object Information

Type PhysAddress

Description

"The interface's address at its protocol sub-layer. For example, for an 802.x interface, this object normally contains a MAC address. The interface's media-specific MIB must define the bit and byte ordering and the format of the value of this object. For interfaces which do not have such an address (e.g., a serial line), this object should contain an octet string of zero length."

Page 21: Aula 009 de Gerenciamento de Redes - SNMP

Gerência e Desempenho de Redes | Aula 09

Explorando as OIDs

ifAdminStatus – 1.3.6.1.2.1.2.2.1.7

Specific Object Information

Type Integer

Description

"The desired state of the interface. The testing(3) state indicates that no operational packets can be passed. When a managed system initializes, all interfaces start with ifAdminStatus in the down(2) state. As a result of either explicit management action or per configuration information retained by the managed system, ifAdminStatus is then changed to either the up(1) or testing(3) states (or remains in the down(2) state)."

Descubra quais as interfaces do Switch estão em Shutdown!

Page 22: Aula 009 de Gerenciamento de Redes - SNMP

Gerência e Desempenho de Redes | Aula 09

Explorando as OIDs

ifOperStatus – 1.3.6.1.2.1.2.2.1.8

Specific Object Information

Type Integer

Description

"The current operational state of the interface. The testing(3) state indicates that no operational packets can be passed. If ifAdminStatus is down(2) then ifOperStatus should be down(2). If ifAdminStatus is changed to up(1)then ifOperStatus should change to up(1) if the interface is ready to transmit and receive network traffic; it should change to dormant(5) if the interface is waiting for external actions (such as a serial line waiting for an incoming connection); it should remain in the down(2) state if and only if there is a fault that prevents it from going to the up(1) state; it should remain in the notPresent(6) state if the interface has missing (typically, hardware) components."

Page 23: Aula 009 de Gerenciamento de Redes - SNMP

Gerência e Desempenho de Redes | Aula 09

Explorando as OIDs

ifInOctets – 1.3.6.1.2.1.2.2.1.10

Specific Object Information

Type Counter32

Description

"The total number of octets received on the interface, including framing characters.Discontinuities in the value of this counter can occur at re-initialization of the management system, and at other times as indicated by the value of ifCounterDiscontinuityTime."

Page 24: Aula 009 de Gerenciamento de Redes - SNMP

Gerência e Desempenho de Redes | Aula 09

Explorando as OIDs

ifOutOctets – 1.3.6.1.2.1.2.2.1.16

Specific Object Information

Type Counter32

Description

"The total number of octets transmitted out of the interface, including framing characters. Discontinuities in the value of this counter can occur at re-initialization of the management system, and at other times as indicated by the value ofifCounterDiscontinuityTime."

Page 25: Aula 009 de Gerenciamento de Redes - SNMP

Gerência e Desempenho de Redes | Aula 09

Para Estudar Mais!

Link interessante

Site da Cisco para pesquisar OIDs

http://tools.cisco.com/Support/SNMP/do/BrowseOID.do

Descubra como monitorar a CPU e memória do Switch que estamos utilizando.

Page 26: Aula 009 de Gerenciamento de Redes - SNMP

Gerência e Desempenho de Redes | Aula 09

Explorando as OIDs

ifOutOctets – 1.3.6.1.2.1.2.2.1.16

Specific Object Information

Type Counter32

Description

"The total number of octets transmitted out of the interface, including framing characters. Discontinuities in the value of this counter can occur at re-initialization of the management system, and at other times as indicated by the value ofifCounterDiscontinuityTime."

Page 27: Aula 009 de Gerenciamento de Redes - SNMP

Obrigado!

[email protected]

Dúvidas?

Próxima aula → Aula 09● Protocolo SNMP● MIBs● Introdução a NMS

Aula 09 → Nós vimos● Comandos SNMP● Coleta de informações de um Switch