Open longtian001 opened 6 years ago
global: scrape_interval: 10s # Set the scrape interval to every 15 seconds. Default is every 1 minute. evaluation_interval: 10s # Evaluate rules every 15 seconds. The default is every 1 minute.
alerting: alertmanagers:
rule_files:
scrape_configs:
job=<job_name>
to any timeseries scraped from this config.job_name: 'prometheus'
static_configs:
remote_write:
i build prometheus-postgresql-adapter without docker, pg,prometheus,prometheus-postgresql-adapter installed on one host. pg_hba.conf
local all all trust
host all all 127.0.0.1/32 trust host all all 0/0 trust
postgresql.conf
listen_addresses = '*' # what IP address(es) to listen on;
# defaults to 'localhost'; use '*' for all
# (change requires restart)
nothing insert into metrics_copy table
Is there data in the other tables, namely metrics_labels
and metrics_values
? The intended behavior is actually for metrics_copy
to be empty, as it's only used to get around the fact we can't COPY
directly into the metrics
view (metrics_copy
has a pre-insert trigger that parses samples into the metrics_values
and metrics_labels
tables and doesn't insert anything into the metrics_copy
table).
@longtian001 let us know if the answer supplied by @spolcyn resolved your question?
mondb=# \dt List of relations Schema | Name | Type | Owner
--------+----------------+-------+---------- public | metrics_copy | table | postgres public | metrics_labels | table | postgres public | metrics_values | table | postgres (3 rows)
mondb=#
./prometheus
level=info ts=2018-07-17T10:15:35.123777285Z caller=main.go:222 msg="Starting Prometheus" version="(version=2.3.2, branch=HEAD, revision=71af5e29e815795e9dd14742ee7725682fa14b7b)" level=info ts=2018-07-17T10:15:35.123836745Z caller=main.go:223 build_context="(go=go1.10.3, user=root@5258e0bd9cc1, date=20180712-14:02:52)" level=info ts=2018-07-17T10:15:35.1238555Z caller=main.go:224 host_details="(Linux 3.10.0-693.el7.x86_64 #1 SMP Tue Aug 22 21:09:27 UTC 2017 x86_64 pxc-app01-db01 (none))" level=info ts=2018-07-17T10:15:35.123871209Z caller=main.go:225 fd_limits="(soft=1024, hard=4096)" level=info ts=2018-07-17T10:15:35.124507787Z caller=web.go:415 component=web msg="Start listening for connections" address=0.0.0.0:9090 level=info ts=2018-07-17T10:15:35.124479211Z caller=main.go:533 msg="Starting TSDB ..." level=info ts=2018-07-17T10:15:35.138722073Z caller=main.go:543 msg="TSDB started" level=info ts=2018-07-17T10:15:35.138764754Z caller=main.go:603 msg="Loading configuration file" filename=prometheus.yml level=info ts=2018-07-17T10:15:35.140000617Z caller=main.go:629 msg="Completed loading of configuration file" filename=prometheus.yml level=info ts=2018-07-17T10:15:35.140022743Z caller=main.go:502 msg="Server is ready to receive web requests."
$ prometheus-postgresql-adapter -pg.database "mondb" -pg.prometheus-log-samples ts=2018-07-17T10:15:05.011421283Z caller=log.go:124 level=info msg="host=localhost port=5432 user=postgres dbname=mondb password='' sslmode=disable connect_timeout=10" ts=2018-07-17T10:15:05.020600907Z caller=log.go:124 level=info msg="Starting up..." ts=2018-07-17T10:15:05.020640117Z caller=log.go:124 level=info msg=Listening addr=:9201 up{instance="node_exporter:9100",job="prometheus"} 0 1531822544461 scrape_duration_seconds{instance="node_exporter:9100",job="prometheus"} 0.002416797 1531822544461 scrape_samples_scraped{instance="node_exporter:9100",job="prometheus"} 0 1531822544461 scrape_samples_post_metric_relabeling{instance="node_exporter:9100",job="prometheus"} 0 1531822544461 ts=2018-07-17T10:15:45.150765541Z caller=log.go:124 level=error storage=PostgreSQL msg="Error on Close when writing samples" err="pq: copyin statement has already been closed" ts=2018-07-17T10:15:45.151189004Z caller=log.go:124 level=warn msg="Error sending samples to remote storage" err="pq: copyin statement has already been closed" storage=PostgreSQL num_samples=4