FreeSWITCH Monitoring

48
FreeSWITCH Monitoring ClueCon, August 2016 Moisés Silva <[email protected] > Manager, So?ware Engineering

Transcript of FreeSWITCH Monitoring

Page 1: FreeSWITCH Monitoring

FreeSWITCHMonitoringClueCon,August2016

MoisésSilva<[email protected]>Manager,So?wareEngineering

Page 2: FreeSWITCH Monitoring

We’reHiring

•  LinuxdevelopersC/C++orPython

•  Anywhereintheworld,paidrelocaJontoTorontoorfullJmeremoteopportuniJes

•  Funandrelaxedworkenvironment

2

SangomaTechnologies-©2016

Page 3: FreeSWITCH Monitoring

Agenda

•  MonitoringBasics

•  MetricsandLogs

•  AlerJng

•  TradiJonalSoluJons•  EmergingSoluJons

•  A?erword(FreeSWITCHOxidized)

3

SangomaTechnologies-©2016

Page 4: FreeSWITCH Monitoring

MonitoringBasics

•  Monitoringisaboutknowingwhatishappeningonyoursystems.Thegoodandthebad

•  MonitoringhelpsyouwithpredicJon/forecasJng.PlanyourfuturegrowthandanJcipateproblems

•  Monitoringprovidesyouwiththedatayouneedtotroubleshootproblemsfaster

4

SangomaTechnologies-©2016

Page 5: FreeSWITCH Monitoring

TypesofMonitoring

•  ApplicaJonMetricMonitoring•  NumbersaboutapplicaJonusage&performance•  Youcanthenusethosenumberstodefinealerts

•  ServiceStatusMonitoring•  Simplebinarychecks.It’stheserviceupornot

5

SangomaTechnologies-©2016

Page 6: FreeSWITCH Monitoring

MonitoringModels

•  PushvsPullsystems•  Push:Graphite,StatsD,CollectD,SNMP•  Pull:Prometheus,SNMP

•  DetermineswhoiniJatesthemetrictransfer

•  Pushsystemsaremoredynamicandtendtorequirelessmaintenance

•  Pullsystemsrequireasourceoftruthandnodediscovery

•  PullinghoweverallowsyoutomoreeffecJvelydetectifanodeorapplicaJonisdown

6

SangomaTechnologies-©2016

Page 7: FreeSWITCH Monitoring

PushMonitoring

7

SangomaTechnologies-©2016

MonitoringServer

Node1

Node2

Node3

MetricsandCheckResults

Page 8: FreeSWITCH Monitoring

PullMonitoring

8

SangomaTechnologies-©2016

MonitoringServer

Node1

Node2

Node3

MetricandCheckRequests

Page 9: FreeSWITCH Monitoring

Metrics

•  Timeseriesdata.SequenceofnumericaldatapointslistedinJmeorder,usuallysampledatregularintervals.

•  DifferentgranulariJesofdatastoredandaggregatedoverJmeonfixed-sizestorage

•  Timeseriesanalysisoverthedataresultsinfancygraphs

•  Exampledatabases:RRDTool,Graphite(Whisper),InfluxDB,Prometheus

9

SangomaTechnologies-©2016

Page 10: FreeSWITCH Monitoring

FreeSWITCHMetrics

•  AcJveCalls

•  TotalCalls

•  FailedCalls

•  RegistraJons

•  FailedRegistraJons

10

SangomaTechnologies-©2016

Page 11: FreeSWITCH Monitoring

FreeSWITCHMetrics

•  ASR(Answer/SeizureRaJo)

•  NER(NetworkEffecJvenessRaJo)

•  ACD(AverageCallDuraJon)

•  PDD(PostDialDelay)

11

SangomaTechnologies-©2016

Page 12: FreeSWITCH Monitoring

Logs

•  Logscanbeasourceofmetricswhenmetricsandservicechecksarenotenough

•  Youmaywanttosendalertsbasedonlogpagernsandrepeatedlogerrors

•  ELKStack•  ElasJcSearch•  Logstash•  Kabana

12

SangomaTechnologies-©2016

Page 13: FreeSWITCH Monitoring

AlerMng

•  Email,Chat(Slack/HipChat),SMS,etc

•  Alertbasedonexpectedmetricsandcheckfailures

•  ProcuretousepercenJlesinsteadofaverages

•  SeveralalternaJves:Prometheus,Alerta,Flapjack

13

SangomaTechnologies-©2016

Page 14: FreeSWITCH Monitoring

AlertFaMgue

14

SangomaTechnologies-©2016

•  Thishappenswhenalertsaretriggeredtooo?enandcausesthereceivertobedesensiJzed

Page 15: FreeSWITCH Monitoring

AlertFaMgue

•  Youknowyouhaveitwhenyoustartignoringalerts

•  Ignoringalertsleadstomissingrealproblemsortakingtoolongtorespondtothem

15

SangomaTechnologies-©2016

Page 16: FreeSWITCH Monitoring

AlertFaMgue

•  WarningsmightbewellintendedandinisolaJonworkwell,however,whentheyaddup,theymaycausemoreharmthangood

