zoukankan      html  css  js  c++  java
  • PG-监控可视化

    postgresql+echarts+grafana

    pgmetrics

    pgmetrics 是一款 postgresql 健康监控指标采集、报告开源软件。适用于PostgreSQL versions 9.3 to 13

    安装

    wget https://github.com/rapidloop/pgmetrics/releases/download/v1.11.0/pgmetrics_1.11.0_linux_amd64.tar.gz
    tar xvf pgmetrics_1.11.0_linux_amd64.tar.gz
    cd pgmetrics_1.11.0_linux_amd64
    ./pgmetrics --help
    

    使用

    用法

    $ pgmetrics --help
    pgmetrics collects PostgreSQL information and metrics.
    
    Usage:
      pgmetrics [OPTION]... [DBNAME]
    
    General options:
      -t, --timeout=SECS           individual query timeout in seconds (default: 5)
          --lock-timeout=MILLIS    lock timeout in milliseconds (default: 50)
      -i, --input=FILE             don't connect to db, instead read and display
                                       this previously saved JSON file
      -V, --version                output version information, then exit
      -?, --help[=options]         show this help, then exit
          --help=variables         list environment variables, then exit
    
    Collection options:
      -S, --no-sizes               don't collect tablespace and relation sizes
      -c, --schema=REGEXP          collect only from schema(s) matching POSIX regexp
      -C, --exclude-schema=REGEXP  do NOT collect from schema(s) matching POSIX regexp
      -a, --table=REGEXP           collect only from table(s) matching POSIX regexp
      -A, --exclude-table=REGEXP   do NOT collect from table(s) matching POSIX regexp
          --omit=WHAT              do NOT collect the items specified as a comma-separated
                                       list of: "tables", "indexes", "sequences",
                                       "functions", "extensions", "triggers",
                                       "statements", "log", "citus"
          --sql-length=LIMIT       collect only first LIMIT characters of all SQL
                                       queries (default: 500)
          --statements-limit=LIMIT collect only utmost LIMIT number of row from
                                       pg_stat_statements (default: 100)
          --only-listed            collect info only from the databases listed as
                                       command-line args (use with Heroku)
          --all-dbs                collect info from all user databases
          --log-file               location of PostgreSQL log file
          --log-dir                read all the PostgreSQL log files in this directory
          --log-span=MINS          examine the last MINS minutes of logs (default: 5)
          --aws-rds-dbid           AWS RDS/Aurora database instance identifier
    
    Output options:
      -f, --format=FORMAT          output format; "human", "json" or "csv" (default: "human")
      -l, --toolong=SECS           for human output, transactions running longer than
                                       this are considered too long (default: 60)
      -o, --output=FILE            write output to the specified file
          --no-pager               do not invoke the pager for tty output
    
    Connection options:
      -h, --host=HOSTNAME          database server host or socket directory
                                       (default: "/var/run/postgresql")
      -p, --port=PORT              database server port (default: 5432)
      -U, --username=USERNAME      database user name (default: "mdevan")
      -w, --no-password            never prompt for password
          --role=ROLE              do SET ROLE before collection
    
    For more information, visit <https://pgmetrics.io>.
    
    
    $ pgmetrics --help=variables
    Environment variables:
    Usage:
      NAME=VALUE [NAME=VALUE] pgmetrics ...
    
      PAGER              name of external pager program
      PGAPPNAME          the application_name connection parameter
      PGDATABASE         the dbname connection parameter
      PGHOST             the host connection parameter
      PGPORT             the port connection parameter
      PGUSER             the user connection parameter
      PGPASSWORD         connection password (not recommended)
      PGPASSFILE         path to the pgpass password file
      PGSSLMODE          "disable", "require", "verify-ca", "verify-full"
      PGSSLCERT          path to client SSL certificate
      PGSSLKEY           path to secret key for client SSL certificate
      PGSSLROOTCERT      path to SSL root CA
      PGCONNECT_TIMEOUT  connection timeout in seconds
    
    Also, the following libpq-related environment variarables are not
    required/used by pgmetrics and are IGNORED:
    
      PGHOSTADDR, PGSERVICE,     PGSERVICEFILE, PGREALM,  PGREQUIRESSL,
      PGSSLCRL,   PGREQUIREPEER, PGKRBSRVNAME,  PGGSSLIB, PGSYSCONFDIR,
      PGLOCALEDIR
    

    支持输出格式

    • text
    • JSON
    • CSV

    简单使用

    输出示例

    $ pgmetrics -h 127.0.0.1 bench test
    
  • 相关阅读:
    关于Excel无法打开,因为文件格式或文件扩展名无效的解决方法
    SpringBoot整合rabbitmq
    异步线程池的使用
    java1.8新特性之stream流式算法
    hashMap的底层实现
    redis底层设计(五)——内部运作机制
    redis底层设计(四)——功能的实现
    redis底层设计(三)——redis数据类型
    redis底层设计(二)——内存映射数据结构
    redis底层设计(一)——内部数据结构
  • 原文地址:https://www.cnblogs.com/binliubiao/p/14904871.html
Copyright © 2011-2022 走看看