25
Looking Under The Covers Using SNMP to peek inside Erlang

Looking under the covers: Using SNMP to peek inside Erlang

Embed Size (px)

DESCRIPTION

Slides of the talk I gave at the Erlang meetup on the 20th of April 2010.

Citation preview

Page 1: Looking under the covers: Using SNMP to peek inside Erlang

LookingUnder The Covers

Using SNMP to peek inside Erlang

Page 2: Looking under the covers: Using SNMP to peek inside Erlang

About me

More stickers than a 40 years old RV!

Page 3: Looking under the covers: Using SNMP to peek inside Erlang

About us

Developing a platform for a new breed of social networking gamesScalability is a must Back-end developed with Erlang/OTP

And lots of other good stuffFront-end developed with Flex 4

Page 4: Looking under the covers: Using SNMP to peek inside Erlang

We

Monitoring

Page 5: Looking under the covers: Using SNMP to peek inside Erlang

The Expected

Monitoring the Erlang VM

Page 6: Looking under the covers: Using SNMP to peek inside Erlang

The Fun Stuff

Monitoring your applications' guts

Page 7: Looking under the covers: Using SNMP to peek inside Erlang

Agenda

SNMP 101SNMP & Erlang

Agent configurationFixed and dynamic custom objectsStandard VM / OTP objects

Page 8: Looking under the covers: Using SNMP to peek inside Erlang

SNMP 101

Simple Network Management ProtocolIntroduced in 1988Control & MonitoringAnything with an IP addressUsually over UDP port 161v2 is current, v3 is draft

Page 9: Looking under the covers: Using SNMP to peek inside Erlang

SNMP 101, cont.

Page 10: Looking under the covers: Using SNMP to peek inside Erlang

SNMP 101, end

SNMP world is a treeWith OIDsAll our Internetare belong to DODYou are 1.3.6.1.4.1.*

Page 11: Looking under the covers: Using SNMP to peek inside Erlang

SNMP 101, end

Management Information Base (MIB)Define what objects are handled by the agent"Interesting" syntax

nodeName OBJECT-TYPE SYNTAX DisplayString MAX-ACCESS read-only STATUS current DESCRIPTION "Erlang node name" ::= { staticOid 1 }

Page 12: Looking under the covers: Using SNMP to peek inside Erlang

SNMP & Erlang

Full SNMP support:

Manager, agent, traps, queries, security...Quickstart:

http://www.trapexit.org/SNMP_Quick_Start

Quicksand:[3,6,1,4,1,193,19]}. % {ericsson otp}

Page 13: Looking under the covers: Using SNMP to peek inside Erlang

Erlang SNMP Agent

Page 14: Looking under the covers: Using SNMP to peek inside Erlang

Getting started: Configuration

Add all the agent boiler plate configurationCreate a custom MIB

Consider getting a Private Enterprise NumberCompile .mib to .binCompile .bin to .hrl (optional)

OIDs, default values, ranges

Page 15: Looking under the covers: Using SNMP to peek inside Erlang

Getting started: Code

application:start(snmp)

snmpa:load_mibs(snmp_master_agent, ["snmp/MY-MIB"])

...

snmp_generic:variable_set(objectName, objectValue)

Page 16: Looking under the covers: Using SNMP to peek inside Erlang

Getting started: Tools

Command linesnmpwalksnmpget

UItkmib

MonitoringZabbix, Zenoss, Nagios...

GraphingCacti...

Page 17: Looking under the covers: Using SNMP to peek inside Erlang

Lab Time!

Monitor:nodeNameDisplayString

gaugeValueGauge32

Page 18: Looking under the covers: Using SNMP to peek inside Erlang

Creating Dynamic Objects

Use tables when OID is not fixedIndexed rows

Dynamic OID composed of ASCII codes

1.3.6.1.4.1.35458.3.70.111.111.1

==

MyOID.Foo.1

Page 19: Looking under the covers: Using SNMP to peek inside Erlang

SNMP Table: Code

SnmpRow = {Data1, Data2, ..., DataN}

snmpa_local_db:table_create_row( tableName, Index, SnmpRow)

Index being one of Data...Don't forget the .funcs configuration

Page 20: Looking under the covers: Using SNMP to peek inside Erlang

Lab Time!

Monitor FS usage:/ 74%/dev 1%/var/run 1%

Page 21: Looking under the covers: Using SNMP to peek inside Erlang

Standard Erlang SNMP

OTPSingle agentTable of all nodes in a clusterGeneral info & stats

OSMONLocal nodeDetailed stats

Good luck to find these MIBs :)

Page 22: Looking under the covers: Using SNMP to peek inside Erlang

Lab Time!

Monitor Erlang VM:erlNode*OTP-MIB

load*OTP-OS-MON-MIB

Page 23: Looking under the covers: Using SNMP to peek inside Erlang

Moar Infoz!

Page 24: Looking under the covers: Using SNMP to peek inside Erlang

Thank you!

Raffle courtesy of

Page 25: Looking under the covers: Using SNMP to peek inside Erlang

Source codehttp://www.dossot.net/misc/files/erlang-snmp.tar.gz