+ All Categories
Home > Documents > PostgreSQL, PostgreSQL monitoring and monitoring postgresql · PostgreSQL, PostgreSQL monitoring...

PostgreSQL, PostgreSQL monitoring and monitoring postgresql · PostgreSQL, PostgreSQL monitoring...

Date post: 13-Sep-2018
Category:
Upload: tranlien
View: 349 times
Download: 8 times
Share this document with a friend
36
1 PostgreSQL, PostgreSQL monitoring and monitoring postgresql.org Stefan Kaltenbrunner [email protected] http://www.kaltenbrunner.cc/blog Nagios conference 2008 Nuremberg, Germany September 2008
Transcript
Page 1: PostgreSQL, PostgreSQL monitoring and monitoring postgresql · PostgreSQL, PostgreSQL monitoring and monitoring postgresql.org ... stefan@kaltenbrunner.cc Nagios conference 2008 ...

1

PostgreSQL, PostgreSQL monitoring and monitoring postgresql.org

Stefan [email protected]

http://www.kaltenbrunner.cc/blog

Nagios conference2008

Nuremberg, GermanySeptember 2008

Page 2: PostgreSQL, PostgreSQL monitoring and monitoring postgresql · PostgreSQL, PostgreSQL monitoring and monitoring postgresql.org ... stefan@kaltenbrunner.cc Nagios conference 2008 ...

About myself

Stefan KaltenbrunnerSenior Systems Architect at conova

communicationsMajor contributor to PostgreSQL projectInfrastructure and WebteamPatches and Portability

Page 3: PostgreSQL, PostgreSQL monitoring and monitoring postgresql · PostgreSQL, PostgreSQL monitoring and monitoring postgresql.org ... stefan@kaltenbrunner.cc Nagios conference 2008 ...

Agenda

PostgreSQLPostgreSQL InternalsMonitoring PostgreSQL

What, Why and HowTools

Monitoring postgresql.orgQ & A

Page 4: PostgreSQL, PostgreSQL monitoring and monitoring postgresql · PostgreSQL, PostgreSQL monitoring and monitoring postgresql.org ... stefan@kaltenbrunner.cc Nagios conference 2008 ...

Agenda

PostgreSQLPostgreSQL InternalsMonitoring PostgreSQL

What, Why and HowTools

Monitoring postgresql.orgQ & A

Page 5: PostgreSQL, PostgreSQL monitoring and monitoring postgresql · PostgreSQL, PostgreSQL monitoring and monitoring postgresql.org ... stefan@kaltenbrunner.cc Nagios conference 2008 ...

PostgreSQL

BSD licenced ORDBMSOpensource Project20 year old, 13 years of OSSFast, reliable and strong communityAdapted and used as the base for

commercial and proprietary solutions

Page 6: PostgreSQL, PostgreSQL monitoring and monitoring postgresql · PostgreSQL, PostgreSQL monitoring and monitoring postgresql.org ... stefan@kaltenbrunner.cc Nagios conference 2008 ...

PostgreSQL

~900.000 lines of codehundreds of subprojects~200 active developers

http://ohloh.netprojects/postgres/

Page 7: PostgreSQL, PostgreSQL monitoring and monitoring postgresql · PostgreSQL, PostgreSQL monitoring and monitoring postgresql.org ... stefan@kaltenbrunner.cc Nagios conference 2008 ...

Agenda

PostgreSQLPostgreSQL InternalsMonitoring PostgreSQL

What, Why and HowTools

Monitoring postgresql.orgQ & A

Page 8: PostgreSQL, PostgreSQL monitoring and monitoring postgresql · PostgreSQL, PostgreSQL monitoring and monitoring postgresql.org ... stefan@kaltenbrunner.cc Nagios conference 2008 ...

Process based architectureOne process per connectionNumber of dedicated processesShared memoryOS level cachingHighly portable (Unix, Windows, ...)

PostgreSQL Internals

Page 9: PostgreSQL, PostgreSQL monitoring and monitoring postgresql · PostgreSQL, PostgreSQL monitoring and monitoring postgresql.org ... stefan@kaltenbrunner.cc Nagios conference 2008 ...

PID TTY STAT TIME COMMAND

3321 ? S 0:01 /usr/local/pgsql/bin/postgres -D /var/data/pg83

3324 ? Ss 0:10 \_ postgres: writer process

3325 ? Ds 0:06 \_ postgres: wal writer process

3326 ? Ss 0:02 \_ postgres: autovacuum launcher process

