Set Up Monitoring in Dokploy for Applications and Servers
Table of Contents
- Introduction
- Prerequisites for Monitoring in Dokploy
- Accessing the Monitoring Section
- Configuring Monitoring Settings
- Conclusion
dokploy.com
Introduction
Monitoring is an essential part of the lifecycle of every application or server. It acts as an early warning system, helping teams identify potential issues before they become real problems. This is crucial for maintaining a good user experience by minimizing downtime. In monitoring, we track key performance indicators (KPIs) that are important for the health and stability of our systems.
Dokploy, being a powerful system for deploying and managing applications, offers a comprehensive monitoring suite. It caters to users of all experience levels. For novice users, Dokploy provides an easy setup and configuration process to monitor their servers and applications. For experienced DevOps professionals, Dokploy offers advanced features that can be fine-tuned to meet their specific needs.
In this article, we will cover the main parts of Dokploy's monitoring capabilities.
Prerequisites for Monitoring in Dokploy
Before we can configure monitoring, we have to ensure our apps are properly deployed. To do this we will follow the following process.
Step-by-Step Guide to Verify Server Deployment Status:
- Navigate to Remote Servers:
- In the Dokploy interface, go to the Remote Servers section from the main dashboard. This is where you can manage and configure the servers linked to your account.
- Select Your Server:
- Choose the server you wish to monitor from the list of remote servers. Click on it to access the detailed settings and deployment configuration.
- Check Server Setup:
- Inside the server settings page, verify that the Setup Server section is correctly configured. Dokploy will display various deployment checks to ensure everything is functioning as expected.
- Confirm Green Checkmarks:
- Look for green checkmarks next to each setup section. These indicate that the server is fully configured and ready for monitoring. If any section does not have a green checkmark, it signifies an issue that needs attention before proceeding with monitoring.
Common Issues and Troubleshooting Tips
- Server Not Displaying Green Checkmarks:
- Possible Cause: This may occur if certain required services or configurations were skipped during the deployment process.
- Solution: Review the server setup logs and ensure that all necessary dependencies and services are installed and configured. Restart the setup process if needed, making sure to follow each step carefully.
- Failed Connections or Communication Errors:
- Possible Cause: If the server fails to connect with Dokploy, it could be due to network issues, firewall restrictions, or incorrect port configurations.
- Solution: Ensure that the necessary ports are open (default is port 4500 for metrics collection). Check your server’s firewall settings and verify that Dokploy can establish a connection.
- Incomplete Server Setup:
- Possible Cause: Missing environment variables or incomplete configuration files can lead to incomplete server setups.
- Solution: Double-check environment variable settings and configuration files. Ensure that all required paths, database connections, and API keys are correctly set up.
- Permissions Issues:
- Possible Cause: Sometimes, insufficient permissions can prevent Dokploy from accessing server details.
- Solution: Ensure that your user account has the necessary permissions to access and configure the remote server. If not, update the access permissions accordingly.
Accessing the Monitoring Section
To start using Dokploys powerful monitoring features, it's essential to know where to find them. Here is a step by step process that helps you locate the monitoring section.
Step-by-Step Guide to Access the Monitoring Section:
- Log into the Dokploy Dashboard:
- Begin by logging into your Dokploy account using your credentials. Once you're logged in, you'll be taken to the main dashboard where you can manage your servers, applications, and other resources.
- Navigate to the 'Monitoring' Section:
- On the left sidebar, you'll find a navigation menu with different options for managing your Dokploy resources. Scroll down or look for the Monitoring section in the sidebar.
- Location: The Monitoring option is typically listed beneath the Servers and Applications sections.
- Click on 'Monitoring':
- Once you've located the Monitoring option, click on it to open the monitoring dashboard. This will take you to the page where you can configure, view, and manage all your monitoring settings.
Helpful Tips:
- If you're unable to locate the Monitoring section, double-check that your user account has appropriate permissions to access monitoring features. If permissions are limited, contact your administrator to request access.
- For a smoother experience, you can use the search bar at the top of the dashboard to search for "Monitoring" and be directed straight to the section.
Configuring Monitoring Settings
Now that you've located the monitoring section, let’s dive into the various configuration settings available in Dokploy.
Refresh Rates
In monitoring, the refresh rate refers to the frequency at which the monitoring system collects data on the performance and health of a server or service. Dokploy allows you to set refresh rates for both servers and containers. These fall into the following categories:
Server Refresh Rate:
This setting defines how often server metrics are collected. The default is 20 seconds. Some of the data affected by this setting include CPU usage, memory utilization, disk activity, etc.
Trade-offs when choosing server refresh rates:
- Lower Refresh Rate (e.g., 5 seconds): Captures more accurate data, but increases load on both the server and the monitoring application.
- Higher Refresh Rate (e.g., 60 seconds): Reduces the server load but may miss short-lived performance spikes or fluctuations.
Use Case:
- In a production server, you may want to select a lower refresh rate (e.g., 5 seconds) to capture performance issues quickly.
- For a test server with fewer changes, a higher refresh rate (e.g., 30 or 60 seconds) may be sufficient to reduce the load on the system.
Container Refresh Rate:
This setting defines the frequency at which Dokploy collects metrics from containers. The default is also 20 seconds.
Trade-offs:
- Lower Refresh Rate: Provides more accurate data at the expense of higher resource consumption.
- Higher Refresh Rate: Reduces system load but may miss sharp fluctuations in container performance.
Use Case:
- In high-traffic environments, a lower refresh rate is preferred to capture rapid changes in container metrics.
- For less critical containers, a longer refresh interval (e.g., 30 or 60 seconds) may suffice, keeping resource usage manageable.
Data Management
Data management in monitoring systems refers to the processes and tools used to collect, store, organize, and maintain performance metrics and other data generated by servers, applications, and containers. Effective data management ensures that monitoring is useful, accessible, and organized. Key components of data management include retention policies, data cleanup, and efficient storage practices.
Cron Job
A Cron Job is an automated task that runs at predefined intervals. In Dokploy, it’s used to automate the process of cleaning old metric data, preventing buildup. The cleaning happens according to the retention period settings.
Server Retention Days
This setting determines how long server metrics are stored. By default, it is set to 2 days.
Impact of Retention Days:
- Longer Retention Period: Allows more historical data to be collected, which can be useful for trend analysis.
- Shorter Retention Period: Saves storage space and keeps the monitoring focused on recent activity.
Port
Dokploy uses a designated port, Port 4500, for communication between servers and the monitoring infrastructure. However, this can be reconfigured to suit your specific requirements.
Service Selection
The service selection settings allow you to choose which services to monitor.
Include Services:
Here you can specify which services to monitor. You have the following options:
- All Services: Monitors all services running on your server or container.
- Specific Compose Services: Monitor services from your Docker Compose setup.
- Specific Applications: Choose specific applications you want to monitor.
Exclude Services:
This option lets you specify which services to exclude from monitoring.
Alert Thresholds
CPU Threshold:
This setting defines the CPU usage percentage that triggers an alert. For example, setting the CPU threshold to 75% will trigger an alert when the CPU usage reaches 75%.
Memory Threshold:
This setting defines the memory usage percentage that triggers an alert. Similarly, setting the memory threshold to 75% will trigger an alert when memory usage reaches 75%.
By understanding and configuring these monitoring settings, you can ensure that Dokploy provides the most effective and efficient monitoring experience for your servers and containers.
Security considerations
A key thing that is often overlooked is ensuring that port 4500 is open on your server. This is the port used by dokploy to transmit monitoring metrics. If port 4500 is not open or blocked by a firewall you may run into issues such as:
- "Failed to fetch metrics" — indicating that the front end cannot retrieve data from the backend.
- "No data available" — a generic error suggesting that metrics are not being received or processed properly.
These errors might mislead you into thinking the configuration is broken. To prevent this:
Ensure your cloud provider or hosting environment allows connections on TCP port 4500.
Configure firewall rules or security groups to permit traffic on port 4500.
Optionally restrict access to port 4500 to your specific IP ranges to reduce the chances of attacks.
Integrating Notifications
Ensure you are alerted when it matters by configuring Dokploy notifications. Notifications allow you to receive alerts when metrics reach certain thresholds. How it works:
- Once you have set the CPU and memory thresholds in the monitoring settings, DOkploy continuously checks whether the server metrics pass these thresholds.
- If a threshold is exceeded, metric alerts are triggered and sent only to the notification providers you have provided.
Conclusion
In this article, we have covered the critical aspects related to Dokploy monitoring. By understanding these concepts and configurations, you will be in a position to effectively fine-tune your monitoring settings to optimize performance and reliability.
Happy monitoring!
References
Background References
About the Author
Joseph Horace
Horace is a dedicated software developer with a deep passion for technology and problem-solving. With years of experience in developing robust and scalable applications, Horace specializes in building user-friendly solutions using cutting-edge technologies. His expertise spans across multiple areas of software development, with a focus on delivering high-quality code and seamless user experiences. Horace believes in continuous learning and enjoys sharing insights with the community through contributions and collaborations. When not coding, he enjoys exploring new technologies and staying updated on industry trends.