Glances linux что это

Glances – An Advanced Real Time System Monitoring Tool for Linux

Earlier, we’ve written about many Linux System Monitor Tools that can be used to monitor performance of Linux systems, but we think that, most users prefer the default one that comes with every Linux distributions (top command).

The top command is real time task manager in Linux and the most frequently used system monitoring tool in GNU/Linux distributions to find the performance related bottlenecks in system which help us to take corrective actions. It has a nice minimalist interface, comes with few amount of reasonable options that enables us to get a better idea about overall system performance quickly.

However, sometimes its very tricky to find an application/process that consuming lots of system resources is a bit difficult under top. Because top command doesn’t have a ability to highlights programs that are eating too much of CPU, RAM, other resources.

For keeping such approach, here we are bringing a powerful system monitor program called “Glances” that automatically highlights programs that are utilizing highest system resources and providing maximum of information about Linux/Unix server.

What is Glances?

Glances is a cross-platform command-line curses-based system monitoring tool written in Python language which use the psutil library to grab informations from the system. With Glance, we can monitor CPU, Load Average, Memory, Network Interfaces, Disk I/O, Processes and File System spaces utilization.

Glances is a free tool and licensed under GPL to monitory GNU/Linux and FreeBSD operating systems. There are lots of interesting options available in Glances as well. One of the main features we have seen in Glances is that we can set thresholds (careful, warning and critical) in configuration file and informations will be shown in colors which indicates the bottleneck in the system.