•  Adjustyourthresholds.BecauJouswithwarningvscriJcalseverityandadjustyournoJficaJonsaccordingly

•  Killorfixalertsthatarefiringtooo?en.YouneedawaytoeasilymutetheminthemeanJme

16

SangomaTechnologies-©2016

Page 17: FreeSWITCH Monitoring

•  They’reallaboutgejngthejobdone.Andtheydo:

•  Butatsomepointyougogaaskyourselfifthere’sabegerway...

TradiMonalSoluMons

17

SangomaTechnologies-©2016

Page 18: FreeSWITCH Monitoring

SNMP

18

SangomaTechnologies-©2016

Page 19: FreeSWITCH Monitoring

SNMP

•  MIBs/OIDsarecumbersometouse(tosaytheleast)•  OIDsavailableinFreeSWITCHgiveyounumberofsessions,acJvecalls,sessionspersecondetc.

•  Noteasytocollectcustommetrics

•  VerylimitedinformaJonexposedbymod_snmpandoverallseemskindofabandoned

•  Themonitoring/managementinterfaceinFreeSWITCHneedssomework

19

SangomaTechnologies-©2016

Page 20: FreeSWITCH Monitoring

CACTI&RRDtool

•  WebfrontendfortheRRDtoolJme-seriesdatabase

•  CollectmetricsfrommulJplesources(e.gsnmp)

•  Noonecaneverrememberhowtoaddaserver(convolutedprocess)

20

SangomaTechnologies-©2016

Page 21: FreeSWITCH Monitoring

CACTI&RRDtool

21

SangomaTechnologies-©2016

•  Youendupwithuglygraphslikethis:

It’sbegerthannothingthough….

Page 22: FreeSWITCH Monitoring

MonitoringSucks

22

SangomaTechnologies-©2016

•  Somuchthataround2011a“MonitoringSucks”communitywassettofixit:

•  hgps://github.com/monitoringsucks

•  hgps://github.com/monitoringsucks/blog-posts

•  hgps://vimeo.com/monitorama

Page 23: FreeSWITCH Monitoring

NewSoluMons

23

SangomaTechnologies-©2016

•  Becausenewisalwaysbeger…

Page 24: FreeSWITCH Monitoring

Sensu

•  Monitoringthatdoesn’tsuck(theirmogo)

•  Youcanreusenagios/zabbixchecks.SensuwasdesignedasareplacementforagingNagiosinstallaJons

•  NoJme-seriesdatabaseincluded,youhaveseveralopJonsavailable(e.gGraphite,InfluxDB)

24

SangomaTechnologies-©2016

Page 25: FreeSWITCH Monitoring

Sensu

•  Pull/Pushsystemwithanagent

•  Pub/Submodelwithpluggabletransports(RabbitMQ,Redis,AmazonSQS)

•  Nodessubscribetogroupsofchecks.Thechecksarescheduledbytheserverorthenode.

•  Bothserviceandmetriccheckssupported

•  CheckresultscanbesentasynchronouslybyexternaljobsviarawTCP+JSON(supportinagithubPRforHTTP)

25

SangomaTechnologies-©2016

Page 26: FreeSWITCH Monitoring

Sensu

•  HTTPAPItoreadaccessnodes,checks,silencealarms,etc

•  NiceandsimpledashboardUI

•  Dynamicinfrastructure.Serversaddthemselvestothemonitoringsystem.

•  ComposablejsonconfiguraJonforeasyautomaJon(e.gAnsible,SaltStack,Chefetc)

26

SangomaTechnologies-©2016

Page 27: FreeSWITCH Monitoring

Sensu

27

SangomaTechnologies-©2016

Source:sensuapp.org

Page 28: FreeSWITCH Monitoring

Graphite

•  Time-seriesstoragesystem

•  WhisperdatabaseformatdesignedasanimprovementoverRRDtooltomanageoutofJmedatapoints

•  Carbon-cacheisadaemonlisteningformetricsonaTCPsocket(typicallyusedintandemwithStatsD)

•  Metricsarestoredinfixed-sizefiles

•  Comeswitha(quiteoutdated)UIformetricgraphs.Thisismosto?enusedasanhgpendpointbyothergraphingtoolslikeGrafana

28

SangomaTechnologies-©2016

Page 29: FreeSWITCH Monitoring

Graphite

•  EveryJmeseriesisidenJfiedbyahierarchyofdot-separatedidenJfiers(e.gstats.freeswitch.total_calls)

•  Thetextformattosendstatstographiteisdeadsimple:<metricname><value><Jmestamp>•  stats.freeswitch.total_calls501470843323

•  Nofurtherdimensionscanbeencoded.Thetypicalwork-aroundistoencodetheminthemetricname:•  stats.freeswitch.profile.internal.total_calls20

1470843323

29

SangomaTechnologies-©2016

Page 30: FreeSWITCH Monitoring

Graphite

30

SangomaTechnologies-©2016

Source:hgp://www.aosabook.org/en/graphite.html

Page 31: FreeSWITCH Monitoring

Prometheus

•  NewJme-seriesmonitoringsystemwithbuilt-inalerJng

