|
| 1 | +// pgwatch is a command line tool that collects metrics from PostgreSQL databases and forwards to external sinks. |
| 2 | +// |
| 3 | +// Usage: |
| 4 | +// |
| 5 | +// pgwatch [OPTIONS] [config | metric | source] |
| 6 | +// |
| 7 | +// Sources: |
| 8 | +// |
| 9 | +// -s, --sources= Postgres URI, file or folder of YAML |
| 10 | +// files containing info on which DBs |
| 11 | +// to monitor [$PW_SOURCES] |
| 12 | +// --refresh= How frequently to resync sources and |
| 13 | +// metrics (default: 120) [$PW_REFRESH] |
| 14 | +// -g, --group= Groups for filtering which databases |
| 15 | +// to monitor. By default all are |
| 16 | +// monitored [$PW_GROUP] |
| 17 | +// --min-db-size-mb= Smaller size DBs will be ignored and |
| 18 | +// not monitored until they reach the |
| 19 | +// threshold. (default: 0) |
| 20 | +// [$PW_MIN_DB_SIZE_MB] |
| 21 | +// --max-parallel-connections-per-db= Max parallel metric fetches per DB. |
| 22 | +// Note the multiplication effect on |
| 23 | +// multi-DB instances (default: 4) |
| 24 | +// [$PW_MAX_PARALLEL_CONNECTIONS_PER_DB] |
| 25 | +// --try-create-listed-exts-if-missing= Try creating the listed extensions |
| 26 | +// (comma sep.) on first connect for |
| 27 | +// all monitored DBs when missing. Main |
| 28 | +// usage - pg_stat_statements |
| 29 | +// [$PW_TRY_CREATE_LISTED_EXTS_IF_MISSING] |
| 30 | +// |
| 31 | +// Metrics: |
| 32 | +// |
| 33 | +// -m, --metrics= File or folder of YAML files with |
| 34 | +// metrics definitions [$PW_METRICS] |
| 35 | +// --create-helpers Create helper database objects from |
| 36 | +// metric definitions |
| 37 | +// [$PW_CREATE_HELPERS] |
| 38 | +// --direct-os-stats Extract OS related psutil statistics |
| 39 | +// not via PL/Python wrappers but |
| 40 | +// directly on host |
| 41 | +// [$PW_DIRECT_OS_STATS] |
| 42 | +// --instance-level-cache-max-seconds= Max allowed staleness for instance |
| 43 | +// level metric data shared between DBs |
| 44 | +// of an instance. Affects 'continuous' |
| 45 | +// host types only. Set to 0 to disable |
| 46 | +// (default: 30) |
| 47 | +// [$PW_INSTANCE_LEVEL_CACHE_MAX_SECONDS] |
| 48 | +// --emergency-pause-triggerfile= When the file exists no metrics will |
| 49 | +// be temporarily fetched / scraped |
| 50 | +// (default: |
| 51 | +// /tmp/pgwatch-emergency-pause) |
| 52 | +// [$PW_EMERGENCY_PAUSE_TRIGGERFILE] |
| 53 | +// |
| 54 | +// Sinks: |
| 55 | +// |
| 56 | +// --sink= URI where metrics will be stored, |
| 57 | +// can be used multiple times [$PW_SINK] |
| 58 | +// --batching-delay= Max milliseconds to wait for a |
| 59 | +// batched metrics flush. [Default: |
| 60 | +// 250ms] (default: 250ms) |
| 61 | +// [$PW_BATCHING_MAX_DELAY] |
| 62 | +// --retention= If set, metrics older than that will |
| 63 | +// be deleted (default: 14) |
| 64 | +// [$PW_RETENTION] |
| 65 | +// --real-dbname-field= Tag key for real database name |
| 66 | +// (default: real_dbname) |
| 67 | +// [$PW_REAL_DBNAME_FIELD] |
| 68 | +// --system-identifier-field= Tag key for system identifier value |
| 69 | +// (default: sys_id) |
| 70 | +// [$PW_SYSTEM_IDENTIFIER_FIELD] |
| 71 | +// |
| 72 | +// Logging: |
| 73 | +// |
| 74 | +// -v, --log-level=[debug|info|error] Verbosity level for stdout and log |
| 75 | +// file (default: info) |
| 76 | +// --log-file= File name to store logs |
| 77 | +// --log-file-format=[json|text] Format of file logs (default: json) |
| 78 | +// --log-file-rotate Rotate log files |
| 79 | +// --log-file-size= Maximum size in MB of the log file |
| 80 | +// before it gets rotated (default: 100) |
| 81 | +// --log-file-age= Number of days to retain old log |
| 82 | +// files, 0 means forever (default: 0) |
| 83 | +// --log-file-number= Maximum number of old log files to |
| 84 | +// retain, 0 to retain all (default: 0) |
| 85 | +// |
| 86 | +// WebUI: |
| 87 | +// |
| 88 | +// --web-disable=[all|ui] Disable REST API and/or web UI |
| 89 | +// [$PW_WEBDISABLE] |
| 90 | +// --web-addr= TCP address in the form 'host:port' |
| 91 | +// to listen on (default: :8080) |
| 92 | +// [$PW_WEBADDR] |
| 93 | +// --web-user= Admin login [$PW_WEBUSER] |
| 94 | +// --web-password= Admin password [$PW_WEBPASSWORD] |
| 95 | +// |
| 96 | +// Help Options: |
| 97 | +// |
| 98 | +// -h, --help Show this help message |
| 99 | +// |
| 100 | +// Available commands: |
| 101 | +// |
| 102 | +// config Manage configurations |
| 103 | +// init Initialize configuration |
| 104 | +// upgrade Upgrade configuration schema |
| 105 | +// metric Manage metrics |
| 106 | +// print-init Get and print init SQL for a given metric or preset |
| 107 | +// print-sql Get and print SQL for a given metric |
| 108 | +// source Manage sources |
| 109 | +// ping Try to connect to configured sources, report errors if any and exit |
| 110 | +package main |
0 commit comments