Glances Features

  1. CPU Informations (user related applications, system core programs and idle programs.
  2. Total memory Information including RAM, Swap, Free memory etc.
  3. The average CPU load for the past 1min, 5mins and 15 mins.
  4. Network Download/Upload rates of network connections.
  5. Total number of processes, active ones, sleeping processes etc.
  6. Disk I/O related (read or write) speed details
  7. Currently mounted devices disk usages.
  8. Top processes with their CPU/Memory usages, Names and location of application.
  9. Shows the current date and time at bottom.
  10. Highlights processes in Red that consumes highest system resources.
Читайте также:  Зашифровать архив zip linux

Here is an example screen grab of Glances.

Install Glances Monitoring in Centos

Installation of Glances in Linux/Unix Systems

Although it’s a very young utility, you can install “Glances” in Red Hat based systems by turning on EPEL repository and then run the following command on the terminal.

On RHEL/CentOS/Fedora
On Debian/Ubuntu/Linux Mint
$ sudo apt-add-repository ppa:arnaud-hartmann/glances-stable $ sudo apt-get update $ sudo apt-get install glances

Usage of Glances

To start, issue the basic syntax on the terminal.

Install Glances in Ubuntu

Press ‘q‘ or (‘ESC‘ or ‘Ctrl&C‘ also works) to quit from Glances terminal. Here, is the another screen grab taken from the CentOS 6.5 system.

Glances Monitoring Linux

By default, interval time is set to ‘1‘ second. But you can define the custom interval time while running glances from the terminal.

Glances Color Codes

Meaning of Glances color code:

  1. GREEN : OK (everything is fine)
  2. BLUE : CAREFUL (need attention)
  3. VIOLET : WARNING (alert)
  4. RED : CRITICAL (critical)

We can set thresholds in configuration file. By default thresholds set is (careful=50, warning=70 and critical=90), we can customized as per our needs. The default configuration file is located at ‘/etc/glances/glances.conf’.

Glances Options

Besides, several command line options, glances provides many more hot keys to find output information while glances is running. Below are the list of several hot keys.

  1. a – Sort processes automatically
  2. c – Sort processes by CPU%
  3. m – Sort processes by MEM%
  4. p – Sort processes by name
  5. i – Sort processes by I/O rate
  6. d – Show/hide disk I/O stats ols
  7. f – Show/hide file system statshddtemp
  8. n – Show/hide network stats
  9. s – Show/hide sensors stats
  10. y – Show/hide hddtemp stats
  11. l – Show/hide logs
  12. b – Bytes or bits for network I/Oools
  13. w – Delete warning logs
  14. x – Delete warning and critical logs
  15. x – Delete warning and critical logs
  16. 1 – Global CPU or per-CPU stats
  17. h – Show/hide this help screen
  18. t – View network I/O as combination
  19. u – View cumulative network I/O
  20. q – Quit (Esc and Ctrl-C also work)

Use Glances on Remote Systems

With the Glances, you can even monitor remote systems too. To use ‘glances‘ on remote systems, run the ‘glances -s‘ (-s enables server/client mode) command on the server.

# glances -s Define the password for the Glances server Password: Password (confirm): Glances server is running on 0.0.0.0:61209

Note : Once, you issue ‘glances‘ command, it will prompt you to define the password for the Glances server. Define the password and hit enter, you see glances running on port 61209.

Now, go to the remote host and execute the following command to connect to a Glances server by specifying IP address or hostname as shown below. Here ‘172.16.27.56‘ is my glances server IP Address.

Below are few notable points that user must know while using glances in server/client mode.

* In server mode, you can set the bind address -B ADDRESS and listening TCP port -p PORT. * In client mode, you can set the TCP port of the server -p PORT. * Default binding address is 0.0.0.0, but it listens on all network interfaces at port 61209. * In server/client mode, limits are set by the server side. * You can also define a password to access to the server -P password.

Conclusion

Glances is a much resources friendly tool for most users. But if you’re a system administrator who’d like to quickly get overall “idea” about systems by just glancing at command line, then this tool will be must have tool for system administrators.

Читайте также:  Linux ubuntu как поменять

Источник

Glances linux что это

Glances is a cross-platform system monitoring tool written in Python.

Features

  • CPU
  • Memory
  • Load
  • Process list
  • Network interface
  • Disk I/O
  • IRQ / Raid
  • Sensors
  • Filesystem (and folders)
  • Docker
  • Monitor
  • Alert
  • System info
  • Uptime
  • Quicklook (CPU, MEM, LOAD)

Cross-platform

API

Glances includes a XML-RPC server and a RESTful JSON API which can be used by another client software.

Web UI

Export

Export all system statistics to CSV, InfluxDB, Cassandra, OpenTSDB, StatsD, ElasticSearch or even RabbitMQ. Glances also provides a dedicated Grafana dashboard.

Get started

Glances Auto Install script

To install the latest Glances production ready version, just enter the following command line:

$ curl -L https://bit.ly/glances | /bin/bash
$ wget -O- https://bit.ly/glances | /bin/bash

Note: Only supported on some GNU/Linux distributions.

PyPI: The simple way

Glances is on PyPI. By using PyPI, you are sure to have the latest stable version.

To install, simply use pip:

Community

Get help from others users or from the Glances developers and stay in touch with us. But never forget : always RTFM!

Chat for developers

Users’ mailing list

Twitter

Documentation

You want more informations or contribute to the Glances project ? Look at our user manual and the development wiki.

Источник

Мощный мониторинг за пять минут с помощью Glances

Допустим, что у нас не очень обширная инфраструктура: несколько небольших VPSок, подкроватник, NAS и два ноутбука, торчащих в сеть. Тем не менее, за ней всё равно надо приглядывать, и заниматься этим вручную раздражает всё больше с каждой новой машиной. Я стал искать систему мониторинга, которая могла бы не съедая лишних ресурсов агрегировать информацию отовсюду в единый дашборд, желательно без геморроя с настройкой. В итоге, как только десятки мелких консольных утилит были отброшены вместе с чрезмерно усложнёнными корпоративными хреновинами вроде Prometheus и RabbitMQ, поиск быстро привёл меня к Glances — утилите, берущей лучшее от обоих миров.

Glances — довольно старый консольный инструмент мониторинга на Python, который на Хабре незаслуженно обошли вниманием. Первые релизы вышли в 2014 году, а самый свежий появился 23 января. У проекта почти 18к звёзд на Github, больше сотни контрибьюторов и тысячи форков.

Список отслеживаемых данных:

  • Нагрузка на CPU, информация и температура
  • Загруженность памяти (RAM, swap)
  • Средняя загруженность
  • Список и количество процессов
  • Использование сетевых интерфейсов
  • Операции с диском
  • Состояние IRQ и RAID
  • Большинство доступных датчиков
  • Свободное место на диске и распределение по разделам/папкам
  • Список контейнеров, их потребление и процессы
  • Аптайм, алёрты и другие мелочи
Читайте также:  Linux имена файлов ntfs

Вся нужная информация доступна буквально по одной команде:

Но пока это лишь консольная утилита, а нам нужно гораздо больше. Вся мощь Glances раскрывается в его огромном количестве интеграций и выходных форматов. Во-первых, из коробки он умеет выводить информацию в веб-версию и XML-RPC/RESTful API. То есть поставив его на все машины и скинув вывод из всех эндпойнтов на один сервер, можно уже добиться желаемого. Но консольный вывод с десятка устройств читать неудобно ни в каком виде, а уж тем более пытаться уместить его на одном экране, поэтому смотрим интеграции:

  • Cassandra/Scylla
  • CouchDB
  • Elasticsearch
  • InfluxDB
  • Kafka
  • MQTT
  • OpenTSDB
  • Prometheus
  • Riemann
  • StatsD
  • ZeroMQ

Установка и настройка

Вариантов установки много, но стабильнее всего работает установка через PyPI:

Можно сразу доустановить дополнительные модули:

 pip install 'glances[action,browser,cloud,cpuinfo,docker,export,folders,gpu,graph,ip,raid,snmp,web,wifi]' 

Полный список установок InfluxDB здесь, стандартный вариант для Ubuntu/Debian x64:

 wget https://dl.influxdata.com/influxdb/releases/influxdb2-2.0.4-amd64.deb sudo dpkg -i influxdb2-2.0.4-amd64.deb 

Создаём базу glances с любым пользователем и передаём данные в конфиг Glances следующего вида:

 # glances.conf [influxdb] host=localhost port=8086 protocol=http user=admin password=foobar db=glances prefix=localhost 

Затем запускаем утилиту с экпортом данных в InfluxDB и использованием конфига, где к ней указан доступ:

 glances --export influxdb -С glances.conf 

Почти готово, осталось открыть InfluxDB для доступа извне:

 # /etc/influxdb/influxdb.conf [http] enabled = true bind-address = ":8086" auth-enabled = true log-enabled = true write-tracing = false pprof-enabled = true pprof-auth-enabled = true debug-pprof-enabled = false ping-auth-enabled = true # по хорошему нужно включить https, но я не заморачивался :) # https-enabled = true # https-certificate = "/etc/ssl/influxdb.pem" 

Все операции выше повторяем на отслеживаемых машинах, затем на агрегирующем сервере ставим графану:

 wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add - echo "deb https://packages.grafana.com/oss/deb stable main" | sudo tee -a /etc/apt/sources.list.d/grafana.list sudo apt-get update sudo apt-get install grafana sudo systemctl daemon-reload sudo systemctl start grafana-server sudo systemctl status grafana-server 

Открываем интерфейс на 3000 порту, логинимся и добавляем наши удалённые источники данных (Configuration > Data sources > Add data source > InfluxDB):

Импортируем его в графану (+ > Import) и настраиваем под себя, повторяем для всех машин. Готово! Теперь в одном интерфейсе мы можем подробно рассмотреть все метрики (как на КДПВ), а ключевые, вроде нагрузки на CPU, можно собрать на одном общем дашборде.

Заключение

Раньше я думал, что настраивать удалённый мониторинг на несколько машин это жуткий геморрой (или можно отдать всю работу готовым сервисам, но с большей нагрузкой и без гибкой подстройки), а оказывается нужно было просто найти подходящий инструмент. Конечно, при желании можно забить на графики и смотреть консольный вывод или обрабатывать API по-своему. Мне нравится такая вариативность.

На правах рекламы

Эпично! Виртуальные серверы на базе новейших процессоров AMD EPYC, которые подойдут не только для мониторинга, но и для размещения проектов любой сложности, от корпоративных сетей и игровых проектов до лендингов и VPN.

Источник

Оцените статью
Adblock
detector