Rule Management

With this service, you can easily set up alerting and recording rules by copying your Prometheus configuration files to GreptimeCloud. Furthermore, the visualized charts will be generated automatically in the console, providing a seamless experience for monitoring your applications. You can visit Prometheus for more details about the configuration files.

Manage rule files via Git

Each GreptimeCloud service comes with a Git repository for storing prometheus rules and configurations. By checking your rules, GreptimeCloud’s prometheus-compatible rule engine evaluates your rules against data stored in the database and emits alert when matches.

Rule Management - 图1NOTE

Creating branch or tag is disabled in the Git repository

Download Template

You can get the clone URL of the repository in the GreptimeCloud console.

  1. git clone <cloud-repo-url>

Files

You can see the following files in the repository.

  1. .
  2. ├── README.md
  3. └── prometheus.yml

You can add or edit files locally. Only the following files are allowed:

  • prometheus.yml
  • README.md
  • <your rules> YAML files

prometheus.yml

The prometheus.yml file is responsible for managing global and alerting settings. Please do not change its name. The supported fields are listed below. Any other fields will be discarded.

  1. global:
  2. [ evaluation_interval: <duration> | default = 1m ]
  3. external_labels:
  4. [ <labelname>: <labelvalue> ... ]
  5. alerting:
  6. alert_relabel_configs:
  7. [ - <relabel_config> ... ]
  8. alertmanagers:
  9. [ - <alertmanager_config> ... ]

Rule Files

You can add rule configurations in custom .yml files at the root directory. Suppose you have a rule file named alert.yml and with the following content:

  1. groups:
  2. - name: example
  3. rules:
  4. - record: code:prometheus_http_requests_total:sum
  5. expr: sum by (code) (prometheus_http_requests_total)

The files in the directory should be as following:

  1. .
  2. ├── README.md
  3. ├── alert.yml
  4. └── prometheus.yml

You can add as many rule files as you want.

Restrictions

  • Each file is 1MB limited, and total repo is 100MB limited
  • Each file MUST be valid rule yaml format
  • Creating directory is disabled

Push Code

After adding or copying your Prometheus configuration files into this repository, you can push them to GreptimeCloud.

  1. git add .
  1. git commit -m "sync prometheus configuration"
  1. git push

Pull Code

In addition to editing the configuration files through Git, you can also make changes to them via the GreptimeCloud console. Then you can pull the latest configuration files.

  1. git pull

Visualize Data

After pushing your Prometheus configuration files to GreptimeCloud, visit the GreptimeCloud console and navigate to the Prometheus Workbench. You can see the charts generated automatically based on your configuration files.

You can also add a new rule or edit the exist rules via the console. The changes will be automatically pushed to the repository.