pg-view 1.4.1

Creator: railscoder56

Last updated:

Add to Cart

Description:

pgview 1.4.1

pg_view: Postgres Real-Time Activity View Utility=======.. image:: https://travis-ci.org/zalando/pg_view.svg?branch=master :target: https://travis-ci.org/zalando/pg_view :alt: Build Status.. image:: https://img.shields.io/pypi/dw/pg-view.svg :target: https://pypi.python.org/pypi/pg-view :alt: PyPI Downloads.. image:: https://img.shields.io/pypi/l/pg-view.svg :target: https://pypi.python.org/pypi/pg-view :alt: LicenseIntro--------**pg_view** is a powerful command-line tool that offers a detailed, real-time view of your PostgreSQL database and system metrics. It combines the indicators commonly displayed by sar or iostat with output from PostgreSQL's process activity view, and presents global and per-process statistics in an easy-to-interpret way.pg_view shows these types of data:- per-process statistics, combined with ``pg_stat_activity`` view output for the backend and autovacuum processes- global system stats- per-partition information- memory statspg_view can be especially helpful when you're monitoring system load, query locks and I/O utilization during lengthy data migrations. It's also useful when you're running servers 24x7 and aiming for zero downtime. Learn more about it at `tech.zalando.com <https://tech.zalando.com/blog/getting-a-quick-view-of-your-postgresql-stats/>`_.Table of Contents--------.. contents:: :local: :depth: 1 :backlinks: none==============Installation and Configuration==============To run pg_view, you'll need:- Linux 2.6- Python >= 2.6- psycopg2- cursesBy default, pg_view assumes that it can connect to a local PostgreSQL instance with the user postgres and no password. Some systems might require you to change your pg_hba.conf file or set the password in .pgpass. You can override the default user name with the -U command-line option or by setting the user key in the configuration file (see below).==============How pg_view works==============pg_view queries system/process information files once per second. It also queries the filesystem to obtain postgres data directory and xlog usage statistics. Please note that the latter function might add an extra load to your disk subsystem... image:: https://raw.github.com/zalando/pg_view/master/images/pg_view_screenshot_new.png :alt: pg_view screenshot==============Connection Arguments==============By default, pg_view tries to autodetect all PostgreSQL clusters running on the same host by performing the following steps (in order):- reads /proc/ filesystem and detects pid files for the postmaster processes- gets the working directories from the symlink at /proc/pid/cwd- reads the PG_VERSION for PostgreSQL versions (if it doesn't exist, assume it's not a PostgreSQL directory, and skip)- tries to collect from /proc/net/unix, /proc/net/tcp and /proc/net/tcp6 all the sockets the process is listening to. If that fails, and you are using version 9.1 or above, reads the connection arguments from postmaster.pid- checks all arguments, picking the first that allows it to establish a connection- if pg_view can't get either the port/host or port/socket_directory pair, bail outIf the program can't detect your connection arguments using the algorithm above, you can specify those arguments manually using the configuration file supplied with the -c option. This file should consist of one or more sections, each containing a key = value pair.The title of each section represents a database cluster name (this name is for display purposes only). The dbname parameter is `postgres` by default, and specifies the actual name of the database to connect to. The key-value pairs should contain connection parameters.**The valid keys are:**- **host**: hostname or ip address, or unix_socket_directory path of the database server- **port**: the port the database server listens to- **user**: the database role nameThe special 'DEFAULT' section contains the parameters that apply for every database cluster if the corresponding parameter is missing from the database-specific section. For instance:: [DEFAULT] port=5435 [testdb] host=localhost [testdb2] host=/tmp/test [testdb3] host=192.168.1.0 port=5433 dbname=testUpon reading this file, the application will try using port 5435 (database postgres) to connect to both testdb and testdb2 clusters, and using the database name `test` port 5433 to connect to testdb3.If the auto-detection code works for you, you can select a single database by specifying the database instance name (in most cases, it will match the last component of PGDATA)withthe‘‘−i‘‘command−lineoption.Ifthereismorethanasingleinstancewiththesamename,youcanadditionallyspecifytherequiredPGversionwith‘‘−V‘‘.==============Usage==============Youcangetashortdescriptionofavailableconfigurationoptionswith‘‘pgview−−help‘‘pgviewsupportsthreeoutputmethods:−ncurses(default)−console(‘‘−oconsole‘‘)−json(‘‘−ojson‘‘)Descriptionsofsomeoftheoptions:−∗∗memory∗∗−∗∗as∗∗(CommittedAs):thetotalamountofmemoryrequiredtostoretheworkloadintheworst−casescenario(i.e.,ifallapplicationsactuallyallocateallthememorytheyaskforduringthestartup).−∗∗dirty∗∗:thetotalamountofmemorywaitingtobewrittenon−disk.Thehigherthevalue,themoreonehastowaitduringtheflush.−∗∗limit∗∗:themaximumamountofmemorythatcanbephysicallyallocated.Ifmemoryexceedsthelimit,youwillstartseeing‘outofmemory‘errors,whichwillleadtoaPostgreSQLshutdown.−Foranexplanationofotherparameters,pleaserefertothe‘Linuxkerneldocumentation<http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/filesystems/proc.txt>‘.−∗∗partitions∗∗−∗∗fill∗∗:therateofaddingnewdatatothecorrespondingdirectory(‘‘/data‘‘or‘‘/pgxlog‘‘).−∗∗pathsize∗∗:thesizeofthecorrespondingPostgreSQLdirectory.−∗∗total,left,read,write∗∗:theamountofdiskspaceavailableandallocated,aswellasthereadandwriterates(MB/s)onagivenpartition.Writerateisdifferentfromfillrate,inthatitconsidersthewholepartition,notonlythePostgresdirectories.Also,itshowsdatamodifications.Filedeletionattherateof10MB/swillbeshownasapositivewriterate.−∗∗type∗∗:eithercontainingdatabasedata(data)orWAL(xlog).−∗∗untilfull∗∗:thetimeremainingbeforethecurrentpartitionwillrunoutofspace,∗if∗weonlyconsiderwritestothecorrespondingdatadirectory(‘‘/data‘‘or‘‘/pgxlog‘‘).Thiscolumnisonlyshownduringthewarning(3h)orcritical(1h)conditions,andonlyconsidersmomentarywrites.Ifasingleprocesswrites100MB/sonapartitionwith100GBleftforonlytwoseconds,itwillshowacriticalstatusduringthosetwoseconds.−∗∗postgresprocesses∗∗−∗∗age∗∗:lengthoftimesincetheprocessstarted.−∗∗db∗∗:thedatabasetheprocessrunson.−∗∗query∗∗:thequerytheprocessexecutes.−∗∗read,write∗∗:TheamountofdatareadorwrittenfromthepartitioninMB/s.−∗∗s∗∗:processstate.‘‘R‘‘−′running′,‘‘S‘‘−′sleeping′,‘‘D‘‘−′uninterruptablesleep′;see‘‘manps‘‘formoredetails.−∗∗type∗∗:eitherasystemprocess(autovacuumlauncher,logger,archiver,etc.)oraprocessthatexecutesqueries(backendorautovacuum).Bydefault,onlyuserprocessesareshownincursesoutputmode(press′s′toaddthesystemprocesses).Bothsystemanduserprocessesareshownintheconsolemode.−∗∗utime,stime,guest∗∗:consumptionofCPUresourcesbyprocess.PostgreSQLbackendscan′tusemorethanoneCPU,sothepercentageofasingleCPUtimeisshownhere.−∗∗system∗∗−∗∗ctxt∗∗:thenumberofcontextswitchesinthesystem.−∗∗iowait∗∗:thepercentoftheCPUresourceswaitingonI/O.−∗∗run,block∗∗:thenumberofrunningandwaitingprocesses.−Forotherparameters,pleaserefertoman5procandlookfor/proc/stat.==============Hotkeys==============−∗∗a∗∗:auto−hidefieldsfromthePostgreSQLoutput.Turningonthisoptionhidesthefollowingfields:‘‘type‘‘,‘‘s‘‘,‘‘utime‘‘,‘‘stime‘‘,‘‘guest‘‘.−∗∗f∗∗:instantlyfreezestheoutput.Press‘‘f‘‘asecondtimetoresume.−∗∗h∗∗:showsthehelpscreen.−∗∗u∗∗:toggledisplayofmeasurementunits.==============Releasing============== ./release.sh <NEW-VERSION>==============Contributing==============pg_view welcomes contributions; simply make a pull request.==============License==============`Apache 2.0 <http://www.apache.org/licenses/LICENSE-2.0>`_

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.