Skip to content

Commit

Permalink
Merge development to main for 4.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Yogesh Sharma committed Jul 30, 2020
1 parent 9b18f16 commit c45f65c
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
25 changes: 24 additions & 1 deletion hugo/content/exporter/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ The following RPM packages are available to [Crunchy Data](https://www.crunchyda
| pgmonitor-node_exporter-extras | Crunchy optimized configurations for node_exporter |
| pg_bloat_check | Package for pg_bloat_check script |
| pgbouncer_fdw | Package for the pgbouncer_fdw extension |
| blackbox_exporter | Package for the blackbox_exporter |

### Non-RPM installs

Expand All @@ -48,6 +49,7 @@ For non-package installations on Linux, applications can be downloaded from thei
| postgres_exporter | https://github.com/wrouesnel/postgres_exporter/releases |
| pg_bloat_check | https://github.com/keithf4/pg_bloat_check |
| pgbouncer_fdw | https://github.com/CrunchyData/pgbouncer_fdw |
| blackbox_exporter | https://github.com/prometheus/blackbox_exporter |

#### User and Configuration Directory Installation

Expand All @@ -63,6 +65,8 @@ All executables installed via the above releases are expected to be in the `/usr

https://github.com/lest/prometheus-rpm/tree/master/node_exporter

A base blackbox_exporter systemd file is also expected to be in place. No examples are currently available.

The files contained in this repository are assumed to be installed in the following locations with the following names. In the instructions below, you should replace a double-hash (`##`) with the two-digit major version of PostgreSQL you are running (ex: 95, 96, 10, etc.).

##### node_exporter
Expand Down Expand Up @@ -94,6 +98,15 @@ The following pgMonitor configuration files should be placed according to the fo
| postgres/queries_*.yml | `/etc/postgres_exporter/##/queries_*.yml` |
| postgres/pgbackrest-info.sh | `/usr/bin/pgbackrest-info.sh` |

##### blackbox_exporter

The following pgMonitor configuration files should be placed according to the following mapping:

| pgMonitor Configuration File | System Location |
|------------------------------|-----------------|
| blackbox/blackbox_exporter.sysconfig | `/etc/sysconfig/blackbox_exporter` |
| blackbox/crunchy-blackbox.yml| `/etc/blackbox_exporter/crunchy-blackbox.yml` |

### Windows installs

The following Windows Server 2012R2 packages are available to [Crunchy Data](https://www.crunchydata.com) customers. *After installing via these packages, continue reading at the [Windows Server 2012R2](#in-server-2012R2) section.*
Expand Down Expand Up @@ -232,6 +245,10 @@ The `/etc/postgres_exporter/##/crontab.txt` file is meant to be a guide for how

The script requires being run by a database superuser by default since it must be able to run a scan on every table. If you'd like to not run it as a superuser, you will have to create a new role that has read permissions on all tables in all schemas that are to be monitored for bloat. You can then change the user in the connection string option to the script.

##### Blackbox Exporter

The configuration file for the blackbox_exporter provided by pgMonitor (`/etc/blackbox_exporter/crunchy-blackbox.yml`) provides a probe for monitoring any IPv4 TCP port status. The actual target and port being monitored are controlled via the Prometheus target configuration system. Please see the pgMonitor Prometheus documentation for further details. If any additional Blackbox probes are desired, please see the upstream documentation.

##### PGBouncer

In order to monitor pgbouncer with pgMonitor, the pgbouncer_fdw maintained by CrunchyData is required. Please see its repository for full installation instructions. A package for this is available for Crunchy customers.
Expand All @@ -248,6 +265,13 @@ sudo systemctl start node_exporter
sudo systemctl status node_exporter
```

If you've installed the blackbox exporter:
```
sudo systemctl enable blackbox_exporter
sudo systemctl start blackbox_exporter
sudo systemctl status blackbox_exporter
```

To most easily allow the use of multiple postgres exporters, running multiple major versions of PostgreSQL, and to avoid maintaining many similar service files, a systemd template service file is used. The name of the sysconfig EnvironmentFile to be used by the service is passed as the value after the "@" and before ".service" in the service name. The default exporter's sysconfig file is named "postgres_exporter_pg##" and tied to the major version of postgres that it was installed for. A similar EnvironmentFile exists for the per-db service. Be sure to replace the ## in the below commands first!

```bash
Expand All @@ -258,7 +282,6 @@ sudo systemctl status crunchy-postgres-exporter@postgres_exporter_pg##
sudo systemctl enable crunchy-postgres-exporter@postgres_exporter_pg##_per_db
sudo systemctl start crunchy-postgres-exporter@postgres_exporter_pg##_per_db
sudo systemctl status crunchy-postgres-exporter@postgres_exporter_pg##_per_db

```

### Monitoring multiple databases and/or running multiple postgres exporters (RHEL / CentOS 7)
Expand Down
8 changes: 8 additions & 0 deletions hugo/content/prometheus/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,14 @@ The below files dictate how Prometheus and Alertmanager will behave at runtime f
| `/etc/prometheus/alert-ruled.d/crunchy-alert-rules-\*.yml.example` | Update rules as needed and remove `.example` suffix. Prometheus config provided by pgmonitor expects `.yml` files to be located in `/etc/prometheus/alert-rules.d/` |
| `/etc/prometheus/auto.d/*.yml` | You will need at least one file with a final `.yml` extension. Copy the example files to create as many additional targets as needed. Ensure the configuration files you want to use do not end in `.yml.example` but only with `.yml`. Note that in order to use the provided Grafana dashboards, the extra "exp_type" label must be applied to the target and be set appropriately (pg or node). See the example target files provided for how to set the labels for postgres or node exporter targets. |

#### Blackbox Exporter

By default, the Blackbox exporter probes are commented out in the {{ shell }}crunchy-prometheus.yml{{ /shell }} file; please see the notes in that commented out section. For the default IPv4 TCP port targets that pgMonitor configures the blackbox_exporter with, the desired monitoring targets can be configured under the {{ yaml }}static_configs: targets{{ /yaml }} section of the {{ yaml }}blackbox_tcp_services{{ /yaml }} job; some examples for Grafana & Patroni are given there. It is also possible to create another auto-scrape target directory similar to {{ shell }}auto.d{{ /shell }} and manage your blackbox targets more dynamically.

If you configure additional probes beyond the one that pgMonitor comes with, you will need to create a different Prometheus {{ yaml }}job_name{{ /yaml }} for them for the given {{ yaml }}params: module{{ /yaml }} name.

An example rules file for monitoring Blackbox probes, {{ shell }}crunchy-alert-rules-blackbox.yml.example{{ /shell }}, is available in the {{ shell }}alert-rules.d{{ /shell }} folder.

#### Enable Services

To enable and start Prometheus as a service, execute the following commands:
Expand Down

0 comments on commit c45f65c

Please sign in to comment.