Metrics in Gruxi
Gruxi provides built-in metrics for monitoring server performance and health. These metrics can be accessed through the admin portal or integrated with external monitoring tools like Prometheus and Grafana.
Currently, the metrics shown on the admin portal are the same as the ones available in Prometheus, but they are displayed in a more user-friendly way on the admin portal. Going forward, this will likely diverge, with the admin portal showing a curated set of important metrics, while Prometheus will have access to all available metrics for more advanced monitoring and alerting setups.
Telemetry/metrics is disabled by default
By default, telemetry is disabled in Gruxi. This means that no metrics or usage data is collected or sent to any external services. You can enable telemetry in the admin portal if you want to collect metrics data for monitoring and analysis purposes.
To enable, set a bearer security token in the admin portal and then enable telemetry. Once enabled, Gruxi will start collecting metrics data and make it available through the /metrics endpoint for Prometheus scraping.
Telemetry is on port 8001
When telemetry is enabled, the /metrics endpoint is available on port 8001 by default. This is separate from the main admin portal port (8000) to allow for better security and performance isolation. Make sure to configure your firewall and monitoring tools to allow access to port 8001 if you want to collect metrics data.
Prometheus integration
Gruxi exposes a /metrics endpoint that can be scraped by Prometheus to collect metrics data. This allows you to integrate Gruxi with your existing Prometheus monitoring setup and create custom dashboards and alerts based on the collected metrics.
There are a few things to be aware of when integrating with Prometheus:
- The
/metricsendpoint is only available when telemetry is enabled in the admin portal. - The metrics are exposed on port 8001 by default, so make sure to configure your Prometheus scrape configuration to target the correct port.
- The metrics are in the standard Prometheus format, so you can use any Prometheus-compatible tools to visualize and analyze the data.
- By default, the certificates used for the
/metricsendpoint are self-signed, so you need to configure your Prometheus server to trust the certificate or disable TLS verification. See the example below. - Telemetry is only exposed over TLS, such as
https://localhost:8001/metrics, so make sure to use the correct protocol in your Prometheus scrape configuration. - Add the bearer token you set in the admin portal to your Prometheus scrape configuration to authenticate and access the metrics data.
Example Prometheus scrape configuration
scrape_configs:
- job_name: gruxi
scrape_interval: 15s
scheme: https
tls_config:
insecure_skip_verify: true
bearer_token: "330a4838784b324a7ebb962fa6ad5bd7a2c11cc1cf51dead7eaa9c8dac9bbc05"
static_configs:
- targets:
- gruxi.webserver:8001