PostgreSQL Monitor Pg_view
Https://github.com/zalando/pg_view
Requirements
Linux 2.6, Python 2.6, psycopg2, curses
See if the system has curses
[Email protected]/]# ls/usr/include/ncurses*
/usr/include/ncurses_dll.h/usr/include/ncurses.h
The system already has curses installed, if not downloaded and installed curses
Download and install curses
Curses GNU Implementation ncurses, official website: http://ftp.gnu.org/gnu/ncurses/
Download the latest version of ncurses;
[Email protected] Soft_bak]tar ZXVF ncurses-6.0.tar.gz
[[email protected] Soft_bak] CD ncurses-6.0
[[email protected] soft_bak]./configure
[[email protected] soft_bak] Make
[[email protected] soft_bak] make install
The default installation, the header file under/usr/include, the library under/usr/lib.
You can also use Yum to install
Search: Yum Search ncurses
Installation: Yum Install ncurses
Package
PYTHON-2.7.TAR.BZ2 psycopg2-2.6.1.tar.gz psutil-3.2.2.tar.gz
Installing python2.7
[Email protected] soft_bak]# tar jxvf python-2.7.tar.bz2
[Email protected] soft_bak]# CD Python-2.7
[Email protected] python-2.7]#/configure--prefix=/usr/local/python2.7/
[[email protected] python-2.7]# make
[[email protected] python-2.7]# make install
Add/usr/local/python2.7/bin/to Linux environment variables
[Email protected] bin]# echo $PATH
/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
[Email protected] bin]# path= "$PATH":/usr/local/python2.7/bin/
[Email protected] bin]# echo $PATH
/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/usr/local/python2.7/bin/
Delete the Python file in/usr/bin and create a connection for python2.7
[Email protected] bin]# cd/usr/bin/
[[email protected] bin]# RM-RF python
[Email protected] bin]# ln-s/usr/local/python2.7/bin/python./python
[[email protected] bin]# python
Python 2.7 (r27:82500, Jan 14 2016, 16:13:36)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2
Type "Help", "copyright", "credits" or "license" for more information.
>>>
Installing Psutil
[Email protected] soft_bak]# tar zxvf psutil-3.2.2.tar.gz
[Email protected] pgmonitor]# CD psutil-3.2.2
[[email protected] psutil-3.2.2]# python setup.py install
Installing PSYCOPG2
[Email protected] soft_bak]# tar zxvf psycopg2-2.6.1.tar.gz
[Email protected] pgmonitor]# CD psycopg2-2.6.1
[[email protected] psycopg2-2.6.1]# python setup.py build_ext--pg-config/usr/local/pg945/bin/pg_config Build
[[email protected] psycopg2-2.6.1]# python setup.py build_ext--pg-config/usr/local/pg945/bin/pg_config Install
Installing Setuptools
[Email protected] soft_bak]# tar zxvf setuptools-19.2.tar.gz
[Email protected] setuptools-19.2]# CD setuptools-19.2
[[email protected] setuptools-19.2]# python setup.py install
[Email protected] soft_bak]# Unzip Pg_view-master.zip
[Email protected] soft_bak]# CD Pg_view-master
The setup.py in the Opt/soft_bak/pg_view-master directory will be
Line 112th Long_description=read (' readme.md '), read as follows
Long_description=read (' Readme.rst '),
[[email protected] pg_view-master]# python setup.py install
[Email protected] soft_bak]# cd/usr/local/python2.7/bin/
[[email protected] bin]# ls
2to3 easy_install easy_install-2.7 idle pg_view pydoc python python2.7 python2.7-config python-config smtpd.py
Start PostgreSQL
[Email protected] bin]$./pg_ctl-d. /data/start
Server starting
Postgres User Execution Pg_view
[Email protected] ~]$ cd/usr/local/python2.7/bin/
[Email protected] bin]$./pg_view
Generate small amounts of data
[Email protected] bin]$/pgbench-i-F 100-s 142-h localhost-p 5432-u postgres postgres
Process Pgbench Test
[Email protected] bin]$/pgbench-h localhost-p 5432-d postgres-u postgres-c 50-j 10-t 600
PostgreSQL Monitor Pg_view