diff --git a/charts/db-instances/Chart.yaml b/charts/db-instances/Chart.yaml index cb3681e..29395f0 100644 --- a/charts/db-instances/Chart.yaml +++ b/charts/db-instances/Chart.yaml @@ -2,4 +2,4 @@ apiVersion: v1 appVersion: "1.0" description: Database Instances for db operator name: db-instances -version: 2.3.4 +version: 2.4.0 diff --git a/charts/db-instances/README.md b/charts/db-instances/README.md index 3012d75..8005c45 100644 --- a/charts/db-instances/README.md +++ b/charts/db-instances/README.md @@ -10,102 +10,7 @@ Database Instances for db operator |-----|------|---------|-------------| | dbinstances | object | `{}` | | | nodeSelector | object | `{}` | | -| exporter.postgres.image | string | `"wrouesnel/postgres_exporter:latest"` | | -| exporter.postgres.query.pg_postmaster.query | string | `"SELECT pg_postmaster_start_time as start_time_seconds from pg_postmaster_start_time()"` | | -| exporter.postgres.query.pg_postmaster.metrics[0].start_time_seconds.usage | string | `"GAUGE"` | | -| exporter.postgres.query.pg_postmaster.metrics[0].start_time_seconds.description | string | `"Time at which postmaster started"` | | -| exporter.postgres.query.pg_stat_user_tables.query | string | `"SELECT schemaname, relname, seq_scan, seq_tup_read, idx_scan, idx_tup_fetch, n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze, last_vacuum, last_autovacuum, last_analyze, last_autoanalyze, vacuum_count, autovacuum_count, analyze_count, autoanalyze_count FROM pg_stat_user_tables"` | | -| exporter.postgres.query.pg_stat_user_tables.metrics[0].schemaname.usage | string | `"LABEL"` | | -| exporter.postgres.query.pg_stat_user_tables.metrics[0].schemaname.description | string | `"Name of the schema that this table is in"` | | -| exporter.postgres.query.pg_stat_user_tables.metrics[1].relname.usage | string | `"LABEL"` | | -| exporter.postgres.query.pg_stat_user_tables.metrics[1].relname.description | string | `"Name of this table"` | | -| exporter.postgres.query.pg_stat_user_tables.metrics[2].seq_scan.usage | string | `"COUNTER"` | | -| exporter.postgres.query.pg_stat_user_tables.metrics[2].seq_scan.description | string | `"Number of sequential scans initiated on this table"` | | -| exporter.postgres.query.pg_stat_user_tables.metrics[3].seq_tup_read.usage | string | `"COUNTER"` | | -| exporter.postgres.query.pg_stat_user_tables.metrics[3].seq_tup_read.description | string | `"Number of live rows fetched by sequential scans"` | | -| exporter.postgres.query.pg_stat_user_tables.metrics[4].idx_scan.usage | string | `"COUNTER"` | | -| exporter.postgres.query.pg_stat_user_tables.metrics[4].idx_scan.description | string | `"Number of index scans initiated on this table"` | | -| exporter.postgres.query.pg_stat_user_tables.metrics[5].idx_tup_fetch.usage | string | `"COUNTER"` | | -| exporter.postgres.query.pg_stat_user_tables.metrics[5].idx_tup_fetch.description | string | `"Number of live rows fetched by index scans"` | | -| exporter.postgres.query.pg_stat_user_tables.metrics[6].n_tup_ins.usage | string | `"COUNTER"` | | -| exporter.postgres.query.pg_stat_user_tables.metrics[6].n_tup_ins.description | string | `"Number of rows inserted"` | | -| exporter.postgres.query.pg_stat_user_tables.metrics[7].n_tup_upd.usage | string | `"COUNTER"` | | -| exporter.postgres.query.pg_stat_user_tables.metrics[7].n_tup_upd.description | string | `"Number of rows updated"` | | -| exporter.postgres.query.pg_stat_user_tables.metrics[8].n_tup_del.usage | string | `"COUNTER"` | | -| exporter.postgres.query.pg_stat_user_tables.metrics[8].n_tup_del.description | string | `"Number of rows deleted"` | | -| exporter.postgres.query.pg_stat_user_tables.metrics[9].n_tup_hot_upd.usage | string | `"COUNTER"` | | -| exporter.postgres.query.pg_stat_user_tables.metrics[9].n_tup_hot_upd.description | string | `"Number of rows HOT updated (i.e., with no separate index update required)"` | | -| exporter.postgres.query.pg_stat_user_tables.metrics[10].n_live_tup.usage | string | `"GAUGE"` | | -| exporter.postgres.query.pg_stat_user_tables.metrics[10].n_live_tup.description | string | `"Estimated number of live rows"` | | -| exporter.postgres.query.pg_stat_user_tables.metrics[11].n_dead_tup.usage | string | `"GAUGE"` | | -| exporter.postgres.query.pg_stat_user_tables.metrics[11].n_dead_tup.description | string | `"Estimated number of dead rows"` | | -| exporter.postgres.query.pg_stat_user_tables.metrics[12].n_mod_since_analyze.usage | string | `"GAUGE"` | | -| exporter.postgres.query.pg_stat_user_tables.metrics[12].n_mod_since_analyze.description | string | `"Estimated number of rows changed since last analyze"` | | -| exporter.postgres.query.pg_stat_user_tables.metrics[13].last_vacuum.usage | string | `"GAUGE"` | | -| exporter.postgres.query.pg_stat_user_tables.metrics[13].last_vacuum.description | string | `"Last time at which this table was manually vacuumed (not counting VACUUM FULL)"` | | -| exporter.postgres.query.pg_stat_user_tables.metrics[14].last_autovacuum.usage | string | `"GAUGE"` | | -| exporter.postgres.query.pg_stat_user_tables.metrics[14].last_autovacuum.description | string | `"Last time at which this table was vacuumed by the autovacuum daemon"` | | -| exporter.postgres.query.pg_stat_user_tables.metrics[15].last_analyze.usage | string | `"GAUGE"` | | -| exporter.postgres.query.pg_stat_user_tables.metrics[15].last_analyze.description | string | `"Last time at which this table was manually analyzed"` | | -| exporter.postgres.query.pg_stat_user_tables.metrics[16].last_autoanalyze.usage | string | `"GAUGE"` | | -| exporter.postgres.query.pg_stat_user_tables.metrics[16].last_autoanalyze.description | string | `"Last time at which this table was analyzed by the autovacuum daemon"` | | -| exporter.postgres.query.pg_stat_user_tables.metrics[17].vacuum_count.usage | string | `"COUNTER"` | | -| exporter.postgres.query.pg_stat_user_tables.metrics[17].vacuum_count.description | string | `"Number of times this table has been manually vacuumed (not counting VACUUM FULL)"` | | -| exporter.postgres.query.pg_stat_user_tables.metrics[18].autovacuum_count.usage | string | `"COUNTER"` | | -| exporter.postgres.query.pg_stat_user_tables.metrics[18].autovacuum_count.description | string | `"Number of times this table has been vacuumed by the autovacuum daemon"` | | -| exporter.postgres.query.pg_stat_user_tables.metrics[19].analyze_count.usage | string | `"COUNTER"` | | -| exporter.postgres.query.pg_stat_user_tables.metrics[19].analyze_count.description | string | `"Number of times this table has been manually analyzed"` | | -| exporter.postgres.query.pg_stat_user_tables.metrics[20].autoanalyze_count.usage | string | `"COUNTER"` | | -| exporter.postgres.query.pg_stat_user_tables.metrics[20].autoanalyze_count.description | string | `"Number of times this table has been analyzed by the autovacuum daemon"` | | -| exporter.postgres.query.pg_database.query | string | `"SELECT pg_database.datname, pg_database_size(pg_database.datname) as size FROM pg_database"` | | -| exporter.postgres.query.pg_database.metrics[0].datname.usage | string | `"LABEL"` | | -| exporter.postgres.query.pg_database.metrics[0].datname.description | string | `"Name of the database"` | | -| exporter.postgres.query.pg_database.metrics[1].size.usage | string | `"GAUGE"` | | -| exporter.postgres.query.pg_database.metrics[1].size.description | string | `"Disk space used by the database"` | | -| exporter.postgres.query.pg_stat_database.query | string | `"SELECT datname, numbackends, xact_commit, xact_rollback, blks_read, blks_hit, tup_fetched, tup_inserted, tup_updated, tup_deleted, temp_bytes, deadlocks FROM pg_catalog.pg_stat_database;"` | | -| exporter.postgres.query.pg_stat_database.metrics[0].datname.usage | string | `"LABEL"` | | -| exporter.postgres.query.pg_stat_database.metrics[0].datname.description | string | `"database NAME"` | | -| exporter.postgres.query.pg_stat_database.metrics[1].numbackends.usage | string | `"COUNTER"` | | -| exporter.postgres.query.pg_stat_database.metrics[1].numbackends.description | string | `"Number of backends currently connected to this database."` | | -| exporter.postgres.query.pg_stat_database.metrics[2].xact_commit.usage | string | `"COUNTER"` | | -| exporter.postgres.query.pg_stat_database.metrics[2].xact_commit.description | string | `"Number of transactions in this database that have been committed"` | | -| exporter.postgres.query.pg_stat_database.metrics[3].xact_rollback.usage | string | `"COUNTER"` | | -| exporter.postgres.query.pg_stat_database.metrics[3].xact_rollback.description | string | `"Number of transactions in this database that have been rolled back"` | | -| exporter.postgres.query.pg_stat_database.metrics[4].blks_read.usage | string | `"GAUGE"` | | -| exporter.postgres.query.pg_stat_database.metrics[4].blks_read.description | string | `"Number of disk blocks read in this database"` | | -| exporter.postgres.query.pg_stat_database.metrics[5].blks_hit.usage | string | `"GAUGE"` | | -| exporter.postgres.query.pg_stat_database.metrics[5].blks_hit.description | string | `"Number of times disk blocks were found already in the buffer cache, so that a read was not necessary"` | | -| exporter.postgres.query.pg_stat_database.metrics[6].tup_fetched.usage | string | `"COUNTER"` | | -| exporter.postgres.query.pg_stat_database.metrics[6].tup_fetched.description | string | `"Number of rows fetched by queries in this database"` | | -| exporter.postgres.query.pg_stat_database.metrics[7].tup_inserted.usage | string | `"COUNTER"` | | -| exporter.postgres.query.pg_stat_database.metrics[7].tup_inserted.description | string | `"Number of rows inserted by queries in this database"` | | -| exporter.postgres.query.pg_stat_database.metrics[8].tup_updated.usage | string | `"COUNTER"` | | -| exporter.postgres.query.pg_stat_database.metrics[8].tup_updated.description | string | `"Number of rows updated by queries in this database"` | | -| exporter.postgres.query.pg_stat_database.metrics[9].tup_deleted.usage | string | `"COUNTER"` | | -| exporter.postgres.query.pg_stat_database.metrics[9].tup_deleted.description | string | `"Number of rows deleted by queries in this database"` | | -| exporter.postgres.query.pg_stat_database.metrics[10].temp_bytes.usage | string | `"GAUGE"` | | -| exporter.postgres.query.pg_stat_database.metrics[10].temp_bytes.description | string | `"Total amount of data written to temporary files by queries in this database."` | | -| exporter.postgres.query.pg_stat_database.metrics[11].deadlocks.usage | string | `"COUNTER"` | | -| exporter.postgres.query.pg_stat_database.metrics[11].deadlocks.description | string | `"Number of deadlocks detected in this database"` | | -| exporter.postgres.query.pg_stat_statements.query | string | `"SELECT userid, pgss.dbid, pgdb.datname, queryid, query, calls, total_time, mean_time, rows FROM pg_stat_statements pgss LEFT JOIN (select oid as dbid, datname from pg_database) as pgdb on pgdb.dbid = pgss.dbid WHERE not queryid isnull ORDER BY mean_time desc limit 20"` | | -| exporter.postgres.query.pg_stat_statements.metrics[0].userid.usage | string | `"LABEL"` | | -| exporter.postgres.query.pg_stat_statements.metrics[0].userid.description | string | `"User ID"` | | -| exporter.postgres.query.pg_stat_statements.metrics[1].dbid.usage | string | `"LABEL"` | | -| exporter.postgres.query.pg_stat_statements.metrics[1].dbid.description | string | `"database ID"` | | -| exporter.postgres.query.pg_stat_statements.metrics[2].datname.usage | string | `"LABEL"` | | -| exporter.postgres.query.pg_stat_statements.metrics[2].datname.description | string | `"database NAME"` | | -| exporter.postgres.query.pg_stat_statements.metrics[3].queryid.usage | string | `"LABEL"` | | -| exporter.postgres.query.pg_stat_statements.metrics[3].queryid.description | string | `"Query unique Hash Code"` | | -| exporter.postgres.query.pg_stat_statements.metrics[4].query.usage | string | `"LABEL"` | | -| exporter.postgres.query.pg_stat_statements.metrics[4].query.description | string | `"Query class"` | | -| exporter.postgres.query.pg_stat_statements.metrics[5].calls.usage | string | `"COUNTER"` | | -| exporter.postgres.query.pg_stat_statements.metrics[5].calls.description | string | `"Number of times executed"` | | -| exporter.postgres.query.pg_stat_statements.metrics[6].total_time.usage | string | `"COUNTER"` | | -| exporter.postgres.query.pg_stat_statements.metrics[6].total_time.description | string | `"Total time spent in the statement, in milliseconds"` | | -| exporter.postgres.query.pg_stat_statements.metrics[7].mean_time.usage | string | `"GAUGE"` | | -| exporter.postgres.query.pg_stat_statements.metrics[7].mean_time.description | string | `"Mean time spent in the statement, in milliseconds"` | | -| exporter.postgres.query.pg_stat_statements.metrics[8].rows.usage | string | `"COUNTER"` | | -| exporter.postgres.query.pg_stat_statements.metrics[8].rows.description | string | `"Total number of rows retrieved or affected by the statement"` | | +| exporter.postgres.image | string | `"prometheuscommunity/postgres-exporter:v0.15.0"` | | | mysql.enabled | bool | `false` | | | postgresql.enabled | bool | `false` | | | tests | object | `{"serviceMonitor":{"enabled":false}}` | ------------------------------------------------------------------- | diff --git a/charts/db-instances/ci/ci-1-values.yaml b/charts/db-instances/ci/ci-1-values.yaml index 37ca8e2..e0566e1 100644 --- a/charts/db-instances/ci/ci-1-values.yaml +++ b/charts/db-instances/ci/ci-1-values.yaml @@ -2,6 +2,8 @@ dbinstances: instance1: serviceMonitor: enabled: true + podMonitor: + enabled: true engine: postgres monitoring: enabled: true diff --git a/charts/db-instances/ci/ci-gen-test-service-monitor-values.yaml.tmpl b/charts/db-instances/ci/ci-gen-test-monitoring-values.yaml.tmpl similarity index 86% rename from charts/db-instances/ci/ci-gen-test-service-monitor-values.yaml.tmpl rename to charts/db-instances/ci/ci-gen-test-monitoring-values.yaml.tmpl index d66fa31..4cd4feb 100644 --- a/charts/db-instances/ci/ci-gen-test-service-monitor-values.yaml.tmpl +++ b/charts/db-instances/ci/ci-gen-test-monitoring-values.yaml.tmpl @@ -2,6 +2,8 @@ dbinstances: instance1: serviceMonitor: enabled: true + podMonitor: + enabled: true engine: postgres monitoring: autodiscovery: true @@ -13,6 +15,5 @@ dbinstances: adminUser: postgres adminPassword: 123123!! tests: - serviceMonitor: + monitoring: enabled: true - instance: instance1 diff --git a/charts/db-instances/files/test_service_monitor b/charts/db-instances/files/test_monitoring similarity index 100% rename from charts/db-instances/files/test_service_monitor rename to charts/db-instances/files/test_monitoring diff --git a/charts/db-instances/templates/postgres_exporter.yaml b/charts/db-instances/templates/postgres_exporter.yaml index 29d824b..61b2afd 100644 --- a/charts/db-instances/templates/postgres_exporter.yaml +++ b/charts/db-instances/templates/postgres_exporter.yaml @@ -1,6 +1,5 @@ {{- $root := . }} {{- $nodeSelector := .Values.nodeSelector }} -{{- $configSha := include (print $.Template.BasePath "/postgres_exporter_query.yaml") . | sha256sum }} {{- $exporter := .Values.exporter.postgres }} {{- $fullName := include "db-instances.fullname" . }} {{- if .Values.dbinstances }} @@ -16,16 +15,12 @@ spec: replicas: 1 selector: matchLabels: - {{- include "db-instances.selectorLabels" $ | nindent 6 }} db-instance: {{ $name }} + {{- include "db-instances.selectorLabels" $ | nindent 6 }} strategy: type: Recreate template: metadata: - annotations: - prometheus.io/port: "60000" - prometheus.io/scrape: "true" - checksum/config: {{ $configSha }} labels: {{- include "db-instances.labels" $ | nindent 8 }} db-instance: {{ $name }} @@ -41,28 +36,15 @@ spec: value: /run/secrets/db-secrets/{{ $value.monitoring.passwordKey | default "password" }} - name: DATA_SOURCE_USER_FILE value: /run/secrets/db-secrets/{{ $value.monitoring.usernameKey | default "user" }} - - name: PG_EXPORTER_WEB_LISTEN_ADDRESS - value: :60000 - - name: PG_EXPORTER_EXTEND_QUERY_PATH - value: /run/cm/queries/queries.yaml - - name: PG_EXPORTER_CONSTANT_LABELS - value: dbinstance={{ $name }} - {{- if $value.monitoring.autodiscovery }} - - name: PG_EXPORTER_AUTO_DISCOVERY - value: "true" - {{- end }} image: {{ $exporter.image }} imagePullPolicy: Always name: exporter ports: - - name: metrics - containerPort: 60000 + - name: http + containerPort: 9187 volumeMounts: - mountPath: /run/secrets/db-secrets name: db-secrets - - mountPath: /run/cm/queries/queries.yaml - name: queries - subPath: queries.yaml nodeSelector: {{ toYaml $nodeSelector | nindent 8 }} volumes: @@ -74,35 +56,33 @@ spec: {{- else }} secretName: {{ $name }}-admin-secret {{- end }} - - configMap: - defaultMode: 420 - name: {{ $fullName }}-pgexporter-query - name: queries -{{- if $value.serviceMonitor.enabled }} --- apiVersion: v1 kind: Service metadata: name: dbinstance-{{ $name }}-pgexporter labels: + db-instance: {{ $name }} {{- include "db-instances.labels" $ | nindent 4 }} spec: type: ClusterIP ports: - - port: 8080 - targetPort: metrics + - port: 80 + targetPort: http protocol: TCP - name: metrics + name: http selector: {{- include "db-instances.selectorLabels" $ | nindent 4 }} db-instance: {{ $name }} ---- {{- if $.Capabilities.APIVersions.Has "monitoring.coreos.com/v1" }} +{{- if ($value.serviceMonitor).enabled }} +--- apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: name: dbinstance-{{ $name }}-sm labels: + db-instance: {{ $name }} {{- include "db-instances.labels" $ | nindent 4 }} {{- with $value.serviceMonitor.selector }} {{- toYaml . | nindent 4 }} @@ -112,7 +92,7 @@ spec: jobLabel: {{ $value.serviceMonitor.jobLabel }} {{- end }} endpoints: - - port: metrics + - port: http {{- with $value.serviceMonitor.interval }} interval: {{ . }} {{- end }} @@ -136,10 +116,67 @@ spec: - {{ $.Release.Namespace }} selector: matchLabels: -{{- include "db-instances.selectorLabels" $ | nindent 6 }} + db-instance: {{ $name }} +{{- if $value.serviceMonitor.targetLabels }} + targetLabels: + {{- range $value.serviceMonitor.targetLabels }} + - {{ . }} +{{- end }} +{{- end }} +{{- end }} +{{- end }} +{{- if $.Capabilities.APIVersions.Has "monitoring.coreos.com/v1" }} +{{- if ($value.podMonitor).enabled }} +--- +apiVersion: monitoring.coreos.com/v1 +kind: PodMonitor +metadata: + name: dbinstance-{{ $name }}-pm + labels: + db-instance: {{ $name }} + {{- include "db-instances.labels" $ | nindent 4 }} + {{- with $value.podMonitor.selector }} + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if $value.podMonitor.jobLabel }} + jobLabel: {{ $value.podMonitor.jobLabel }} + {{- end }} + podMetricsEndpoints: + - port: http + {{- with $value.podMonitor.interval }} + interval: {{ . }} + {{- end }} + {{- with $value.podMonitor.scrapeTimeout }} + scrapeTimeout: {{ . }} + {{- end }} + {{- with $value.podMonitor.metricRelabelings }} + metricRelabelings: + {{- if kindIs "string" . }} + {{- tpl . $ | nindent 8 }} + {{- else }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- end }} + {{- with $value.podMonitor.relabelings }} + relabelings: + {{- toYaml . | nindent 8 }} + {{- end }} + namespaceSelector: + matchNames: + - {{ $.Release.Namespace }} + selector: + matchLabels: + db-instance: {{ $name }} +{{- if $value.podMonitor.podTargetLabels }} + podTargetLabels: + {{- range $value.podMonitor.podTargetLabels }} + - {{ . }} +{{- end }} {{- end }} {{- end }} {{- end }} {{- end }} {{- end }} {{- end }} +{{- end }} \ No newline at end of file diff --git a/charts/db-instances/templates/postgres_exporter_query.yaml b/charts/db-instances/templates/postgres_exporter_query.yaml deleted file mode 100644 index 9c8e87b..0000000 --- a/charts/db-instances/templates/postgres_exporter_query.yaml +++ /dev/null @@ -1,10 +0,0 @@ ---- -apiVersion: v1 -kind: ConfigMap -metadata: - labels: - {{- include "db-instances.labels" . | nindent 4 }} - name: {{ template "db-instances.fullname" . }}-pgexporter-query -data: - queries.yaml: | - {{- toYaml .Values.exporter.postgres.query | nindent 4 }} diff --git a/charts/db-instances/templates/tests/test_service_monitor.yaml b/charts/db-instances/templates/tests/test_monitoring.yaml similarity index 84% rename from charts/db-instances/templates/tests/test_service_monitor.yaml rename to charts/db-instances/templates/tests/test_monitoring.yaml index dc2154b..d1e22c5 100644 --- a/charts/db-instances/templates/tests/test_service_monitor.yaml +++ b/charts/db-instances/templates/tests/test_monitoring.yaml @@ -1,6 +1,6 @@ -{{- if (((.Values.tests).serviceMonitor).enabled) }} +{{- if (.Values.tests.monitoring).enabled }} # --------------------------------------------------------------------- -# -- A config map with a script to test serviceMonitor +# -- A config map with a script to test monitoring # --------------------------------------------------------------------- --- apiVersion: v1 @@ -40,9 +40,9 @@ spec: volumeMounts: - name: test-script readOnly: true - mountPath: /test_service_monitor - subPath: test_service_monitor + mountPath: /test_monitoring + subPath: test_monitoring args: - - /test.sh + - /test_monitoring restartPolicy: Never {{- end}} diff --git a/charts/db-instances/values.yaml b/charts/db-instances/values.yaml index 6ad6daf..d90b590 100644 --- a/charts/db-instances/values.yaml +++ b/charts/db-instances/values.yaml @@ -2,158 +2,7 @@ dbinstances: {} nodeSelector: {} exporter: postgres: - image: wrouesnel/postgres_exporter:latest - query: - pg_postmaster: - query: "SELECT pg_postmaster_start_time as start_time_seconds from pg_postmaster_start_time()" - metrics: - - start_time_seconds: - usage: "GAUGE" - description: "Time at which postmaster started" - pg_stat_user_tables: - query: "SELECT schemaname, relname, seq_scan, seq_tup_read, idx_scan, idx_tup_fetch, n_tup_ins, n_tup_upd, n_tup_del, n_tup_hot_upd, n_live_tup, n_dead_tup, n_mod_since_analyze, last_vacuum, last_autovacuum, last_analyze, last_autoanalyze, vacuum_count, autovacuum_count, analyze_count, autoanalyze_count FROM pg_stat_user_tables" - metrics: - - schemaname: - usage: "LABEL" - description: "Name of the schema that this table is in" - - relname: - usage: "LABEL" - description: "Name of this table" - - seq_scan: - usage: "COUNTER" - description: "Number of sequential scans initiated on this table" - - seq_tup_read: - usage: "COUNTER" - description: "Number of live rows fetched by sequential scans" - - idx_scan: - usage: "COUNTER" - description: "Number of index scans initiated on this table" - - idx_tup_fetch: - usage: "COUNTER" - description: "Number of live rows fetched by index scans" - - n_tup_ins: - usage: "COUNTER" - description: "Number of rows inserted" - - n_tup_upd: - usage: "COUNTER" - description: "Number of rows updated" - - n_tup_del: - usage: "COUNTER" - description: "Number of rows deleted" - - n_tup_hot_upd: - usage: "COUNTER" - description: "Number of rows HOT updated (i.e., with no separate index update required)" - - n_live_tup: - usage: "GAUGE" - description: "Estimated number of live rows" - - n_dead_tup: - usage: "GAUGE" - description: "Estimated number of dead rows" - - n_mod_since_analyze: - usage: "GAUGE" - description: "Estimated number of rows changed since last analyze" - - last_vacuum: - usage: "GAUGE" - description: "Last time at which this table was manually vacuumed (not counting VACUUM FULL)" - - last_autovacuum: - usage: "GAUGE" - description: "Last time at which this table was vacuumed by the autovacuum daemon" - - last_analyze: - usage: "GAUGE" - description: "Last time at which this table was manually analyzed" - - last_autoanalyze: - usage: "GAUGE" - description: "Last time at which this table was analyzed by the autovacuum daemon" - - vacuum_count: - usage: "COUNTER" - description: "Number of times this table has been manually vacuumed (not counting VACUUM FULL)" - - autovacuum_count: - usage: "COUNTER" - description: "Number of times this table has been vacuumed by the autovacuum daemon" - - analyze_count: - usage: "COUNTER" - description: "Number of times this table has been manually analyzed" - - autoanalyze_count: - usage: "COUNTER" - description: "Number of times this table has been analyzed by the autovacuum daemon" - pg_database: - query: "SELECT pg_database.datname, pg_database_size(pg_database.datname) as size FROM pg_database" - metrics: - - datname: - usage: "LABEL" - description: "Name of the database" - - size: - usage: "GAUGE" - description: "Disk space used by the database" - pg_stat_database: - query: "SELECT datname, numbackends, xact_commit, xact_rollback, blks_read, blks_hit, tup_fetched, tup_inserted, tup_updated, tup_deleted, temp_bytes, deadlocks FROM pg_catalog.pg_stat_database;" - metrics: - - datname: - usage: "LABEL" - description: "database NAME" - - numbackends: - usage: "COUNTER" - description: "Number of backends currently connected to this database." - - xact_commit: - usage: "COUNTER" - description: "Number of transactions in this database that have been committed" - - xact_rollback: - usage: "COUNTER" - description: "Number of transactions in this database that have been rolled back" - - blks_read: - usage: "GAUGE" - description: "Number of disk blocks read in this database" - - blks_hit: - usage: "GAUGE" - description: "Number of times disk blocks were found already in the buffer cache, so that a read was not necessary" - - tup_fetched: - usage: "COUNTER" - description: "Number of rows fetched by queries in this database" - - tup_inserted: - usage: "COUNTER" - description: "Number of rows inserted by queries in this database" - - tup_updated: - usage: "COUNTER" - description: "Number of rows updated by queries in this database" - - tup_deleted: - usage: "COUNTER" - description: "Number of rows deleted by queries in this database" - - temp_bytes: - usage: "GAUGE" - description: "Total amount of data written to temporary files by queries in this database." - - deadlocks: - usage: "COUNTER" - description: "Number of deadlocks detected in this database" - pg_stat_statements: - query: "SELECT userid, pgss.dbid, pgdb.datname, queryid, query, calls, total_time, mean_time, rows FROM pg_stat_statements pgss LEFT JOIN (select oid as dbid, datname from pg_database) as pgdb on pgdb.dbid = pgss.dbid WHERE not queryid isnull ORDER BY mean_time desc limit 20" - metrics: - - userid: - usage: "LABEL" - description: "User ID" - - dbid: - usage: "LABEL" - description: "database ID" - - datname: - usage: "LABEL" - description: "database NAME" - - queryid: - usage: "LABEL" - description: "Query unique Hash Code" - - query: - usage: "LABEL" - description: "Query class" - - calls: - usage: "COUNTER" - description: "Number of times executed" - - total_time: - usage: "COUNTER" - description: "Total time spent in the statement, in milliseconds" - - mean_time: - usage: "GAUGE" - description: "Mean time spent in the statement, in milliseconds" - - rows: - usage: "COUNTER" - description: "Total number of rows retrieved or affected by the statement" + image: prometheuscommunity/postgres-exporter:v0.15.0 mysql: enabled: false postgresql: @@ -166,7 +15,6 @@ postgresql: # -- don't have an intention of testing the helm chart # --------------------------------------------------------------------- tests: - # Test that service monitor can be created - # and metrics can be scraped by Prometheus - serviceMonitor: + # Test that the metrics can be scraped by Prometheus + monitoring: enabled: false