Skip to content

Commit

Permalink
[*] remove Graphite datastore support, closes #270
Browse files Browse the repository at this point in the history
  • Loading branch information
pashagolub committed Sep 4, 2023
1 parent 73fcb80 commit c778978
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 152 deletions.
5 changes: 1 addition & 4 deletions docs/ENV_VARIABLES.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@ Some variables influence multiple components. Command line parameters override e
- **PW3_PGPASSWORD** Config DB password. Default: pgwatch3admin
- **PW3_PGSSL** Config DB SSL connection only. Default: False
- **PW3_GROUP** Logical grouping/sharding key to monitor a subset of configured hosts. Default: -
- **PW3_DATASTORE** Backend for metric storage - [postgres|prometheus|graphite|json]. Default: postgres
- **PW3_DATASTORE** Backend for metric storage - [postgres|prometheus|json]. Default: postgres
- **PW3_VERBOSE** Logging vebosity. By default warning and errors are logged. Use [-v|-vv] to include [info|debug]. Default: -
- **PW3_PG_METRIC_STORE_CONN_STR** Postgres metric store connection string. Required when PW3_DATASTORE=postgres. Default: -
- **PW3_PG_RETENTION_DAYS** Effective when PW3_DATASTORE=postgres. Default: 14
- **PW3_GRAPHITEHOST** Graphite host. Default: -
- **PW3_GRAPHITEPORT** Graphite port. Default: -
- **PW3_CONFIG** File mode. File or folder of YAML (.yaml/.yml) files containing info on which DBs to monitor and where to store metrics
- **PW3_METRICS_FOLDER** File mode. Folder of metrics definitions
- **PW3_BATCHING_MAX_DELAY_MS** Max milliseconds to wait for a batched metrics flush. Default: 250
Expand Down Expand Up @@ -78,7 +76,6 @@ Some variables influence multiple components. Command line parameters override e
- **PW3_GRAFANA_BASEURL** For linking to Grafana "Query details" dashboard from "Stat_stmt. overview". Default: http://0.0.0.0:3000
- **PW3_AES_GCM_KEYPHRASE** Keyphrase for encryption/decpyption of connect string passwords.
- **PW3_AES_GCM_KEYPHRASE_FILE** File containing a keyphrase for encryption/decpyption of connect string passwords.
- **PW3_DATASTORE** Backend for metric storage - [postgres|graphite]. Default: postgres
- **PW3_PG_METRIC_STORE_CONN_STR** Postgres metric store connection string. Required when PW3_DATASTORE=postgres. Default: -


Expand Down
2 changes: 1 addition & 1 deletion docs/features.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ List of main features

* Easy extensibility of metrics which are defined in pure SQL, thus they could also be from the business domain

* Many metric data storage options - PostgreSQL, PostgreSQL with the compression enabled TimescaleDB extension, Graphite or Prometheus scraping
* Many metric data storage options - PostgreSQL, PostgreSQL with the compression enabled TimescaleDB extension, or Prometheus scraping

* Multiple deployment options - PostgreSQL configuration DB, YAML or ENV configuration, supporting both "push" and "pull" models

Expand Down
39 changes: 18 additions & 21 deletions src/config/cmdparser.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,13 @@ type MetricOpts struct {
Group string `short:"g" long:"group" mapstructure:"group" description:"Group (or groups, comma separated) for filtering which DBs to monitor. By default all are monitored" env:"PW3_GROUP"`
MetricsFolder string `short:"m" long:"metrics-folder" mapstructure:"metrics-folder" description:"Folder of metrics definitions" env:"PW3_METRICS_FOLDER"`
NoHelperFunctions bool `long:"no-helper-functions" mapstructure:"no-helper-functions" description:"Ignore metric definitions using helper functions (in form get_smth()) and don't also roll out any helpers automatically" env:"PW3_NO_HELPER_FUNCTIONS"`
Datastore string `long:"datastore" mapstructure:"datastore" choice:"postgres" choice:"prometheus" choice:"graphite" choice:"json" default:"postgres" env:"PW3_DATASTORE"`
Datastore string `long:"datastore" mapstructure:"datastore" choice:"postgres" choice:"prometheus" choice:"json" default:"postgres" env:"PW3_DATASTORE"`
PGMetricStoreConnStr string `long:"pg-metric-store-conn-str" mapstructure:"pg-metric-store-conn-str" description:"PG Metric Store" env:"PW3_PG_METRIC_STORE_CONN_STR"`
PGRetentionDays int64 `long:"pg-retention-days" mapstructure:"pg-retention-days" description:"If set, metrics older than that will be deleted" default:"14" env:"PW3_PG_RETENTION_DAYS"`
PrometheusPort int64 `long:"prometheus-port" mapstructure:"prometheus-port" description:"Prometheus port. Effective with --datastore=prometheus" default:"9187" env:"PW3_PROMETHEUS_PORT"`
PrometheusListenAddr string `long:"prometheus-listen-addr" mapstructure:"prometheus-listen-addr" description:"Network interface to listen on" default:"0.0.0.0" env:"PW3_PROMETHEUS_LISTEN_ADDR"`
PrometheusNamespace string `long:"prometheus-namespace" mapstructure:"prometheus-namespace" description:"Prefix for all non-process (thus Postgres) metrics" default:"pgwatch3" env:"PW3_PROMETHEUS_NAMESPACE"`
PrometheusAsyncMode bool `long:"prometheus-async-mode" mapstructure:"prometheus-async-mode" description:"Gather in background as with other storage and cache last fetch results in memory" env:"PW3_PROMETHEUS_ASYNC_MODE"`
GraphiteHost string `long:"graphite-host" mapstructure:"graphite-host" description:"Graphite host" env:"PW3_GRAPHITEHOST"`
GraphitePort string `long:"graphite-port" mapstructure:"graphite-port" description:"Graphite port" env:"PW3_GRAPHITEPORT"`
JSONStorageFile string `long:"json-storage-file" mapstructure:"json-storage-file" description:"Path to file where metrics will be stored when --datastore=json, one metric set per line" env:"PW3_JSON_STORAGE_FILE"`
}

