The Memcached integration primarily collects cache-usage metrics, such as the number of items in a cache, the number of evictions, and the number of bytes stored. It also collects general performance metrics for CPU usage and network throughput.
For more information on Memcached, see memcached.org.
Prerequisites
To collect and ingest Memcached logs and metrics, you must install Ops Agent version 2.8.0 or higher.
This receiver supports Memcached version 1.6.
Configure the Ops Agent for Memcached
Following the guide for Configuring the Ops Agent, add the required elements to collect logs and metrics from your Memcached instances, and restart the agent.
Example configuration
The following command creates the configuration file to collect and ingest logs and metrics for Memcached and restarts the Ops Agent on Linux.
sudo tee /etc/google-cloud-ops-agent/config.yaml > /dev/null << EOF
metrics:
receivers:
memcached:
type: memcached
service:
pipelines:
memcached:
receivers:
- memcached
EOF
sudo service google-cloud-ops-agent restart
Configure metrics collection
To collect metrics from Memcached, you must create a receiver for Memcached metrics and then create a pipeline for the new receiver. To configure a receiver for your Memcached metrics, specify the following fields:
Field | Default | Description |
---|---|---|
type |
The value must be memcached . |
|
endpoint |
localhost:3306 |
The URL, or Unix socket file path, for your Memcached server. |
collection_interval |
60s |
A time.Duration value, such as 30s or 5m . |
What is monitored
The following table provides the list of metrics that the Ops Agent collects from the Memcached instance.
Metric type | |
---|---|
Kind, Type Monitored resources |
Labels |
workload.googleapis.com/memcached.bytes
|
|
GAUGE , INT64 gce_instance |
|
workload.googleapis.com/memcached.commands
|
|
CUMULATIVE , INT64 gce_instance |
command
|
workload.googleapis.com/memcached.connections.current
|
|
GAUGE , INT64 gce_instance |
|
workload.googleapis.com/memcached.connections.total
|
|
CUMULATIVE , INT64 gce_instance |
|
workload.googleapis.com/memcached.cpu.usage
|
|
CUMULATIVE , DOUBLE gce_instance |
state
|
workload.googleapis.com/memcached.current_items
|
|
GAUGE , INT64 gce_instance |
|
workload.googleapis.com/memcached.evictions
|
|
CUMULATIVE , INT64 gce_instance |
|
workload.googleapis.com/memcached.network
|
|
CUMULATIVE , INT64 gce_instance |
direction
|
workload.googleapis.com/memcached.operations
|
|
CUMULATIVE , INT64 gce_instance |
operation
type
|
workload.googleapis.com/memcached.threads
|
|
GAUGE , INT64 gce_instance |
Collect logs
Memcached writes logs to syslog
, which is captured by Ops Agent by default.
No additional user configuration is required.
Sample dashboard
You can view the metrics from this integration using a sample Cloud Monitoring dashboard. Complete the Installing sample dashboards procedures to import the Memcached GCE Overview dashboard from the Sample library and view charts that display your Memcached metrics.Verify the ingestion
To verify the logs are ingested, go to the Logs Explorer
and run the following query to view the Memcached logs, replacing
systemd-memcached-wrapper
with your system unit name for Memcached if needed:
resource.type="gce_instance"
logName="projects/PROJECT_ID/logs/syslog"
systemd-memcached-wrapper
You can use the Metrics Explorer to verify that you correctly configured the Memcached receiver. It might take one or two minutes for the Ops Agent to begin collecting metrics.
To verify the metrics are ingested, go to
Metrics Explorer
and run the following query in the MQL tab.
fetch gce_instance
| metric 'workload.googleapis.com/memcached.commands'
| align rate(1m)
| every 1m