37
Keep an eye on your PostgreSQL clusters Open PostgreSQL Monitoring & PostgreSQL Workload Analyzer Julien Rouhaud Dalibo - www.dalibo.org pgconf.ru 2015 - February, 6th [ 1 / 37 ]

[pgconf.ru 2015] OPM and PoWA: Keep an eye on your PostgreSQL clusters

  • Upload
    rjuju

  • View
    344

  • Download
    4

Embed Size (px)

Citation preview

Page 1: [pgconf.ru 2015] OPM and PoWA: Keep an eye on your PostgreSQL clusters

Keep an eye on yourPostgreSQL clusters

Open PostgreSQL Monitoring & PostgreSQLWorkload Analyzer

Julien Rouhaud

Dalibo - www.dalibo.org

pgconf.ru 2015 - February, 6th

[ 1 / 37 ]

Page 2: [pgconf.ru 2015] OPM and PoWA: Keep an eye on your PostgreSQL clusters

Monitoring?

I Service availabilityI Service, host, network...I Alerting

I Service performanceI GraphingI TrendingI Analysis

I At what cost ?I Open source projects

[ 2 / 37 ]

Page 3: [pgconf.ru 2015] OPM and PoWA: Keep an eye on your PostgreSQL clusters

What already exists

I Different kind of toolsI Command line tools / datasourcesI Generic solutions with probesI Dedicated solutions

[ 3 / 37 ]

Page 4: [pgconf.ru 2015] OPM and PoWA: Keep an eye on your PostgreSQL clusters

Command lineAnd data sources

I Nice featuresI But more useful for emergency situationsI Or need some external tool for best usage

[ 4 / 37 ]

Page 5: [pgconf.ru 2015] OPM and PoWA: Keep an eye on your PostgreSQL clusters

Command lineSome examples

I command lineI pg_viewI pg_activityI pgstats

I Data sourceI all pg_stat* catalogI pg_stat_statements, pg_stat_plansI pg_proctab

[ 5 / 37 ]

Page 6: [pgconf.ru 2015] OPM and PoWA: Keep an eye on your PostgreSQL clusters

Probe

I Gather informations for another toolI Can sometimes be used in standaloneI Some examples

I check_postgresI pg_monz

[ 6 / 37 ]

Page 7: [pgconf.ru 2015] OPM and PoWA: Keep an eye on your PostgreSQL clusters

Dedicated solution

I Complete for its purposeI More pertinentI But not numerous

[ 7 / 37 ]

Page 8: [pgconf.ru 2015] OPM and PoWA: Keep an eye on your PostgreSQL clusters

OPM and PoWA?

I OPMI aim to be a dedicated solutionI relies on existing or new probes and components

I PoWAI Dedicated performance solution

[ 8 / 37 ]

Page 9: [pgconf.ru 2015] OPM and PoWA: Keep an eye on your PostgreSQL clusters

EcosystemGeneric solution based on probes

Name Native graphing AlertingNagios No YesZabbix Yes YesMunin Yes YesCacti Yes No

[ 9 / 37 ]

Page 10: [pgconf.ru 2015] OPM and PoWA: Keep an eye on your PostgreSQL clusters

General Overview

I ProsI Robust and matureI AdaptableI Extendable

I ConsI UI not flexibleI Data not available for queryingI Except check_postgres, lack of really completedatasource

[ 10 / 37 ]

Page 11: [pgconf.ru 2015] OPM and PoWA: Keep an eye on your PostgreSQL clusters

NagiosSpecific

I Graphing (with third part tool like OPM V2)I PostgreSQL compatibility with

I check_postgres (Bucardo)I check_pg_activity (OPM)

I Hard to configure

[ 11 / 37 ]

Page 12: [pgconf.ru 2015] OPM and PoWA: Keep an eye on your PostgreSQL clusters

ZabbixOverview

I PostgreSQL compatibility withI pg_monz (only PG 9.2+)I postbix (no news since 2013)

[ 12 / 37 ]

Page 13: [pgconf.ru 2015] OPM and PoWA: Keep an eye on your PostgreSQL clusters

MuninOverview

I Native PostgreSQL compatibility, and withI pyMunin

[ 13 / 37 ]

Page 14: [pgconf.ru 2015] OPM and PoWA: Keep an eye on your PostgreSQL clusters

CactiOverview

I PostgreSQL compatibility withI Some workaround with check_postgres (MRTGformat)

[ 14 / 37 ]

Page 15: [pgconf.ru 2015] OPM and PoWA: Keep an eye on your PostgreSQL clusters

What about OPM

I And for Open PostgreSQL Monitoring ?

[ 15 / 37 ]

Page 16: [pgconf.ru 2015] OPM and PoWA: Keep an eye on your PostgreSQL clusters

OPMArchitecture

I NagiosI SchedulerI Alerting

I ProbesI PG specific : check_pgactivityI And monitoring-plugin

I StorageI PostgreSQL :)I 9.3 or more

I GUII Dedicated GUI

[ 16 / 37 ]

Page 17: [pgconf.ru 2015] OPM and PoWA: Keep an eye on your PostgreSQL clusters

OPMOverview

[ 17 / 37 ]

Page 18: [pgconf.ru 2015] OPM and PoWA: Keep an eye on your PostgreSQL clusters

check_pgactivityDesign

I Written from scratch, simpler codeI Provide lots of servicesI Handle a small cacheI Better perfdata

[ 18 / 37 ]