Expand Down Expand Up @@ -63,24 +61,23 @@ type WebUIOpts struct {
}

type CmdOptions struct {
Connection ConnectionOpts `group:"Connection" mapstructure:"Connection"`
Metric MetricOpts `group:"Metric" mapstructure:"Metric"`
Logging LoggingOpts `group:"Logging" mapstructure:"Logging"`
WebUI WebUIOpts `group:"WebUI" mapstructure:"WebUI"`
Start StartOpts `group:"Start" mapstructure:"Start"`
// Params for running based on local config files, enabled distributed "push model" based metrics gathering. Metrics are sent directly to Influx/Graphite.
Config string `short:"c" long:"config" mapstructure:"config" description:"File or folder of YAML files containing info on which DBs to monitor and where to store metrics" env:"PW3_CONFIG"`
BatchingDelayMs int64 `long:"batching-delay-ms" mapstructure:"batching-delay-ms" description:"Max milliseconds to wait for a batched metrics flush. [Default: 250]" default:"250" env:"PW3_BATCHING_MAX_DELAY_MS"`
AdHocConnString string `long:"adhoc-conn-str" mapstructure:"adhoc-conn-str" description:"Ad-hoc mode: monitor a single Postgres DB specified by a standard Libpq connection string" env:"PW3_ADHOC_CONN_STR"`
AdHocDBType string `long:"adhoc-dbtype" mapstructure:"adhoc-dbtype" description:"Ad-hoc mode: postgres|postgres-continuous-discovery" default:"postgres" env:"PW3_ADHOC_DBTYPE"`
AdHocConfig string `long:"adhoc-config" mapstructure:"adhoc-config" description:"Ad-hoc mode: a preset config name or a custom JSON config" env:"PW3_ADHOC_CONFIG"`
AdHocCreateHelpers bool `long:"adhoc-create-helpers" mapstructure:"adhoc-create-helpers" description:"Ad-hoc mode: try to auto-create helpers. Needs superuser to succeed" env:"PW3_ADHOC_CREATE_HELPERS"`
AdHocUniqueName string `long:"adhoc-name" mapstructure:"adhoc-name" description:"Ad-hoc mode: Unique 'dbname' for Influx" default:"adhoc" env:"PW3_ADHOC_NAME"`
DirectOSStats bool `long:"direct-os-stats" mapstructure:"direct-os-stats" description:"Extract OS related psutil statistics not via PL/Python wrappers but directly on host" env:"PW3_DIRECT_OS_STATS"`
UseConnPooling bool `long:"use-conn-pooling" mapstructure:"use-conn-pooling" description:"Enable re-use of metrics fetching connections" env:"PW3_USE_CONN_POOLING"`
AesGcmKeyphrase string `long:"aes-gcm-keyphrase" mapstructure:"aes-gcm-keyphrase" description:"Decryption key for AES-GCM-256 passwords" env:"PW3_AES_GCM_KEYPHRASE"`
AesGcmKeyphraseFile string `long:"aes-gcm-keyphrase-file" mapstructure:"aes-gcm-keyphrase-file" description:"File with decryption key for AES-GCM-256 passwords" env:"PW3_AES_GCM_KEYPHRASE_FILE"`
AesGcmPasswordToEncrypt string `long:"aes-gcm-password-to-encrypt" mapstructure:"aes-gcm-password-to-encrypt" description:"A special mode, returns the encrypted plain-text string and quits. Keyphrase(file) must be set. Useful for YAML mode" env:"PW3_AES_GCM_PASSWORD_TO_ENCRYPT"`
Connection ConnectionOpts `group:"Connection" mapstructure:"Connection"`
Metric MetricOpts `group:"Metric" mapstructure:"Metric"`
Logging LoggingOpts `group:"Logging" mapstructure:"Logging"`
WebUI WebUIOpts `group:"WebUI" mapstructure:"WebUI"`
Start StartOpts `group:"Start" mapstructure:"Start"`
Config string `short:"c" long:"config" mapstructure:"config" description:"File or folder of YAML files containing info on which DBs to monitor and where to store metrics" env:"PW3_CONFIG"`
BatchingDelayMs int64 `long:"batching-delay-ms" mapstructure:"batching-delay-ms" description:"Max milliseconds to wait for a batched metrics flush. [Default: 250]" default:"250" env:"PW3_BATCHING_MAX_DELAY_MS"`
AdHocConnString string `long:"adhoc-conn-str" mapstructure:"adhoc-conn-str" description:"Ad-hoc mode: monitor a single Postgres DB specified by a standard Libpq connection string" env:"PW3_ADHOC_CONN_STR"`
AdHocDBType string `long:"adhoc-dbtype" mapstructure:"adhoc-dbtype" description:"Ad-hoc mode: postgres|postgres-continuous-discovery" default:"postgres" env:"PW3_ADHOC_DBTYPE"`
AdHocConfig string `long:"adhoc-config" mapstructure:"adhoc-config" description:"Ad-hoc mode: a preset config name or a custom JSON config" env:"PW3_ADHOC_CONFIG"`
AdHocCreateHelpers bool `long:"adhoc-create-helpers" mapstructure:"adhoc-create-helpers" description:"Ad-hoc mode: try to auto-create helpers. Needs superuser to succeed" env:"PW3_ADHOC_CREATE_HELPERS"`
AdHocUniqueName string `long:"adhoc-name" mapstructure:"adhoc-name" description:"Ad-hoc mode: Unique 'dbname' for Influx" default:"adhoc" env:"PW3_ADHOC_NAME"`
DirectOSStats bool `long:"direct-os-stats" mapstructure:"direct-os-stats" description:"Extract OS related psutil statistics not via PL/Python wrappers but directly on host" env:"PW3_DIRECT_OS_STATS"`
UseConnPooling bool `long:"use-conn-pooling" mapstructure:"use-conn-pooling" description:"Enable re-use of metrics fetching connections" env:"PW3_USE_CONN_POOLING"`
AesGcmKeyphrase string `long:"aes-gcm-keyphrase" mapstructure:"aes-gcm-keyphrase" description:"Decryption key for AES-GCM-256 passwords" env:"PW3_AES_GCM_KEYPHRASE"`
AesGcmKeyphraseFile string `long:"aes-gcm-keyphrase-file" mapstructure:"aes-gcm-keyphrase-file" description:"File with decryption key for AES-GCM-256 passwords" env:"PW3_AES_GCM_KEYPHRASE_FILE"`
AesGcmPasswordToEncrypt string `long:"aes-gcm-password-to-encrypt" mapstructure:"aes-gcm-password-to-encrypt" description:"A special mode, returns the encrypted plain-text string and quits. Keyphrase(file) must be set. Useful for YAML mode" env:"PW3_AES_GCM_PASSWORD_TO_ENCRYPT"`
// "Test data" mode needs to be combined with "ad-hoc" mode to get an initial set of metrics from a real source
TestdataMultiplier int `long:"testdata-multiplier" mapstructure:"testdata-multiplier" description:"For how many hosts to generate data" env:"PW3_TESTDATA_MULTIPLIER"`
TestdataDays int `long:"testdata-days" mapstructure:"testdata-days" description:"For how many days to generate data" env:"PW3_TESTDATA_DAYS"`
Expand Down
1 change: 0 additions & 1 deletion src/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ require (
github.com/hashicorp/consul/api v1.24.0
github.com/jackc/pgx/v5 v5.4.3
github.com/jessevdk/go-flags v1.5.0
github.com/marpaia/graphite-golang v0.0.0-20190519024811-caf161d2c2b1
github.com/prometheus/client_golang v1.16.0
github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5
github.com/samuel/go-zookeeper v0.0.0-20201211165307-7117e9ea2414
Expand Down
Loading

0 comments on commit c778978

Please sign in to comment.