iBatyr Monitor command line

Many operations related to administration have a convenient and concise system of commands executed from the command line.

Displaying available commands

sudo ibatyr help [command|django]

Select django to output commands from the Django command line.

Activating the key via the command line

sudo ibatyr activate [ключ]

Adding monitoring rules to the global configuration

sudo ibatyr acl <RULE> <VALUE>

A detailed list of rules is provided by Here

Backup of database and settings

sudo ibatyr backup_db [PATH_TO_BACKUP]

By default, the backup is saved in /var/lib/ibatyr/ibatyr_backup.

Restoring a database from a backup

Note

Database restoration must be performed in the same version of iBatyr Monitor in which the backup was created. Otherwise, system functionality is not guaranteed.

sudo ibatyr restore_db [PATH_TO_BACKUP]

By default, it goes to /var/lib/ibatyr/ibatyr_backup.

Delete a database

Warning

The command deletes the entire database.

sudo ibatyr drop ibatyr

If you are confident in your actions, confirm the deletion using the y key in response to the server question.

Illustration 1 — iBatyr Monitor command line

After uninstallation, the server will restore the server settings using the sudo ibatyr init command.

Deleting all files and screenshots older than DAYS value

sudo ibatyr cleandata <DAYS>

Deleting all files and events from the database except the last DAYS

sudo ibatyr cleanup <DAYS>

Note

For the cleanup mechanism to work quickly and easily, you need free disk space (at least 15% of the size of the current database).

This command will only delete records, but will not physically free up space on your hard drive. The process of cleaning the hard drive described in separate instructions.

ClickHouse Management

sudo ibatyr clickhouse [install|init|reinit|pump|test|start|stop|restart]

Installation and activation of the clickhouse database

sudo ibatyr clickhouse install

Upgrade ClickHouse database to stable version

ibatyr upgrade clickhouse

Installs the latest known stable version of ClickHouse. Sometimes it eliminates the problems of unstable versions of ClickHouse, usually newer ones.

Loading data from PostgreSQL to ClickHouse

sudo ibatyr clickhouse pump

Note

This command should not be executed just like that! Only run if you know what you are doing!

Testing the system for uploading from PostgreSQL to ClickHouse is necessary for diagnostics

sudo ibatyr clickhouse test

Overwriting all ClickHouse data

sudo ibatyr clickhouse reinit

Restarting the ClickHouse server

sudo ibatyr clickhouse restart

Starting the ClickHouse server

sudo ibatyr clickhouse start

Stopping the ClickHouse server

sudo ibatyr clickhouse stop

Test sending data from client to server and outputting agent configuration.

sudo ibatyr client [SERVER]

Copying database and files from remote to local server (PostgreSQL)

sudo ibatyr clone <SSH-USER>@<REMOTE-HOST> [ssh options]

Clean up unused space and defragment the database

sudo ibatyr compact

Deleting all data for a selected dimension

sudo ibatyr delete [--type agent|account|event] [--days N] [--keep-files] [--compact] <NAME>

--type        Удаление данных по агенту, имени пользователя or типу событий
--days N      Оставить данные за N дней
--compact     Дефрагментация базы данных
--keep-files  Оставить файлы
--keep-events Оставить события
--use-id      Удаление данных по id (значения можно найти в БД)

Доступный список event для команды:

DiskDrive         | Внешние диски
FileOperation     | Операции с файлами
SystemLog         | Системный лог
UserActivity      | Алерт
MicRecording      |
DevInventory      | Реестр оборудования
AppInventory      | Реестр софта
WebSearch         | Поисковый запрос
DesktopVideo      | Видео рабочего стола
FormData          | Данные формы
WLan              | Беспроводное подключение
InterceptedFile   | Перехваченный файл
Keyboard          | Ввод с клавиатуры
Run               | Запуск приложения
Exit              | Завершение приложения
Screenshot        | Снимок экрана
NetworkConnection | Сеть
AppInstallation   | Установка ПО
Web               | Посещение сайтов
Im                | Интернет-пейджер
Mail              | Почта
FTP               | FTP
PrintDoc          | Печать документов
UserLogon         | Вход/выход из системы
Clipboard         | Буфер обмена
Device            | Устройства
Stat              | Время активности

Note

This command is case sensitive, please be careful!

Managing special permissions for administrators

Usage: ibatyr special [options] list | grant <user> <permission|all> | revoke <user> <permission|all>

Special permission management

Avaiable permissions:
 can_access_terminal        Имеет доступ к WEB-терминалу
 can_delete_shard           Может удалять данные из БД (помесячно)
 can_delete_event           Может удалять отдельные события
 can_delete_agent           Может удалять компьютеры и пользователей
 can_mass_delete            Может массово удалять события и файлы
 can_add_task               Может добавлять задания в планировщике
 can_delete_global_config   Может удалять правила из Глобальной конфигурации
 can_reset_settings         Может сбросить предустановленные настройки до изначального состояния
 all                        Все разрешения

