Glance startup task что это
Перейти к содержимому

Glance startup task что это

  • автор:

Sorry, you have been blocked

This website is using a security service to protect itself from online attacks. The action you just performed triggered the security solution. There are several actions that could trigger this block including submitting a certain word or phrase, a SQL command or malformed data.

What can I do to resolve this?

You can email the site owner to let them know you were blocked. Please include what you were doing when this page came up and the Cloudflare Ray ID found at the bottom of this page.

Cloudflare Ray ID: 80eb25a9f8f34120 • Your IP: Click to reveal 45.84.122.41 • Performance & security by Cloudflare

Glances — An Eye on your system

Prerequisites Docker-CE Docker-Compose create a folder called docker and sub-folder called dashy mkdir -p docker/dashy && cd docker/dashy vim docker-compose.yml 1 2 3 4 5 6 7 8 9 .

Monitor Your Kubernetes with Grafana & Prometheus

Prometheus is a monitoring solution for storing time series data like metrics. Grafana allows to visualize the data stored in Prometheus (and other sources). This sample demonstrates how to capture.

Monitoring WatchTower In Grafana

WatchTower A process for automating Docker container base image updates.\ Prerequisite Docker Prometheus My Prometheus is host in my k3s cluster. Also it is a same way to configur.

glances¶

glances is a cross-platform curses-based monitoring tool which aims to present a maximum of information in a minimum of space, ideally to fit in a classical 80×24 terminal or higher to have additional information. It can adapt dynamically the displayed information depending on the terminal size. It can also work in client/server mode. Remote monitoring could be done via terminal or web interface.

glances is written in Python and uses the psutil library to get information from your system.

OPTIONS¶

Command Reference¶

Command-Line Options¶

show this help message and exit

show program’s version number and exit

enable debug mode

-C CONF_FILE , —config CONF_FILE ¶

path to the configuration file

display modules (plugins & exports) list and exit

disable PLUGIN (comma separated list)

enable PLUGIN (comma separated list)

display stats to stdout (comma separated list of plugins/plugins.attribute)

enable EXPORT module (comma separated list)

file path for CSV exporter

file path for JSON exporter

disable process module (reduce Glances CPU consumption)

disable the Web UI (only the RESTful API will respond)

light mode for Curses UI (disable all but top menu)

task’s CPU usage will be divided by the total number of CPUs

start Glances in per CPU mode

disable network, disk I/O, FS and sensors modules

disable quick look module

disable all but quick look and load

disable top menu (QuickLook, CPU, MEM, SWAP and LOAD)

start Glances in mean GPU mode

enable the history mode

disable bold mode in the terminal

disable background colors in the terminal

enable extended stats on top process

-c CLIENT , —client CLIENT ¶

connect to a Glances server by IPv4/IPv6 address, hostname or hostname:port

run Glances in server mode

start the client browser (list of servers)

disable autodiscover feature

-p PORT , —port PORT ¶

define the client/server TCP port [default: 61209]

-B BIND_ADDRESS , —bind BIND_ADDRESS ¶

bind server to the given IPv4/IPv6 address or hostname

define a client/server username

define a client/server password

SNMP version (1, 2c or 3)

SNMP username (only for SNMPv3)

SNMP authentication key (only for SNMPv3)

force SNMP mode

-t TIME , —time TIME ¶

set refresh time in seconds [default: 3 sec]

run Glances in web server mode (bottle lib needed)

set the server cache time [default: 1 sec]

try to open the Web UI in the default Web browser

do not display the curses interface

-f PROCESS_FILTER , —process-filter PROCESS_FILTER ¶

set the process filter pattern (regular expression)

force short name for processes name

hide kernel threads in process list (not available on Windows)

display network rate in byte per second

show RAM FS in the DiskIO plugin

show I/O per second in the DiskIO plugin

display temperature in Fahrenheit (default is Celsius)

display FS free space instead of used

optimize display colors for white background

disable online Glances version ckeck

Interactive Commands¶

The following commands (key pressed) are supported while in Glances:

Set the process filter

On macOS please use CTRL-H to delete filter.

Filter is a regular expression pattern:

  • gnome : matches all processes starting with the gnome string
  • .*gnome.* : matches all processes containing the gnome string

Sort process list automatically

  • If CPU >70% , sort processes by CPU usage
  • If MEM >70% , sort processes by MEM usage
  • If CPU iowait >60% , sort processes by I/O read and write

Enable/disable Irix/Solaris mode

Task’s CPU usage will be divided by the total number of CPUs

1 Switch between global CPU and per-CPU stats 2 Enable/disable left sidebar 3 Enable/disable the quick look module 4 Enable/disable all but quick look and load module 5 Enable/disable top menu (QuickLook, CPU, MEM, SWAP and LOAD) 6 Enable/disable mean GPU mode 9 Switch UI theme between black and white / Switch between process command line or command name F5 Refresh stats in curses user interface LEFT Navigation leff through process sort RIGHT Navigation right through process sort UP Up in the processes list DOWN Down in the processes list

In the Glances client browser (accessible through the —browser command line argument):

ENTER Run the selected server UP Up in the servers list DOWN Down in the servers list q|ESC Quit Glances

CONFIGURATION¶

Configuration¶

No configuration file is mandatory to use Glances.

Furthermore a configuration file is needed to access more settings.

Location¶

A template is available in the /usr<,/local>/share/doc/glances (Unix-like) directory or directly on GitHub.

You can put your own glances.conf file in the following locations:

  • On Windows XP, %APPDATA% is: C:\Documents and Settings\<USERNAME>\Application Data .
  • On Windows Vista and later: C:\Users\<USERNAME>\AppData\Roaming .

User-specific options override system-wide options and options given on the command line override either.

Syntax¶

Glances reads configuration files in the ini syntax.

A first section (called global) is available:

Each plugin, export module and application monitoring process (AMP) can have a section. Below an example for the CPU plugin:

an InfluxDB export module:

With Glances 3.0 or higher it is also possible to use dynamic configuration value using system command. For example, if you to set the prefix of an InfluxDB export to the current hostname, use:

Or if you want to add the Operating System name as a tag:

Logging¶

Glances logs all of its internal messages to a log file.

DEBUG messages can been logged using the -d option on the command line.

The location of the Glances depends of your operating system. You could displayed the Glances log file full path using the«glances -V« command line.

The file is automatically rotate when the size is higher than 1 MB.

If you want to use another system path or change the log message, you can use your own logger configuration. First of all, you have to create a glances.json file with, for example, the following content (JSON format):

and start Glances using the following command line:

Replace <path> by the folder where your glances.json file is hosted.

EXAMPLES¶

Monitor local machine (standalone mode):

Monitor local machine with the web interface (Web UI), run the following command line:

and open a Web browser with the returned URL

Monitor local machine and export stats to a CSV file:

Monitor local machine and export stats to a InfluxDB server with 5s refresh time (also possible to export to OpenTSDB, Cassandra, Statsd, ElasticSearch, RabbitMQ and Riemann):

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Заключение

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

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

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

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *