Portainer icon

Portainer

Trabalhe com dados da API do Portainer para gerenciar Docker

Overview

This node integrates with the Portainer API to manage Docker environments, specifically allowing users to retrieve container usage statistics. The "Container: Get Stats" operation fetches real-time resource usage metrics for a specified Docker container within a given environment.

Common scenarios where this node is beneficial include monitoring container performance, automating alerts based on resource consumption, and integrating container stats into dashboards or reports. For example, a DevOps engineer might use this node to periodically collect CPU and memory usage of critical containers to ensure they are operating within expected parameters.

Properties

Name Meaning
Environment ID The ID of the Portainer environment/endpoint where the container is running (e.g., "1").
Container ID The unique identifier of the Docker container whose statistics you want to retrieve.

Output

The node outputs JSON data containing detailed statistics about the specified container's resource usage. This typically includes metrics such as CPU usage, memory consumption, network I/O, and block I/O. The data structure corresponds to the response from the Portainer/Docker API endpoint for container stats.

No binary data output is involved in this operation.

Dependencies

  • Requires an active connection to a Portainer instance with API access.
  • Needs an API key credential configured in n8n to authenticate requests to the Portainer API.
  • The Portainer environment ID and container ID must be valid and accessible by the authenticated user.

Troubleshooting

  • Invalid Environment or Container ID: If the provided IDs do not exist or the user lacks permission, the API will return errors. Verify that the environment and container IDs are correct and accessible.
  • Authentication Errors: Ensure the API key credential is correctly set up and has sufficient permissions.
  • Network Issues: Connectivity problems between n8n and the Portainer server can cause request failures.
  • Empty or Unexpected Data: If the container is stopped or does not produce stats, the output may be empty or incomplete.

To resolve these issues, double-check credentials, verify IDs, and confirm network connectivity.

Links and References

Discussion