Skip to content

Prometheus

创建服务

为了充分体验 GreptimeCloud 的强大功能,你需要创建一个包含身份验证数据库的服务。打开 GreptimeCloud 控制台,注册并登录。然后单击 New Service 按钮并配置以下内容:

  • Service Name: 服务名称。
  • Description: 有关该服务的更多信息。
  • Region: 选择数据库所在的区域。
  • Plan: 选择要使用的定价计划。

现在创建服务,准备向其写入一些数据。

写入数据

如果你已经有正在运行的 Prometheus 实例

将下面的内容添加到你的 Prometheus 配置文件中。

yaml
remote_write:
  - url: https://<host>/v1/prometheus/write?db=<dbname>
    basic_auth:
        username: <username>
        password: <password>
remote_write:
  - url: https://<host>/v1/prometheus/write?db=<dbname>
    basic_auth:
        username: <username>
        password: <password>

或者你期望启动一个全新的实例

启动一个 Docker 容器,将示例数据写入 GreptimeCloud 数据库:

shell
docker run --rm -e GREPTIME_URL='https://<host>/v1/prometheus/write?db=<dbname>' -e GREPTIME_USERNAME='<username>' -e GREPTIME_PASSWORD='<password>' --name greptime-node-exporter greptime/node-exporter
docker run --rm -e GREPTIME_URL='https://<host>/v1/prometheus/write?db=<dbname>' -e GREPTIME_USERNAME='<username>' -e GREPTIME_PASSWORD='<password>' --name greptime-node-exporter greptime/node-exporter

数据可视化

成功将数据写入服务后,你可以在 GreptimeCloud 控制台中查看数据。控制台提供了各种可视化工具,帮助你理解、监控和分析数据。

这里我们创建一个面板显示 CPU 的 95% 用量作为示例。点击 Add Panel 按钮,选择包含 CPU 使用数据的 table,然后选择 95% 聚合方法。 最后,点击 Save 按钮保存面板。现在,你可以看到新的面板并为其设置报警规则。