You can collect metrics about your Squid Cache Manager with the OpenTelemetry Collector. The collector is a component of OpenTelemetry that collects, processes, and exports telemetry data to New Relic (or any observability backend).
Tip
If you're looking for help with other collector use cases, see the newrelic-opentelemetry-examples repository.
Complete the steps below to collect metrics from Squid:
Step 1: Sign up for your free account if you haven't already
Step 2: Prerequisites
Allow the host where your Squid Prometheus exporter will be running to access the Squid Cache manager by setting the allowance in the squid.conf
file.
Example in squid.conf
:
# Given this access listacl localnet src 192.168.0.0/16
# We would allow that ip range to access the manager by setting this directivehttp_access allow localnet manager
Install the Squid Prometheus exporter for your Squid Cache Manager and set it up to point to the squid cache manager you want to monitor.
Example exporter execution:
squid-exporter -squid-hostname localhost -squid-port 3128 -listen ":9301" -squid-login admin -squid-password admin
Tip
Squid Prometheus exporter v1.10.4 or higher is required, the latest available version is recommended.
Step 3: Install Opentelemetry collector
Download and install the Opentelemetry collector following Opentelemetry docs.
Step 4: Configure Opentelemetry collector
Create a new file called config.yaml
from the example below.
Replace the following keys in the file with your own values:
- Squid:
SQUID_EXPORTER_HOSTNAME
SQUID_EXPORTER_PORT
SQUID_EXPORTER_METRICS_PATH
SQUID_CACHEMGR
- New Relic License key:
NEW_RELIC_LICENSE_KEY
The label squid_cachemgr: SQUID_CACHEMGR
(where SQUID_CACHEMGR should be a unique identifier) is required in order for the SQUID_CACHEMGR
entity to be created and for the associated dashboards to run.
receivers: prometheus: config: scrape_configs: - job_name: "squid" static_configs: - targets: [ "SQUID_EXPORTER_HOSTNAME:SQUID_EXPORTER_PORT" ] labels: squid_cachemgr: SQUID_CACHEMGR metrics_path: SQUID_EXPORTER_METRICS_PATH metric_relabel_configs: - source_labels: [__name__] regex: "^process_.*" action: drop
exporters: otlp: endpoint: https://otlp.nr-data.net:4317 headers: api-key: NEW_RELIC_LICENSE_KEYprocessors: batch: memory_limiter: limit_mib: 400 spike_limit_mib: 100 check_interval: 5sservice: telemetry: logs: pipelines: metrics: receivers: [prometheus] processors: [batch, memory_limiter] exporters: [otlp]
You may check Opentelemetry Collector docs and Prometheus configuration docs for additional configuration details.
Step 4: Run the collector
Run the Opentelemetry collector (the way to run it may vary depending on the chosen installation method). Example:
/usr/bin/otelcol --config ./config.yaml
Step 5: Find and use your data
Explore your data
You may use the metrics explorer to check the metrics being ingested. All metrics reported by the Squid Prometheus exporter are grouped in a SQUID_CACHEMGR
entity with the name set in SQUID_CACHEMGR
and start with squid_
prefix.
Metric data
These are the two groups of metrics reported by the squid cache manager that are scraped: