homework-jianmu/docs/en/10-third-party/01-collection/_prometheus.mdx

32 lines
1.3 KiB
Plaintext

To configure Prometheus, edit the Prometheus configuration file `prometheus.yml` (default location is `/etc/prometheus/prometheus.yml`).
### Configure Third-Party Database Address
Set the `remote_read` and `remote_write` URLs to point to the server domain name or IP address where the taosAdapter service is running, the REST service port (taosAdapter uses 6041 by default), and the database name where you want to write to TDengine. Ensure that the corresponding URLs are in the following format:
- `remote_read` url: `http://<taosAdapter's host>:<REST service port>/prometheus/v1/remote_read/<database name>`
- `remote_write` url: `http://<taosAdapter's host>:<REST service port>/prometheus/v1/remote_write/<database name>`
### Configure Basic Authentication
- `username`: `<TDengine's username>`
- `password`: `<TDengine's password>`
### Example Configuration in prometheus.yml for remote_write and remote_read
```yaml
remote_write:
- url: "http://localhost:6041/prometheus/v1/remote_write/prometheus_data"
basic_auth:
username: root
password: taosdata
remote_read:
- url: "http://localhost:6041/prometheus/v1/remote_read/prometheus_data"
basic_auth:
username: root
password: taosdata
remote_timeout: 10s
read_recent: true
```