•  IncludesitsownJme-seriesdatabaseformat

•  MulJ-dimensionaldatamodel(fancytermforkey/valuepairslabelsagachedtotheJme-seriesmetrics)

•  HTTP-basedpullmodel(PrometheusscrapsnodesformetricsviaHTTP)

•  PushgatewayssupportedforapplicaJonswithoutanaJveHTTPendpoint

31

SangomaTechnologies-©2016

Page 32: FreeSWITCH Monitoring

Prometheus

•  ClientlibrariesavailableformanylanguagessoyoucaninstrumentyourapplicaJons

•  Flexiblequerylanguage(thinkSQLforforJme-series)

•  Commandlinequeryingtool

•  Built-inalerJng

•  CanbefederatedforaggregaJonofdatainmulJpledatacenters

32

SangomaTechnologies-©2016

Page 33: FreeSWITCH Monitoring

Prometheus

•  GostandaloneapplicaJon(nodependencies)

•  Allmetricsstored,nolossofgranularity

•  Similarformattographite,withtheaddeddimensions:•  freeswitch_total_calls{profile=internal}20

1470843323

33

SangomaTechnologies-©2016

Page 34: FreeSWITCH Monitoring

Prometheus

34

SangomaTechnologies-©2016

Page 35: FreeSWITCH Monitoring

GraphingwithGrafana

•  PowerfuldashboardbuilderapplicaJon

•  Supportformanybackenddatabases(Prometheus,Graphite)

•  AutomatecreaJonofdashboardswiththeirHTTPAPIandJSONdashboarddefiniJonformat

•  RichgraphingcustomizaJons,styling,accesscontrol,etc

35

SangomaTechnologies-©2016

Page 36: FreeSWITCH Monitoring

GraphingwithGrafana

36

SangomaTechnologies-©2016

Page 37: FreeSWITCH Monitoring

GraphingwithGrafana

37

SangomaTechnologies-©2016

Page 38: FreeSWITCH Monitoring

mod_prometheus

•  NaJvePrometheusFreeSWITCHintegraJonmodulewrigeninRust

•  Earlydevelopment(startedjustafewdaysago)butalreadyprovidesusefulmetricsoutofthebox,readytobescrappedbyPrometheus

•  MetricslikeCalls,Failedcalls,RegistraJons,CPS,ASR,etc

•  YoucanthenusePrometheusAlertmanagertocreatealerttriggerrulesbasedonthosemetrics

•  hgps://github.com/moises-silva/mod_prometheus

38

SangomaTechnologies-©2016

Page 39: FreeSWITCH Monitoring

mod_prometheus

•  InstallingrequiresRustandCargo(theRustpackage/buildtoolandFreeSWITCHmaster)

#gitclonehgps://github.com/moises-silva/mod_prometheus#cdmod_prometheus#cargobuild#cptarget/debug/libmod_prometheus.so/usr/local/freeswitch/mod(Donotagempttorenamethemoduletomod_prometheus,itwon’twork)

39

SangomaTechnologies-©2016

Page 40: FreeSWITCH Monitoring

mod_prometheus

•  Thenjustloadit

40

SangomaTechnologies-©2016

Page 41: FreeSWITCH Monitoring

mod_prometheus

•  Testwithcurl

41

SangomaTechnologies-©2016

Page 42: FreeSWITCH Monitoring

mod_prometheus

•  Usecustomcountersandgaugesfromthedialplan

42

SangomaTechnologies-©2016

Page 43: FreeSWITCH Monitoring

mod_prometheus

•  NextPrometheusscrapwillgetthosemetrics

43

SangomaTechnologies-©2016

Page 44: FreeSWITCH Monitoring

FinalThoughts

•  ApplicaJoninstrumentaJonmustbepartofapplicaJondevelopment

•  Monitoringtoolsofallkindsareavailable.Noexcusesforlackofmonitoring

•  Monitorallthethings!

44

SangomaTechnologies-©2016

Page 45: FreeSWITCH Monitoring

AUerword

•  BringingRusttoFreeSWITCH.Themod_prometheusmoduleisthefirstRustmodulecomingintoFreeSWITCH

•  RustisanewsystemsprogramminglanguagewithinthesamespeedrangeasC/C++butwithmemorysafetyguaranteesusinganownershipsystemandmovesemanJcsbydefault

•  RustbindingsareavailablebythefreeswitchrsprojectcreatedbyMichaelGiagnocavo:hgps://gitlab.com/wiresight/freeswitchrs/

•  RustmemorysafetycouldmakeforaninteresJngaddiJontothestabilityofFreeSWITCH.Ifyou’rewriJngmodulespleaseconsiderusingRust

45

SangomaTechnologies-©2016

Page 46: FreeSWITCH Monitoring

QUESTIONS

Page 47: FreeSWITCH Monitoring

ContactUs

•  SangomaTechnologies100RenfrewDrive,Suite100Markham,OntarioL3R9R6Canada

•  Websitehgp://www.sangoma.com/

•  Telephone+19054741990x2(forSales)

•  [email protected]

SangomaTechnologies-©2016

47

Page 48: FreeSWITCH Monitoring

THANKYOU