Documentation ¶
Index ¶
- Constants
- type Collector
- func NewCPUCollector(constLabels labels, settings model.CollectorSettings) (Collector, error)
- func NewDiskstatsCollector(constLabels labels, settings model.CollectorSettings) (Collector, error)
- func NewFilesystemCollector(constLabels labels, settings model.CollectorSettings) (Collector, error)
- func NewLoadAverageCollector(constLabels labels, settings model.CollectorSettings) (Collector, error)
- func NewMeminfoCollector(constLabels labels, settings model.CollectorSettings) (Collector, error)
- func NewNetdevCollector(constLabels labels, settings model.CollectorSettings) (Collector, error)
- func NewNetworkCollector(constLabels labels, settings model.CollectorSettings) (Collector, error)
- func NewPgbouncerPoolsCollector(constLabels labels, settings model.CollectorSettings) (Collector, error)
- func NewPgbouncerSettingsCollector(constLabels labels, settings model.CollectorSettings) (Collector, error)
- func NewPgbouncerStatsCollector(constLabels labels, settings model.CollectorSettings) (Collector, error)
- func NewPgscvServicesCollector(constLabels labels, settings model.CollectorSettings) (Collector, error)
- func NewPostgresActivityCollector(constLabels labels, settings model.CollectorSettings) (Collector, error)
- func NewPostgresBgwriterCollector(constLabels labels, settings model.CollectorSettings) (Collector, error)
- func NewPostgresConflictsCollector(constLabels labels, settings model.CollectorSettings) (Collector, error)
- func NewPostgresCustomCollector(constLabels labels, settings model.CollectorSettings) (Collector, error)
- func NewPostgresDatabasesCollector(constLabels labels, settings model.CollectorSettings) (Collector, error)
- func NewPostgresFunctionsCollector(constLabels labels, settings model.CollectorSettings) (Collector, error)
- func NewPostgresIndexesCollector(constLabels labels, settings model.CollectorSettings) (Collector, error)
- func NewPostgresLocksCollector(constLabels labels, settings model.CollectorSettings) (Collector, error)
- func NewPostgresLogsCollector(constLabels labels, settings model.CollectorSettings) (Collector, error)
- func NewPostgresReplicationCollector(constLabels labels, settings model.CollectorSettings) (Collector, error)
- func NewPostgresReplicationSlotsCollector(constLabels labels, settings model.CollectorSettings) (Collector, error)
- func NewPostgresSchemasCollector(constLabels labels, settings model.CollectorSettings) (Collector, error)
- func NewPostgresSettingsCollector(constLabels labels, settings model.CollectorSettings) (Collector, error)
- func NewPostgresStatementsCollector(constLabels labels, settings model.CollectorSettings) (Collector, error)
- func NewPostgresStorageCollector(constLabels labels, settings model.CollectorSettings) (Collector, error)
- func NewPostgresTablesCollector(constLabels labels, settings model.CollectorSettings) (Collector, error)
- func NewPostgresWalArchivingCollector(constLabels labels, settings model.CollectorSettings) (Collector, error)
- func NewSysconfigCollector(constLabels labels, settings model.CollectorSettings) (Collector, error)
- type Config
- type Factories
- type PgscvCollector
- type PostgresServiceConfig
Constants ¶
const ( // Postgres server versions numeric representations. PostgresV95 = 90500 PostgresV96 = 90600 PostgresV10 = 100000 PostgresV12 = 120000 PostgresV13 = 130000 // Minimal required version is 9.5. PostgresVMinNum = PostgresV95 PostgresVMinStr = "9.5" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Collector ¶
type Collector interface { // Get new metrics and expose them via prometheus registry. Update(config Config, ch chan<- prometheus.Metric) error }
Collector is the interface a collector has to implement.
func NewCPUCollector ¶
func NewCPUCollector(constLabels labels, settings model.CollectorSettings) (Collector, error)
NewCPUCollector returns a new Collector exposing kernel/system statistics.
func NewDiskstatsCollector ¶
func NewDiskstatsCollector(constLabels labels, settings model.CollectorSettings) (Collector, error)
NewDiskstatsCollector returns a new Collector exposing disk device stats. Docs from https://www.kernel.org/doc/Documentation/iostats.txt and https://www.kernel.org/doc/Documentation/ABI/testing/procfs-diskstats
func NewFilesystemCollector ¶
func NewFilesystemCollector(constLabels labels, settings model.CollectorSettings) (Collector, error)
NewFilesystemCollector returns a new Collector exposing filesystem stats.
func NewLoadAverageCollector ¶
func NewLoadAverageCollector(constLabels labels, settings model.CollectorSettings) (Collector, error)
NewLoadAverageCollector returns a new Collector exposing load average statistics.
func NewMeminfoCollector ¶
func NewMeminfoCollector(constLabels labels, settings model.CollectorSettings) (Collector, error)
NewMeminfoCollector returns a new Collector exposing memory stats.
func NewNetdevCollector ¶
func NewNetdevCollector(constLabels labels, settings model.CollectorSettings) (Collector, error)
NewNetdevCollector returns a new Collector exposing network interfaces stats.
func NewNetworkCollector ¶
func NewNetworkCollector(constLabels labels, settings model.CollectorSettings) (Collector, error)
func NewPgbouncerPoolsCollector ¶
func NewPgbouncerPoolsCollector(constLabels labels, settings model.CollectorSettings) (Collector, error)
NewPgbouncerPoolsCollector returns a new Collector exposing pgbouncer pools connections usage stats. For details see https://www.pgbouncer.org/usage.html#show-pools.
func NewPgbouncerSettingsCollector ¶
func NewPgbouncerSettingsCollector(constLabels labels, settings model.CollectorSettings) (Collector, error)
NewPgbouncerSettingsCollector returns a new Collector exposing pgbouncer configuration. For details see https://www.pgbouncer.org/usage.html#show-config.
func NewPgbouncerStatsCollector ¶
func NewPgbouncerStatsCollector(constLabels labels, settings model.CollectorSettings) (Collector, error)
NewPgbouncerStatsCollector returns a new Collector exposing pgbouncer pools usage stats (except averages). For details see https://www.pgbouncer.org/usage.html#show-stats.
func NewPgscvServicesCollector ¶
func NewPgscvServicesCollector(constLabels labels, settings model.CollectorSettings) (Collector, error)
NewPgscvServicesCollector creates new collector.
func NewPostgresActivityCollector ¶
func NewPostgresActivityCollector(constLabels labels, settings model.CollectorSettings) (Collector, error)
NewPostgresActivityCollector returns a new Collector exposing postgres databases stats. For details see 1. https://www.postgresql.org/docs/current/monitoring-stats.html#PG-STAT-ACTIVITY-VIEW 2. https://www.postgresql.org/docs/current/view-pg-prepared-xacts.html
func NewPostgresBgwriterCollector ¶
func NewPostgresBgwriterCollector(constLabels labels, settings model.CollectorSettings) (Collector, error)
NewPostgresBgwriterCollector returns a new Collector exposing postgres bgwriter and checkpointer stats. For details see https://www.postgresql.org/docs/current/monitoring-stats.html#PG-STAT-BGWRITER-VIEW
func NewPostgresConflictsCollector ¶
func NewPostgresConflictsCollector(constLabels labels, settings model.CollectorSettings) (Collector, error)
NewPostgresConflictsCollector returns a new Collector exposing postgres databases recovery conflicts stats. For details see https://www.postgresql.org/docs/current/monitoring-stats.html#PG-STAT-DATABASE-CONFLICTS-VIEW
func NewPostgresCustomCollector ¶ added in v0.4.23
func NewPostgresCustomCollector(constLabels labels, settings model.CollectorSettings) (Collector, error)
NewPostgresCustomCollector returns a new Collector that expose user-defined postgres metrics.
func NewPostgresDatabasesCollector ¶
func NewPostgresDatabasesCollector(constLabels labels, settings model.CollectorSettings) (Collector, error)
NewPostgresDatabasesCollector returns a new Collector exposing postgres databases stats. For details see https://www.postgresql.org/docs/current/monitoring-stats.html#PG-STAT-DATABASE-VIEW
func NewPostgresFunctionsCollector ¶
func NewPostgresFunctionsCollector(constLabels labels, settings model.CollectorSettings) (Collector, error)
NewPostgresFunctionsCollector returns a new Collector exposing postgres SQL functions stats. For details see https://www.postgresql.org/docs/current/monitoring-stats.html#PG-STAT-USER-FUNCTIONS-VIEW
func NewPostgresIndexesCollector ¶
func NewPostgresIndexesCollector(constLabels labels, settings model.CollectorSettings) (Collector, error)
NewPostgresIndexesCollector returns a new Collector exposing postgres indexes stats. For details see https://www.postgresql.org/docs/current/monitoring-stats.html#PG-STAT-ALL-INDEXES-VIEW https://www.postgresql.org/docs/current/monitoring-stats.html#PG-STATIO-ALL-INDEXES-VIEW
func NewPostgresLocksCollector ¶
func NewPostgresLocksCollector(constLabels labels, settings model.CollectorSettings) (Collector, error)
NewPostgresLocksCollector creates new postgresLocksCollector.
func NewPostgresLogsCollector ¶
func NewPostgresLogsCollector(constLabels labels, settings model.CollectorSettings) (Collector, error)
NewPostgresLogsCollector creates new collector for Postgres log messages.
func NewPostgresReplicationCollector ¶
func NewPostgresReplicationCollector(constLabels labels, settings model.CollectorSettings) (Collector, error)
NewPostgresReplicationCollector returns a new Collector exposing postgres replication stats. For details see https://www.postgresql.org/docs/current/monitoring-stats.html#PG-STAT-REPLICATION-VIEW
func NewPostgresReplicationSlotsCollector ¶
func NewPostgresReplicationSlotsCollector(constLabels labels, settings model.CollectorSettings) (Collector, error)
NewPostgresReplicationSlotsCollector returns a new Collector exposing postgres replication slots stats. For details see https://www.postgresql.org/docs/current/view-pg-replication-slots.html
func NewPostgresSchemasCollector ¶
func NewPostgresSchemasCollector(constLabels labels, settings model.CollectorSettings) (Collector, error)
NewPostgresSchemaCollector returns a new Collector exposing postgres schema stats. Stats are based on different sources inside system catalog.
func NewPostgresSettingsCollector ¶
func NewPostgresSettingsCollector(constLabels labels, settings model.CollectorSettings) (Collector, error)
NewPostgresSettingsCollector returns a new Collector exposing postgres settings stats. For details see https://www.postgresql.org/docs/current/view-pg-settings.html and https://www.postgresql.org/docs/current/view-pg-file-settings.html
func NewPostgresStatementsCollector ¶
func NewPostgresStatementsCollector(constLabels labels, settings model.CollectorSettings) (Collector, error)
NewPostgresStatementsCollector returns a new Collector exposing postgres statements stats. For details see https://www.postgresql.org/docs/current/pgstatstatements.html
func NewPostgresStorageCollector ¶
func NewPostgresStorageCollector(constLabels labels, settings model.CollectorSettings) (Collector, error)
NewPostgresStorageCollector returns a new Collector exposing various stats related to Postgres storage layer. This stats observed using different stats sources.
func NewPostgresTablesCollector ¶
func NewPostgresTablesCollector(constLabels labels, settings model.CollectorSettings) (Collector, error)
NewPostgresTablesCollector returns a new Collector exposing postgres tables stats. For details see https://www.postgresql.org/docs/current/monitoring-stats.html#PG-STAT-ALL-TABLES-VIEW https://www.postgresql.org/docs/current/monitoring-stats.html#PG-STATIO-ALL-TABLES-VIEW
func NewPostgresWalArchivingCollector ¶ added in v0.4.16
func NewPostgresWalArchivingCollector(constLabels labels, settings model.CollectorSettings) (Collector, error)
NewPostgresWalArchivingCollector returns a new Collector exposing postgres WAL archiving stats. For details see https://www.postgresql.org/docs/current/monitoring-stats.html#MONITORING-PG-STAT-ARCHIVER-VIEW
func NewSysconfigCollector ¶
func NewSysconfigCollector(constLabels labels, settings model.CollectorSettings) (Collector, error)
NewSystemCollector returns a new Collector exposing system-wide stats.
type Config ¶
type Config struct { // ServiceType defines the type of discovered service. Depending on the type there should be different settings or // settings-specifics metric collection usecases. ServiceType string // ConnString defines a connection string used to connecting to the service ConnString string // NoTrackMode controls collector to gather and send sensitive information, such as queries texts. NoTrackMode bool // PostgresServiceConfig defines collector's options specific for Postgres service PostgresServiceConfig // DatabasesRE defines regexp with databases from which builtin metrics should be collected. DatabasesRE *regexp.Regexp // Settings defines collectors settings propagated from main YAML configuration. Settings model.CollectorsSettings }
Config defines collector's global configuration.
type Factories ¶
type Factories map[string]func(labels, model.CollectorSettings) (Collector, error)
Factories defines collector functions which used for collecting metrics.
func (Factories) RegisterPgbouncerCollectors ¶
RegisterPgbouncerCollectors unions all pgbouncer-related collectors and registers them in single place.
func (Factories) RegisterPostgresCollectors ¶
RegisterPostgresCollectors unions all postgres-related collectors and registers them in single place.
func (Factories) RegisterSystemCollectors ¶
RegisterSystemCollectors unions all system-related collectors and registers them in single place.
type PgscvCollector ¶
type PgscvCollector struct { Config Config Collectors map[string]Collector // contains filtered or unexported fields }
Collector implements the prometheus.Collector interface.
func NewPgscvCollector ¶
func NewPgscvCollector(serviceID string, factories Factories, config Config) (*PgscvCollector, error)
NewPgscvCollector accepts Factories and creates per-service instance of Collector.
func (PgscvCollector) Collect ¶
func (n PgscvCollector) Collect(out chan<- prometheus.Metric)
Collect implements the prometheus.Collector interface.
func (PgscvCollector) Describe ¶
func (n PgscvCollector) Describe(ch chan<- *prometheus.Desc)
Describe implements the prometheus.Collector interface.
type PostgresServiceConfig ¶
type PostgresServiceConfig struct { // LocalService defines service is running on the local host. LocalService bool // BlockSize defines size of data block Postgres operates. BlockSize uint64 // WalSegmentSize defines size of WAL segment Postgres operates. WalSegmentSize uint64 // ServerVersionNum defines version of Postgres in XXYYZZ format. ServerVersionNum int // DataDirectory defines filesystem path where Postgres' data files and directories resides. DataDirectory string // LoggingCollector defines value of 'logging_collector' GUC. LoggingCollector bool // PgStatStatements defines is pg_stat_statements available in shared_preload_libraries and available for queries PgStatStatements bool // PgStatStatementsDatabase defines the database name where pg_stat_statements is available PgStatStatementsDatabase string // PgStatStatementsSchema defines the schema name where pg_stat_statements is installed PgStatStatementsSchema string }
PostgresServiceConfig defines Postgres-specific stuff required during collecting Postgres metrics.
func NewPostgresServiceConfig ¶
func NewPostgresServiceConfig(connStr string) (PostgresServiceConfig, error)
NewPostgresServiceConfig defines new config for Postgres-based collectors
Source Files ¶
- collector.go
- collector_common.go
- config.go
- filesystem_common.go
- linux_cpu.go
- linux_diskstats.go
- linux_filesystem.go
- linux_load_average.go
- linux_memory.go
- linux_netdev.go
- linux_network.go
- linux_sysconfig.go
- pgbouncer_pools.go
- pgbouncer_settings.go
- pgbouncer_stats.go
- pgscv_services.go
- postgres_activity.go
- postgres_archiver.go
- postgres_bgwriter.go
- postgres_common.go
- postgres_conflicts.go
- postgres_custom.go
- postgres_database.go
- postgres_functions.go
- postgres_indexes.go
- postgres_locks.go
- postgres_logs.go
- postgres_replication.go
- postgres_replication_slots.go
- postgres_schema.go
- postgres_settings.go
- postgres_statements.go
- postgres_storage.go
- postgres_tables.go
- strings.go
- testing.go