• EnglishEspañol日本語한국어Português
  • Log inStart now

Collector for Squid

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).

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 list
acl localnet src 192.168.0.0/16
# We would allow that ip range to access the manager by setting this directive
http_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:
otlphttp:
endpoint: https://otlp.nr-data.net
headers:
api-key: NEW_RELIC_LICENSE_KEY
processors:
batch:
memory_limiter:
limit_mib: 400
spike_limit_mib: 100
check_interval: 5s
service:
telemetry:
logs:
pipelines:
metrics:
receivers: [prometheus]
processors: [batch, memory_limiter]
exporters: [otlphttp]

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:

Troubleshooting

Problem

Metric names don't match.

Solution

Squids dashboards and entities use Prometheus metrics naming conventions to match the metrics being reported by Squid's Prometheus exporter. However, the OpenTelemetry Prometheus receiver uses OpenTelemetry naming conventions by default after v076.3.

To use Prometheus metrics naming conventions, disable the pkg.translator.prometheus.NormalizeName feature-gate when running the OpenTelemetry collector:

bash
$
otelcol-contrib --config ./config.yaml --feature-gates=-pkg.translator.prometheus.NormalizeName
Copyright © 2024 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.