Introduction
The Scalyr Agent collects system metrics once per minute by default. This won't affect your overall log volume, however, you may wish to modify the sampling interval. This article explains how to modify the Agent configuration for a variety (Linux, k8s, and Windows) of Agent evnironments.
Linux Agent
Set the sampling rate to once every 5 minutes (300 seconds):
implicit_metric_monitor: false, // disable metric collection
"monitors": [
{
// explicitly enable metric collection with defined interval
"module": "scalyr_agent.builtin_monitors.linux_system_metrics",
"sample_interval": 300
}
]
Windows Agent
Set the Windows system and process metrics sampling rate to 10 minutes
Note: $$
is a special value that defaults to the Agent process pid
. This is used when monitoring the Agent process.
{
api_key: "XXXXXX",
implicit_metric_monitor: false
server_attributes: {
serverHost: "localhost"
}
...
...
monitors: [
{
module: "scalyr_agent.builtin_monitors.windows_process_metrics",
pid : "$$",
sample_interval: 600
},
{
module: "scalyr_agent.builtin_monitors.windows_system_metrics",
sample_interval: 600
}
]
}
K8s Agent
ConfigMap
You can set annotations via the scalyr-config ConfigMap. This example references the default ConfigMap which is implemented during the K8s Agent installation process.
apiVersion: v1
kind: ConfigMap
data:
SCALYR_K8S_CLUSTER_NAME: <your_cluster_name>
...
SCALYR_GLOBAL_MONITOR_SAMPLE_INTERVAL: "600"
metadata:
name: scalyr-config
namespace: scalyr
...
docker.json
The sample_interval
parameter within the docker.json configuration file can be set directly:
docker.json: |+
{
"monitors":[
{
"module": "scalyr_agent.builtin_monitors.kubernetes_monitor",
"sample_interval": 600
}
]
}
Docker Agent
Environment Variable
Similar to the K8s Agent example above, the SCALYR_GLOBAL_MONITOR_SAMPLE_INTERVAL
parameter can be passed as an environment variable via the docker run
command. For example:
docker run -d --name scalyr-docker-agent -e SCALYR_API_KEY=... -e SCALYR_GLOBAL_MONITOR_SAMPLE_INTERVAL=300 -v /var/run/docker.sock:/var/scalyr/docker.sock -v /var/lib/docker/containers:/var/lib/docker/container
s -p 601:601 scalyr/scalyr-agent-docker-json
docker.json
The /etc/scalyr-agent-2/agent.d/docker.json configuration file can be modified and stored within the Docker Agent container:
{
monitors: [
{
"module": "scalyr_agent.builtin_monitors.docker_monitor",
"sample_interval": 120
}
]
}
Comments
0 comments
Please sign in to leave a comment.