Resource monitoring is an essential aspect of managing any system, whether it's a computer system, a network, or a server. By monitoring resources, we can get valuable insights into how our systems are performing, identify potential issues before they become critical problems, and optimize resource usage to improve performance and reduce costs.
Here are some specific reasons why monitoring resources is important:
- Performance optimization — Resource monitoring helps identify performance bottlenecks so that administrators can take corrective action to improve the system's performance. For example, if we notice that CPU usage is consistently high, we might upgrade the hardware or adjust the workload distribution to balance the load more effectively.
- Capacity planning — Resource monitoring provides information on how much capacity is being used, allowing administrators to make informed decisions about when to add more resources to support growing demand. This helps ensure that the system has enough capacity to meet current and future demands.
- Cost control — Resource monitoring helps track resource usage, which can help organizations identify opportunities to reduce costs by optimizing usage and retiring unused resources.
- Security — Monitoring resources can also help detect potential security threats by providing visibility into unusual activity or patterns that may indicate a breach or other unauthorized access.
Overall, resource monitoring is an essential tool for ensuring the optimal performance, scalability, and security of IT systems.
Software for installation
In that article we will use bundle for build that monitoring, alerting and visualize system. MongoDB, Graphana, Prometheus will provide interesting solution for our purposes. Graphana it's system which includes many modules and forms from it visualize system. Very comfortable. Prometheus plays an equally significant role: monitoring, alerting and transporting data. MongoDB it's common data base with save data as main function. Let's have a look for this!
Install and exploit monitoring system
Before using the main utility update and upgrade your system:
For pulling container you need to register on DockerHub, please fill all needed fields and check email for confirmation:
With next step download all requirements and software:
Then we need to login into the account on our server via command below:
You will not see the typing password, but all letters and symbols will be entered! We need to pull all needed container wich have libraries and сompiled system application:
After this we need to build a dependencies between database and monitoring system, let's create configuration file in folder:
Enter in configuration files next parameters:
global:
scrape_interval: 15s # how often to scrape targets by default
evaluation_interval: 15s # how often to evaluate rules by default
scrape_configs:
- job_name: 'mongodb-exporter'
scrape_interval: 5s
static_configs:
- targets: ['mongo-exporter:9216']
In that parameters we have indicated MongoDB and port for communication and export data. Press button combination Ctrl + O for save config and Ctrl + X for exit from text editor. Now run container with our modules:
In output we will see ID for every container in process. Let's check it:
If all process will alright, so we can go ahead and install graphical shell for system via command:
Be patient and wait for the end of the installation all shell and then reboot system via command:
After this server will restart and we will see panel for login, write your credentials and enter:
For our purposes we need to install Firefox browser and wait end of installation:
Run on the Desktop browser for next step:
Go to the HTTP://localhost:3000 in the search bar. That URL open Graphana, type the login and password by the default settings Login:admin and Password:admin. Enter credentials:
Okey, we are in. Go to the tab Administration and choose Add data, then you can enter URL for Prometheus http://localhost:9090:
Click for the button Add data source:
Check the message above this source and we get it! System was installed!
Conclusion
In conclusion, resource monitoring is crucial for the effective management of any system. By tracking resources such as CPU usage, bandwidth, and cost, organizations can optimize the performance of their IT systems and identify potential security threats. In this article, we looked at how to set up a resource monitoring system using tools such as Prometheus, MongoDB and Grafana. By following the instructions in this guide, you can easily install and use these tools to create an effective monitoring, alerting and visualization system for your organization. By installing the right system, you can ensure that your IT infrastructure works smoothly, reliably and with maximum efficiency.