Page 19: [pgconf.ru 2015] OPM and PoWA: Keep an eye on your PostgreSQL clusters

check_pgactivityNew features

I Handle multi-database connections transparentlyI Can compute delta instead of raw valuesI Handle units

[ 19 / 37 ]

Page 20: [pgconf.ru 2015] OPM and PoWA: Keep an eye on your PostgreSQL clusters

check_pgactivityNew service examples

I bgwriter statisticsI better bloat estimationI Most important settings check

[ 20 / 37 ]

Page 21: [pgconf.ru 2015] OPM and PoWA: Keep an eye on your PostgreSQL clusters

check_pgactivityEnhanced service

I better bloat estimationI replication : pg_stat_replication or hot standbyI "Instant" hit ratio

[ 21 / 37 ]

Page 22: [pgconf.ru 2015] OPM and PoWA: Keep an eye on your PostgreSQL clusters

User interface

I Specific ACLI More modern graphsI Custom graph display, tags. . .

[ 22 / 37 ]

Page 23: [pgconf.ru 2015] OPM and PoWA: Keep an eye on your PostgreSQL clusters

EcosystemSpecific solution

Name Maintained Aim Alertingpg_statsinfo Yes Generalist Possiblepg_watch Dead? Generalist NopgObserver Yes Performance NopgCluu Yes Generalist NoPoWA Yes Performance No

[ 23 / 37 ]

Page 24: [pgconf.ru 2015] OPM and PoWA: Keep an eye on your PostgreSQL clusters

pg_statsinfoPros & cons

I ProsI Useful metrics

I ConsI Reports on demandI Needs specific C extension (reboot required) oneach monitored server

[ 24 / 37 ]

Page 25: [pgconf.ru 2015] OPM and PoWA: Keep an eye on your PostgreSQL clusters

pgObserverPros & cons

I ProsI Useful metricsI And novel metrics (like stored proc)I Dynamic reports

I ButI Focused on performance

[ 25 / 37 ]

Page 26: [pgconf.ru 2015] OPM and PoWA: Keep an eye on your PostgreSQL clusters

pgCluuPros & cons

I ProsI Useful metricsI General overviewI Easy to use

I ConsI Can be storage greedyI Need to generate reports

[ 26 / 37 ]

Page 27: [pgconf.ru 2015] OPM and PoWA: Keep an eye on your PostgreSQL clusters

PoWA 2.0

I A complete solutionI Focused on performance

I Handle a lot of datasourceI Requires PG 9.4 or more

I requires queryid exposure, sincepg_stat_statements 1.2

[ 27 / 37 ]

Page 28: [pgconf.ru 2015] OPM and PoWA: Keep an eye on your PostgreSQL clusters

What is PoWA

I PostgreSQL extension : powa-archivistI A background workerI Dedicated snapshot, aggregation and purgefunctions

I Dedicated UI : powa-web

[ 28 / 37 ]

Page 29: [pgconf.ru 2015] OPM and PoWA: Keep an eye on your PostgreSQL clusters

PoWAExtensions handled

I Existing extensionsI pg_stat_statementsI pg_proctab (WIP)

I New oneI pg_qualstatsI pg_stat_kcacheI pg_track_settings (WIP)

[ 29 / 37 ]

Page 30: [pgconf.ru 2015] OPM and PoWA: Keep an eye on your PostgreSQL clusters

pg_qualstatsPresentation

I Gather real-time statistics on where clauses perquery

I SeqScan / indexScanI OperatorI Number of executionI Filter ratioI . . .

[ 30 / 37 ]

Page 31: [pgconf.ru 2015] OPM and PoWA: Keep an eye on your PostgreSQL clusters

pg_qualstatsWhat it allows

I Find missing indexesI Which could be partialI Or on several columns if some other queries couldbenefit from it

I . . .

[ 31 / 37 ]

Page 32: [pgconf.ru 2015] OPM and PoWA: Keep an eye on your PostgreSQL clusters

pg_qualstatsWhat it allows

I EXPLAIN normalized queries with real valuesI Most frequentsI Most/Least filteringI . . .

[ 32 / 37 ]

Page 33: [pgconf.ru 2015] OPM and PoWA: Keep an eye on your PostgreSQL clusters

pg_stat_kcachePresentation

I Gather real-time per query system statistics

[ 33 / 37 ]

Page 34: [pgconf.ru 2015] OPM and PoWA: Keep an eye on your PostgreSQL clusters

pg_stat_kcacheWhat it allows

I Compute a real hit ratio (shared_buffers, systemcache and disk)

I Show CPU consumptionI global, per database and/or per query and/or peruser

I over time

[ 34 / 37 ]

Page 35: [pgconf.ru 2015] OPM and PoWA: Keep an eye on your PostgreSQL clusters

Demo

I demo-powa.dalibo.com powa // demoI demo.opm.io opm // demo

[ 35 / 37 ]

Page 36: [pgconf.ru 2015] OPM and PoWA: Keep an eye on your PostgreSQL clusters

For the future

I Nagios optional from OPMI Add ability to handle PoWA in OPMI Better use of metrics

I Trending / statistic analysisI Correlate informations

I Better index suggestion, global database analysisI And much more. . .

[ 36 / 37 ]

Page 37: [pgconf.ru 2015] OPM and PoWA: Keep an eye on your PostgreSQL clusters

Questions?

I [email protected] [email protected] [email protected]

I github.com/OPMDG - github.com/dalibo/powaI Thank you !

[ 37 / 37 ]