Skip to content

Commit

Permalink
doc(gettting-started): Add Prometheus standalone deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
vmercierfr committed Nov 22, 2023
1 parent 0019cd6 commit 7095954
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 7 deletions.
8 changes: 8 additions & 0 deletions content/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ This project was initiated by [Qonto's](https://qonto.com/) SRE engineers to sha

Yes, we took lots of inspiration on [Prometheus-operator runbook](https://github.com/prometheus-operator/runbooks), which provides similar experience for Prometheus & Kubernetes technologies.

## Deployment

### Can I deploy the database monitoring framework on Prometheus standalone deployment?

Project was designed for Kubernetes deployment using Prometheus operator, but you can use for standalone deployment.

Use the `format=PrometheusConfigurationFile` Helm parameter to render rules as Prometheus rule files.

## Alerts

### Customize alerts
Expand Down
74 changes: 67 additions & 7 deletions content/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,86 @@ See also our tutorials for concrete deployment example.

Steps to deploy the framework on on your infrastructure:

1. Deploy Prometheus operator
{{< tabs "methods" >}}
{{< tab "Prometheus Kubernetes Operator" >}}
Requirements

Make sure:
- `serviceMonitorSelector` is defined to enable `ServiceMonitor` ([documentation](https://github.com/prometheus-operator/prometheus-operator/blob/v0.68.0/Documentation/user-guides/alerting.md#deploying-prometheus-rules))
- `ruleSelector` is enabled for `PrometheusRules` ([documentation](https://github.com/prometheus-operator/prometheus-operator/blob/v0.68.0/Documentation/user-guides/alerting.md#deploying-prometheus-rules))
- [Helm](https://helm.sh/docs/intro/install/)

1. Deploy Prometheus RDS exporters and/or PostgreSQL exporter as describe in tutorials
- [Prometheus Kubernetes operator](https://github.com/prometheus-operator/prometheus-operator)

1. `ruleSelector` must be enabled ([documentation](https://github.com/prometheus-operator/prometheus-operator/blob/v0.68.0/Documentation/user-guides/alerting.md#deploying-prometheus-rules))

1. `serviceMonitorSelector` must be enabled for `ServiceMonitor` ([documentation](https://github.com/prometheus-operator/prometheus-operator/blob/v0.68.0/Documentation/user-guides/alerting.md#deploying-prometheus-rules))

Steps

1. Deploy [Prometheus RDS exporter]({{< ref "/tutorials/rds/exporter-deployment" >}}) and/or [Prometheus PostgreSQL exporter]({{< ref "/tutorials/postgresql/exporter-deployment" >}})

1. Deploy charts with helm

```bash
# RDS alerts
helm install prometheus-rds-alerts-chart oci://public.ecr.aws/qonto/prometheus-rds-alerts-chart:{{% current_version %}} --namespace ${KUBERNETES_NAMESPACE}
helm install prometheus-rds-alerts-chart oci://public.ecr.aws/qonto/prometheus-rds-alerts-chart \
--version {{% current_version %}} \
--namespace monitoring
```

```bash
# PostgreSQL alerts
helm install prometheus-postgresql-alerts-chart oci://public.ecr.aws/qonto/prometheus-postgresql-alerts-chart:{{% current_version %}} --namespace ${KUBERNETES_NAMESPACE}
helm install prometheus-postgresql-alerts-chart oci://public.ecr.aws/qonto/prometheus-postgresql-alerts-chart \
--version {{% current_version %}} \
--namespace monitoring
```

1. Connect to Prometheus to check that the rules are correctly loaded (`https://<your_prometheus_url>/rules`)

{{< /tab >}}
{{< tab "Prometheus standalone server" >}}

Requirements

- [Helm](https://helm.sh/docs/intro/install/)

- [Prometheus server](https://prometheus.io/docs/prometheus/latest/installation/)

Steps

1. Deploy [Prometheus RDS exporter]({{< ref "/tutorials/rds/exporter-deployment" >}}) and/or [Prometheus PostgreSQL exporter]({{< ref "/tutorials/postgresql/exporter-deployment" >}})

1. Generate Prometheus rule configuration files

```bash
# Generate RDS rules in /etc/prometheus/rds.rules.yaml
helm template oci://public.ecr.aws/qonto/prometheus-rds-alerts-chart \
--version {{% current_version %}} \
--set format=PrometheusConfigurationFile \
> /etc/prometheus/rds.rules.yaml
```

```bash
# Generate PostgreSQL rules in /etc/prometheus/postgresql.rules.yaml
helm template oci://public.ecr.aws/qonto/prometheus-postgresql-alerts-chart \
--version {{% current_version %}} \
--set format=PrometheusConfigurationFile \
> /etc/postgresql.rules.yaml
```

1. Add files to the `rule_files` parameter in the Prometheus configuration file

```yaml
rule_files:
- /etc/prometheus/rds.rules.yaml
- /etc/prometheus/postgresql.rules.yaml
```

1. Reload Prometheus configuration

1. Connect to Prometheus to check that the rules are correctly loaded (`https://<your_prometheus_url>/rules`)

{{< /tab >}}
{{< /tabs >}}

## Charts

Prometheus alerts are available as Helm chart:
Expand Down

0 comments on commit 7095954

Please sign in to comment.