Options:
--password            Parameter позволяет задать дополнительный пароль, который будет запрошен перед исполнением операции в веб-консоли.

Give permission:

ibatyr special grant [USER] [PERMISSION]

Revoke permission:

ibatyr special revoke [USER] [PERMISSION]

View permissions:

ibatyr special list

Restoring the filter tree

sudo ibatyr rebuild_mptt

Run the command if you experience errors when opening the web interface in the JS console

Exporting filters and configurations

sudo ibatyr export FILE_TO_EXPORT.json

Export is performed to the file FILE_TO_EXPORT.json. Specify the full path to the file.

Importing filters and configurations

sudo ibatyr import FILE_TO_IMPORT.json

When executing the command, specify the full path to the file.

The current filters will be saved.

Display information about the server and used disk space

sudo ibatyr info

Initializing or restoring server settings

sudo ibatyr init

Installing the agent from the iBatyr Monitor server

sudo ibatyr install [options] ip-address

--domain=DOMAIN       | Домен
--user=USER           | Name пользователя
--password=PASSWORD   | Password
--server=SERVER_HOST  | IP-адрес сервера ibatyr
--port=SERVER_PORT    | Port сервера ibatyr
--dry-run             | Проверка возможности установки
--reinstall           | Переустановка агента
--traceback           | Вывод trace ошибок
--uninstall           | Удаление агента
--language=LANGUAGE   | Выбор языка (en, ru)
--log                 | Показать лог установки
--version             | Вывод версии программы

Where, ip-address is the IP address of the PC on which you want to install the agent. The PC address can also be the name of the workstation; in this case, you must have the DNS server configured correctly in the system network connection settings.

Run mule in high priority

sudo ibatyr mule <MULE_NAME>

Text recognition in images or pdf

sudo ibatyr ocr <image or pdf file>

Displaying box statistics

ibatyr grab --server=<server> --login=<login> --password=<password>

Setting a new password for a user

sudo ibatyr passwd NEW_PASSWORD

Output of current SQL queries and execution plan

sudo ibatyr prof

Removing users and agents that have no events

sudo ibatyr prune

Output of ibatyr processes

sudo ibatyr ps

Rebuilding reports for N months

sudo ibatyr rebuild_sessions MONTHS

Reset to default server settings

sudo ibatyr reinit [full]

The [full] parameter removes all custom filters.

Restarting the ibatyr service

sudo ibatyr restart

Creating a superuser in the web interface

sudo ibatyr createsuperuser

Merging agent or account events with identical names

ibatyr sane                               | объединяются агенты и аккаунты
ibatyr sane agents                        | объединяются только агенты
ibatyr sane accounts                      | объединяются только аккаунты
ibatyr sane -l <количество дублей>        | позволяет обрабатывать только часть дублей за запуск — например, 500 из 3000
ibatyr sane --limit <количество дублей>   | идентично ibatyr sane -l
ibatyr sane --help                        | вызов справки

Checking indexes, including primary keys and sharded tables

ibatyr check

Managing sharding

sudo ibatyr shard [init|install|list|ddl|index|copy|drop]

Creating a shard for the current month

sudo ibatyr shard init

Enabling database sharding functionality

sudo ibatyr shard install

Warning

Irreversible operation! The command works in PostgreSQL version 11 and higher, 50% of disk space is required.

Listing current shards

sudo ibatyr shard list

Removing part of a sharded database

sudo ibatyr shard drop agent_event_2021_01_01

Delete part of the database that has accumulated for January 2021

Access to the iBatyr Monitor SQL console

sudo ibatyr sql

Adding, removing, and displaying dynamic fields in a cube model

ibatyr dynamic [options]

Note

For quick help on this command, simply write ibatyr dynamic

Sync by specified domain

sudo ibatyr ad_sync --domain DOMAIN.local

Sync Statistics

sudo ibatyr ad_sync --stats

Assigning a configuration to a user or agent

ibatyr config --[user|agent] <AgentName|UserName> <ComputerConfigurationName|UserConfigurationName>

Note

If the configuration name consists of several words, then quotes should be used: "Computer Config".

Enabling a new configuration assignment mechanism on the server

Starting from version 5.4, a new mechanism for assigning configuration to an agent is available. It is not required for use, but can improve the speed of interaction between the agent and the server.

ibatyr enable rustsrv

Launch of the iBatyr service

sudo ibatyr start

Stopping the iBatyr service

sudo ibatyr stop

Display of top iBatyr processes

sudo ibatyr top

Delete all data

sudo ibatyr truncate

Update to the latest version

sudo ibatyr upgrade

Upgrading PostgreSQL to version 15

sudo ibatyr postgresql upgrade

Additional features of the web interface

To enable the Linux console on the server and the option to delete data from agents, you need to run the command:

sudo ibatyr special grant <user> <permission|all>

To turn off the Linux console on the server and the option to delete data from agents, you need to run the command:

sudo ibatyr special revoke <user> <permission|all>

Note

By default, these menus are disabled in the web interface.