InterspaceБаза знанияТехнически статииНаучетеРазширен мониторинг на Linux система с Glances
НАУЧЕТЕ
11-Дек-202001-Фев-2023
Разширен мониторинг на Linux система с Glances
Това съдържание е налично само на английски.
Glances stands out as an all-encompassing monitoring tool, offering a snapshot of vital system metrics in real-time. Compatible with a broad range of Linux distributions, including both Debian and Red Hat-based systems, Glances delivers in-depth visibility into CPU, memory, disk I/O, and network statistics, among others.

1.Installation

1.1.Debian-based Systems

Glances is easily installed on Debian-based systems like Ubuntu or Debian. Use the APT package manager to handle the installation and manage all necessary dependencies.
sudo apt update && sudo apt install glances

1.2.Red Hat-based Systems

Installing Glances on Fedora, CentOS, and other Red Hat-related distributions typically involves using the DNF package manager, as CentOS 8 and Fedora have moved to DNF for package management. However, for CentOS 7 and earlier versions, YUM is still in use.

To ensure compatibility and access to Glances on CentOS 8, you might need to enable the EPEL (Extra Packages for Enterprise Linux) repository first, as Glances may not be available in the default repositories.
For CentOS 8 and Fedora (using DNF)
First, enable the EPEL repository to access additional packages: sudo dnf install epel-release

Then, install Glances: sudo dnf install glances
For CentOS 7 and earlier versions (using YUM)
On CentOS 7, the EPEL repository can also provide access to Glances. Enable EPEL and install Glances as follows: sudo yum install epel-release

Followed by: sudo yum install glances -y

2.Launching Glances

Starting Glances is straightforward with the following single command.
glances

This opens the Glances interface, offering a real-time overview of your system’s health and performance.

3.Monitoring System Resources

3.1.CPU Usage

Glances offers detailed insights into CPU usage, clarifying how resources are distributed among processes. This information is crucial for maintaining optimal system performance. Tips:

  • Encountering high CPU usage can slow down your system. Use Glances to identify the top CPU-consuming processes. Once identified, consider optimizing the process’s code for efficiency or offloading some tasks to less busy times to prevent bottlenecks.
  • Regular monitoring with Glances can help establish a baseline for normal CPU usage. When usage deviates significantly from this baseline, investigate background services or scheduled tasks that could be causing spikes. Adjusting their priorities or scheduling might mitigate the impact on critical operations.

3.2.Memory and Swap Utilization

Glances provides essential information on memory and swap usage, highlighting when resources are stretched thin. Tips:

  • If Glances shows your system frequently uses swap, this might indicate your RAM is insufficient for your workload. Before adding more RAM, review running applications to identify any that are using more memory than expected. Sometimes, configuring memory usage limits for certain applications can alleviate the need for immediate hardware upgrades.
  • Analyzing swap usage trends with Glances can guide effective memory management strategies. For example, if swap usage peaks during specific operations, you might need to schedule these operations during off-peak hours or optimize them to reduce their memory footprint.

3.3.Disk I/O Performance

Monitoring disk I/O with Glances helps identify storage performance issues, crucial for applications that rely heavily on disk access. Tips:

  • Persistent high disk usage signals it's time to investigate. Start by using Glances to identify which processes are writing to or reading from the disk most frequently. You may discover logging verbosity can be reduced, or that it's time to partition data across multiple storage solutions to distribute the load more evenly.
  • Glances can point to abnormal disk activity patterns. If you notice sudden changes in disk activity that don't align with expected usage, consider checking for unnecessary file operations or optimizing database queries to reduce disk strain.

3.4.Network Throughput

Glances keeps an eye on network throughput, a vital aspect for troubleshooting network issues and ensuring adequate bandwidth. Tips:

  • An unexpected increase in network traffic might indicate a problem. Use Glances to drill down into per-application network usage. This can help identify if a specific service is consuming too much bandwidth, possibly due to a misconfiguration or an ongoing attack, such as a DDoS. Implementing rate limiting on the application or using network traffic management tools can mitigate the issue.
  • After making network configuration changes, use Glances to observe the effects in real-time. This immediate feedback can be invaluable for adjusting settings to achieve desired throughput levels, ensuring your network can handle both everyday tasks and peak loads efficiently.

4.Web Mode

Glances can easily be accessed remotely in web mode, simply by running the command:
glances -w

To access your system's monitoring dashboard open http://your_server_ip:61208 in a web browser.

Remote monitoring via web mode is particularly useful for teams. It simplifies sharing system health data and accelerates collaborative troubleshooting.

For secure access, especially over the internet, consider using an SSH tunnel or a VPN to connect to the Glances web interface.
Съдържанието на този документ е лицензирано от Interspace под MIT License

Свързано съдържание
Документация
Облак
Комуникации
Хостинг
My Interspace
Технически статии
Уроци
Научете
Новини
Последни новини
Последни събития
Свързани продукти
Еластичен Облачен VPS
Elastic Cloud VPS е виртуална машина, захранвана от съвременни облачни и мрежови технологии, предлагаща значителни предимства пред традиционния VPS хостинг на непобедимо съотношение цена-производителност. Инсталирайте ОС и приложения само за 1 мин. Добавяйте или премахвайте функции динамично. Автоматични архиви, моментни копия и копие за възстановяване при бедствия с едно кликване, съхранявани в отдалечен дейта център на безопасно разстояние. Ново поколение AMD EPYC процесори, ултра бързи NVMe дискове, выделени връзки и безплатна частна мрежа.
Премиум Интернет Достъп
Интернет достъп от най-висок клас за професионални нужди. Супериорна оптична връзка от точка до точка, симетрична скорост на сваляне/качване, неограничен трафик, SLA 99.9% и статичен IP. Директни връзки с водещите световни tier 1 доставчици. Нашата мрежова архитектура е проектирана с внимание към всеки детайл, за да осигури връзки с най-високо качество към всяка точка по света, с ненадминати скорости на трансфер и многостепенна резервираност.
Наети Сървъри
Выделени сървъри с висококачествен хардуер от утвърдени производители на сървъри. Те са хоствани в нашите собствени дейта центрове, което ни позволява пълен контрол при осигуряване на работоспособността 24/7. Избор от основни дейта центрове и дейта център за възстановяване при бедствия, разположен на безопасно разстояние. Опции за контрол на захранването (рестарт, изключване/включване) и безплатен KVM-over-IP достъпен 24/7 с едно кликване, включително поддръжка за отдалечено зареждане/инсталиране на ваши собствени ISO образи.


Нашият уебсайт използва бисквитки. Като продължавате да използвате нашия уебсайт, вие се съгласявате с използването на бисквитки и приемате нашите Общи условия. Разбирам