Actions72
- Image Actions
- Network Actions
- Node Actions
- Registry Actions
- Secret Actions
- Service Actions
- Stack Actions
- Team Actions
- Template Actions
- User Actions
- Volume Actions
- Webhook Actions
- Config Actions
- Container Actions
- Edge Group Actions
- Edge Stack Actions
Overview
This node integrates with the Portainer API to manage Docker environments, specifically allowing users to retrieve real-time usage statistics of a Docker container. The "Container: Get Stats" operation fetches detailed performance metrics such as CPU, memory, network, and block I/O statistics for a specified container within a given environment.
This functionality is beneficial in scenarios where monitoring container resource consumption is critical, such as:
- Tracking container health and performance in production.
- Automating alerts or scaling decisions based on resource usage.
- Debugging performance issues by analyzing container stats over time.
For example, a DevOps engineer can use this node to periodically collect container stats and feed them into a monitoring dashboard or trigger workflows when resource thresholds are exceeded.
Properties
| Name | Meaning |
|---|---|
| Environment ID | The ID of the Portainer environment/endpoint where the container is running. |
| Container ID | The unique identifier of the Docker container for which to retrieve statistics. |
Output
The node outputs JSON data containing the container's usage statistics as returned by the Portainer API. This typically includes:
- CPU usage details
- Memory usage and limits
- Network I/O statistics
- Block I/O statistics
- Other runtime metrics related to container performance
No binary data output is involved in this operation.
Dependencies
- Requires an active Portainer API endpoint accessible via the configured base URL.
- Requires an API key credential for authentication with the Portainer API.
- The node uses HTTP GET requests to the Portainer API endpoint
/endpoints/{environmentId}/docker/containers/{containerId}/statswith streaming disabled (stream=false).
Troubleshooting
- Invalid Environment or Container ID: If the provided environment or container ID does not exist or is incorrect, the API will return an error. Verify that the IDs are correct and correspond to existing resources in Portainer.
- Authentication Errors: Ensure the API key credential is valid and has sufficient permissions to access container stats.
- Network Issues: Connectivity problems between n8n and the Portainer server may cause request failures. Check network accessibility and firewall settings.
- API Rate Limits or Timeouts: Large or busy containers might cause delays; ensure the API server can handle the request load.
Common error messages usually come directly from the Portainer API and should be interpreted accordingly (e.g., 404 Not Found for invalid IDs, 401 Unauthorized for auth issues).
Links and References
- Portainer API Documentation - Containers
- Docker Remote API - Container Stats (Portainer proxies Docker API calls)