3327 ? Ss 0:01 \_ postgres: stats collector process

27998 ? Ds 0:14 \_ postgres: postgres test [local] SELECT

28583 ? Ss 0:01 \_ postgres: postgres test [local] INSERT

PostgreSQL Internals

Page 10: PostgreSQL, PostgreSQL monitoring and monitoring postgresql · PostgreSQL, PostgreSQL monitoring and monitoring postgresql.org ... stefan@kaltenbrunner.cc Nagios conference 2008 ...

PID TTY STAT TIME COMMAND

3321 ? S 0:01 /usr/local/pgsql/bin/postgres -D /var/data/pg83

3324 ? Ss 0:10 \_ postgres: writer process

3325 ? Ds 0:06 \_ postgres: wal writer process

3326 ? Ss 0:02 \_ postgres: autovacuum launcher process

3327 ? Ss 0:01 \_ postgres: stats collector process

27998 ? Ds 0:14 \_ postgres: postgres test [local] SELECT

28583 ? Ss 0:01 \_ postgres: postgres test [local] INSERT

PostgreSQL Internals

Page 11: PostgreSQL, PostgreSQL monitoring and monitoring postgresql · PostgreSQL, PostgreSQL monitoring and monitoring postgresql.org ... stefan@kaltenbrunner.cc Nagios conference 2008 ...

PID TTY STAT TIME COMMAND

3321 ? S 0:01 /usr/local/pgsql/bin/postgres -D /var/data/pg83

3324 ? Ss 0:10 \_ postgres: writer process

3325 ? Ds 0:06 \_ postgres: wal writer process

3326 ? Ss 0:02 \_ postgres: autovacuum launcher process

3327 ? Ss 0:01 \_ postgres: stats collector process

27998 ? Ds 0:14 \_ postgres: postgres test [local] SELECT

28583 ? Ss 0:01 \_ postgres: postgres test [local] INSERT

PostgreSQL Internals

Page 12: PostgreSQL, PostgreSQL monitoring and monitoring postgresql · PostgreSQL, PostgreSQL monitoring and monitoring postgresql.org ... stefan@kaltenbrunner.cc Nagios conference 2008 ...

PID TTY STAT TIME COMMAND

3321 ? S 0:01 /usr/local/pgsql/bin/postgres -D /var/data/pg83

3324 ? Ss 0:10 \_ postgres: writer process

3325 ? Ds 0:06 \_ postgres: wal writer process

3326 ? Ss 0:02 \_ postgres: autovacuum launcher process

3327 ? Ss 0:01 \_ postgres: stats collector process

27998 ? Ds 0:14 \_ postgres: postgres test [local] SELECT

28583 ? Ss 0:01 \_ postgres: postgres test [local] INSERT

PostgreSQL Internals

Page 13: PostgreSQL, PostgreSQL monitoring and monitoring postgresql · PostgreSQL, PostgreSQL monitoring and monitoring postgresql.org ... stefan@kaltenbrunner.cc Nagios conference 2008 ...

PID TTY STAT TIME COMMAND

3321 ? S 0:01 /usr/local/pgsql/bin/postgres -D /var/data/pg83

3324 ? Ss 0:10 \_ postgres: writer process

3325 ? Ds 0:06 \_ postgres: wal writer process

3326 ? Ss 0:02 \_ postgres: autovacuum launcher process

3327 ? Ss 0:01 \_ postgres: stats collector process

27998 ? Ds 0:14 \_ postgres: postgres test [local] SELECT

28583 ? Ss 0:01 \_ postgres: postgres test [local] INSERT

PostgreSQL Internals

Page 14: PostgreSQL, PostgreSQL monitoring and monitoring postgresql · PostgreSQL, PostgreSQL monitoring and monitoring postgresql.org ... stefan@kaltenbrunner.cc Nagios conference 2008 ...

PID TTY STAT TIME COMMAND

3321 ? S 0:01 /usr/local/pgsql/bin/postgres -D /var/data/pg83

3324 ? Ss 0:10 \_ postgres: writer process

3325 ? Ds 0:06 \_ postgres: wal writer process

3326 ? Ss 0:02 \_ postgres: autovacuum launcher process

3327 ? Ss 0:01 \_ postgres: stats collector process

27998 ? Ds 0:14 \_ postgres: postgres test [local] SELECT

28583 ? Ss 0:01 \_ postgres: postgres test [local] INSERT

PostgreSQL Internals

