Set to `true` to enable the [Prometheus](https://prometheus.io/) monitoring service to access [Pantheon metrics](../Using-Pantheon/Debugging.md#monitor-node-performance-using-third-party-clients).
Set to `true` to enable the [metrics exporter](../Using-Pantheon/Debugging.md#monitor-node-performance-using-prometheus).
The default is `false`.
`--metrics-enabled` cannot be specified with `--metrics-push-enabled`. That is, either Prometheus polling or Prometheus
push gateway support can be enabled but not both at once.
### metrics-host
```bash tab="Syntax"
@ -227,8 +230,10 @@ The default is `false`.
metrics-host="127.0.0.1"
```
Specifies the host on which the [Prometheus](https://prometheus.io/) monitoring service accesses Pantheon
metrics. The default is `127.0.0.1`. The metrics server respects the [`--host-whitelist` option](#host-whitelist).
Specifies the host on which [Prometheus](https://prometheus.io/) accesses [Pantheon metrics](../Using-Pantheon/Debugging.md#monitor-node-performance-using-prometheus).
The metrics server respects the [`--host-whitelist` option](#host-whitelist).
The default is `127.0.0.1`.
### metrics-port
@ -244,8 +249,98 @@ metrics. The default is `127.0.0.1`. The metrics server respects the [`--host-wh
metrics-port="6174"
```
Specifies the port on which the [Prometheus](https://prometheus.io/) monitoring service accesses Pantheon
metrics. The default is `9545`. The metrics server respects the [`--host-whitelist` option](#host-whitelist).
Specifies the port on which [Prometheus](https://prometheus.io/) accesses [Pantheon metrics](../Using-Pantheon/Debugging.md#monitor-node-performance-using-prometheus).
The default is `9545`.
### metrics-push-enabled
```bash tab="Syntax"
--metrics-push-enabled[=<true|false>]
```
```bash tab="Example Command Line"
--metrics-push-enabled
```
```bash tab="Example Configuration File"
metrics-push-enabled="true"
```
Set to `true` to start the [push gateway integration](../Using-Pantheon/Debugging.md#running-prometheus-with-pantheon-in-push-mode).
`--metrics-push-enabled` cannot be specified with `--metrics-enabled`. That is, either Prometheus polling or Prometheus
push gateway support can be enabled but not both at once.
### metrics-push-host
```bash tab="Syntax"
--metrics-push-host=<HOST>
```
```bash tab="Example Command Line"
--metrics-push-host=127.0.0.1
```
```bash tab="Example Configuration File"
metrics-push-host="127.0.0.1"
```
Host of the [Prometheus Push Gateway](https://github.com/prometheus/pushgateway).
The default is `127.0.0.1`.
The metrics server respects the [`--host-whitelist` option](#host-whitelist).
!!! note
When pushing metrics, ensure `--metrics-push-host` is set to the machine on which the push gateway is.
Generally, this will be a different machine to the machine on which Pantheon is running.
### metrics-push-interval
```bash tab="Syntax"
--metrics-push-interval=<INTEGER>
```
```bash tab="Example Command Line"
--metrics-push-interval=30
```
```bash tab="Example Configuration File"
metrics-push-interval=30
```
Interval in seconds to push metrics when in `push` mode. The default is 15.
### metrics-push-port
```bash tab="Syntax"
--metrics-push-port=<PORT>
```
```bash tab="Example Command Line"
--metrics-push-port=6174
```
```bash tab="Example Configuration File"
metrics-push-port="6174"
```
Port of the [Prometheus Push Gateway](https://github.com/prometheus/pushgateway).
The default is `9001`.
### metrics-push-prometheus-job
```bash tab="Syntax"
--metrics-prometheus-job=<metricsPrometheusJob>
```
```bash tab="Example Command Line"
--metrics-prometheus-job="my-custom-job"
```
```bash tab="Example Configuration File"
metrics-prometheus-job="my-custom-job"
```
Job name when in `push` mode. The default is `pantheon-client`.
@ -13,26 +13,29 @@ not been automatically converted to smart quotes or that double hyphens have not
You can monitor node performance using the [`debug_metrics`](../Reference/JSON-RPC-API-Methods.md#debug_metrics)
JSON-RPC API method.
## Monitor Node Performance Using Third-Party Clients
## Monitor Node Performance Using Prometheus
Use the [`--metrics-enabled` option](../Reference/Pantheon-CLI-Syntax.md#metrics-enabled) to enable the [Prometheus](https://prometheus.io/) monitoring and
alerting service to access Pantheon metrics. You can also visualize the collected data using [Grafana](https://grafana.com/).
While Prometheus is running, it consumes the Pantheon data directly for monitoring. To specify the host and port on which
Prometheus accesses Pantheon, use the [`--metrics-listen` option](../Reference/Pantheon-CLI-Syntax.md#metrics-listen).
The default host and port are 127.0.0.1:9545.
To specify the host and port on which Prometheus accesses Pantheon, use the [`--metrics-host`](../Reference/Pantheon-CLI-Syntax.md#metrics-host) and
You can install other Prometheus components such as the Alert Manager. Additional configuration
is not required for these components because Prometheus handles and analyzes data directly from the feed.
Here's an example of setting up and running Prometheus with Pantheon:
To use Prometheus with Pantheon, install the [prometheus main component](https://prometheus.io/download/). On MacOS, install with [Homebrew](https://formulae.brew.sh/formula/prometheus):
1. Install the [prometheus main component](https://prometheus.io/download/). On MacOS you can install with [Homebrew](https://brew.sh/):
```bash
brew install prometheus
```
brew install prometheus
```
### Setting up and Running Prometheus with Pantheon
2. Configure Prometheus to poll Pantheon. For example, add the following yaml fragment to the `scrape_configs`
To configure Prometheus and run with Pantheon:
1. Configure Prometheus to poll Pantheon. For example, add the following yaml fragment to the `scrape_configs`
block of the `prometheus.yml` file:
```yml tab="Example"
@ -52,7 +55,7 @@ block of the `prometheus.yml` file:
using [`--host-whitelist`](../Reference/Pantheon-CLI-Syntax.md#host-whitelist) when starting Pantheon.
3. Start Pantheon with the [`--metrics-enabled` option](../Reference/Pantheon-CLI-Syntax.md#metrics-enabled). To start
1. Start Pantheon with the [`--metrics-enabled` option](../Reference/Pantheon-CLI-Syntax.md#metrics-enabled). To start
a single node for testing with metrics enabled:
```bash tab="Example"
@ -60,18 +63,65 @@ block of the `prometheus.yml` file:
1. In another terminal, run Prometheus specifying the `prometheus.yml` file:
```bash tab="Example"
prometheus --config.file=config.yml
```
1. View the Prometheus graphical interface as described in [Setting up and Running Prometheus with Pantheon](#setting-up-and-running-prometheus-with-pantheon).