Page 15: PostgreSQL, PostgreSQL monitoring and monitoring postgresql · PostgreSQL, PostgreSQL monitoring and monitoring postgresql.org ... stefan@kaltenbrunner.cc Nagios conference 2008 ...

Agenda

PostgreSQLPostgreSQL InternalsMonitoring PostgreSQL

What, Why and HowTools

Monitoring postgresql.orgQ & A

Page 16: PostgreSQL, PostgreSQL monitoring and monitoring postgresql · PostgreSQL, PostgreSQL monitoring and monitoring postgresql.org ... stefan@kaltenbrunner.cc Nagios conference 2008 ...

Monitoring PostgreSQL

Piece of software – needs CPU, RAM and DiskCurrent stateHistoric stateTrends

Application specific informationSlow queriesErrors Internal state

Page 17: PostgreSQL, PostgreSQL monitoring and monitoring postgresql · PostgreSQL, PostgreSQL monitoring and monitoring postgresql.org ... stefan@kaltenbrunner.cc Nagios conference 2008 ...

Agenda

PostgreSQLPostgreSQL InternalsMonitoring PostgreSQL

What, Why and HowTools

Monitoring postgresql.orgQ & A

Page 18: PostgreSQL, PostgreSQL monitoring and monitoring postgresql · PostgreSQL, PostgreSQL monitoring and monitoring postgresql.org ... stefan@kaltenbrunner.cc Nagios conference 2008 ...

PostgreSQL Monitoring

Direct and indirect IO, CPU and Memory usage

Maintenance tasksBackground activityAverage and worst case latencyApplication specific uses

Page 19: PostgreSQL, PostgreSQL monitoring and monitoring postgresql · PostgreSQL, PostgreSQL monitoring and monitoring postgresql.org ... stefan@kaltenbrunner.cc Nagios conference 2008 ...

PostgreSQL Monitoring

LocksActive QueriesQuery DistributionCache efficiencyDisk Usage

Page 20: PostgreSQL, PostgreSQL monitoring and monitoring postgresql · PostgreSQL, PostgreSQL monitoring and monitoring postgresql.org ... stefan@kaltenbrunner.cc Nagios conference 2008 ...

Agenda

PostgreSQLPostgreSQL InternalsMonitoring PostgreSQL

What, Why and HowTools

Monitoring postgresql.orgQ & A

Page 21: PostgreSQL, PostgreSQL monitoring and monitoring postgresql · PostgreSQL, PostgreSQL monitoring and monitoring postgresql.org ... stefan@kaltenbrunner.cc Nagios conference 2008 ...

Monitoring PostgreSQL

Statistics collectorSystem catalogsLogfiles (role, database and session)DtraceOperating System tools

Page 22: PostgreSQL, PostgreSQL monitoring and monitoring postgresql · PostgreSQL, PostgreSQL monitoring and monitoring postgresql.org ... stefan@kaltenbrunner.cc Nagios conference 2008 ...

Monitoring PostgreSQL

check_postgres.plpgFouineMuninpgsnmpdcat/grep/awk and sed

Page 23: PostgreSQL, PostgreSQL monitoring and monitoring postgresql · PostgreSQL, PostgreSQL monitoring and monitoring postgresql.org ... stefan@kaltenbrunner.cc Nagios conference 2008 ...

Tools - check_postgres.pl

Swiss army knife of status monitoringTablesizes, Transaction status,

replication, maintainance operations, locks, number of connections and query runtime

MRTG modeMust have for any nagios based

PostgreSQL monitoring

Page 24: PostgreSQL, PostgreSQL monitoring and monitoring postgresql · PostgreSQL, PostgreSQL monitoring and monitoring postgresql.org ... stefan@kaltenbrunner.cc Nagios conference 2008 ...

Tools - check_postgres.plmastermind@mastermind:~$ check_postgres.pl -w "10 MB" -db test --action database_size

POSTGRES_DATABASE_SIZE WARNING: DB "test" test: 43719908 (42 MB) postgres: 4324580 (4223 kB) template0: 4243460 (4144 kB) template1: 4243460 (4144 kB) | time=0.04 test=43719908 postgres=4324580 template0=4243460 template1=4243460

mastermind@mastermind:~$ check_postgres.pl -w "16" -db test --action wal_files

POSTGRES_WAL_FILES OK: 8 | time=0.04

mastermind@mastermind:~$ check_postgres.pl -w "1 minute" -db test --action query_runtime --queryname "pg_class"

POSTGRES_QUERY_RUNTIME OK: DB "test" query runtime: 0.00089 seconds | time=0.04 qtime=0.00089

mastermind@mastermind:~$ check_postgres.pl -w "1 minute" -db test --action txn_time

POSTGRES_TXN_TIME WARNING: longest txn: 528s | time=0.04 maxtime:528

Page 25: PostgreSQL, PostgreSQL monitoring and monitoring postgresql · PostgreSQL, PostgreSQL monitoring and monitoring postgresql.org ... stefan@kaltenbrunner.cc Nagios conference 2008 ...

Tools - pgFouine

PHP based logfile analyzerCreates nicely formated reportsreplay/benchmark integration

Requires query logging

Page 26: PostgreSQL, PostgreSQL monitoring and monitoring postgresql · PostgreSQL, PostgreSQL monitoring and monitoring postgresql.org ... stefan@kaltenbrunner.cc Nagios conference 2008 ...

Tools - pgFouine

Page 27: PostgreSQL, PostgreSQL monitoring and monitoring postgresql · PostgreSQL, PostgreSQL monitoring and monitoring postgresql.org ... stefan@kaltenbrunner.cc Nagios conference 2008 ...

Tools - pgFouine

Page 28: PostgreSQL, PostgreSQL monitoring and monitoring postgresql · PostgreSQL, PostgreSQL monitoring and monitoring postgresql.org ... stefan@kaltenbrunner.cc Nagios conference 2008 ...

Tools - Munin

Simple monitoring solutionPlugin based with agent on the hostPostgresql plugins availableNagios integration for alerting

Page 29: PostgreSQL, PostgreSQL monitoring and monitoring postgresql · PostgreSQL, PostgreSQL monitoring and monitoring postgresql.org ... stefan@kaltenbrunner.cc Nagios conference 2008 ...

Tools - Munin

Page 30: PostgreSQL, PostgreSQL monitoring and monitoring postgresql · PostgreSQL, PostgreSQL monitoring and monitoring postgresql.org ... stefan@kaltenbrunner.cc Nagios conference 2008 ...

Tools - pgsnmpd

SNMP based monitoringRFC 1697 (RDBMS-MIB)No PostgreSQL specific MIB yet

Mostly useful in SNMP only environments

Page 31: PostgreSQL, PostgreSQL monitoring and monitoring postgresql · PostgreSQL, PostgreSQL monitoring and monitoring postgresql.org ... stefan@kaltenbrunner.cc Nagios conference 2008 ...

Agenda

PostgreSQLPostgreSQL InternalsMonitoring PostgreSQL

What, Why and HowTools

Monitoring postgresql.orgQ & A

Page 32: PostgreSQL, PostgreSQL monitoring and monitoring postgresql · PostgreSQL, PostgreSQL monitoring and monitoring postgresql.org ... stefan@kaltenbrunner.cc Nagios conference 2008 ...

Monitoring postgresql.org

~50 monitored hosts (about half fully community managed)

340 monitored servicesFreeBSD, Debian, Ubuntu, Slackware,

CentOS, Redhat Enterprise Linux and VMware

Austria, Canada, France, Israel, Panama, Sweden, USA

Page 33: PostgreSQL, PostgreSQL monitoring and monitoring postgresql · PostgreSQL, PostgreSQL monitoring and monitoring postgresql.org ... stefan@kaltenbrunner.cc Nagios conference 2008 ...

Monitoring postgresql.org

Nagios basedSmokeping latency trackingMunin graphingTrac

Configuration change management Internal ticketingDocs

Coordination through IM and Mailinglists

Page 34: PostgreSQL, PostgreSQL monitoring and monitoring postgresql · PostgreSQL, PostgreSQL monitoring and monitoring postgresql.org ... stefan@kaltenbrunner.cc Nagios conference 2008 ...

Monitoring postgresql.org

FreeBSD jails2-8 jails/hostNagios + NRPEMunin/SmokepingCustom checks

Project specific thingsHardware checksSecurity related checks

Page 35: PostgreSQL, PostgreSQL monitoring and monitoring postgresql · PostgreSQL, PostgreSQL monitoring and monitoring postgresql.org ... stefan@kaltenbrunner.cc Nagios conference 2008 ...

Monitoring postgresql.org

Page 36: PostgreSQL, PostgreSQL monitoring and monitoring postgresql · PostgreSQL, PostgreSQL monitoring and monitoring postgresql.org ... stefan@kaltenbrunner.cc Nagios conference 2008 ...

Thank you!

Questions?


Recommended