Zabbix alt: различия между версиями
Vovan (обсуждение | вклад) (→Настраиваем веб-сервер) |
Vovan (обсуждение | вклад) (→Настраиваем веб-сервер) |
||
Строка 129: | Строка 129: | ||
+ | <pre> | ||
+ | cat << 'EOF' > /etc/php/8.2/apache2-mod_php/php.ini | ||
+ | [PHP] | ||
+ | engine = On | ||
+ | short_open_tag = On | ||
+ | asp_tags = Off | ||
+ | precision = 14 | ||
+ | output_buffering = 4096 | ||
+ | zlib.output_compression = Off | ||
+ | implicit_flush = Off | ||
+ | unserialize_callback_func = | ||
+ | serialize_precision = 100 | ||
+ | disable_functions = | ||
+ | disable_classes = | ||
+ | zend.enable_gc = On | ||
+ | expose_php = On | ||
+ | max_execution_time = 600 | ||
+ | max_input_time = 600 | ||
+ | memory_limit = 256M | ||
+ | error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT | ||
+ | display_errors = Off | ||
+ | display_startup_errors = Off | ||
+ | log_errors = On | ||
+ | log_errors_max_len = 1024 | ||
+ | ignore_repeated_errors = Off | ||
+ | ignore_repeated_source = Off | ||
+ | report_memleaks = On | ||
+ | track_errors = Off | ||
+ | html_errors = On | ||
+ | variables_order = "GPCS" | ||
+ | request_order = "GP" | ||
+ | register_argc_argv = Off | ||
+ | auto_globals_jit = On | ||
+ | post_max_size = 50M | ||
+ | auto_prepend_file = | ||
+ | auto_append_file = | ||
+ | default_mimetype = "text/html" | ||
+ | default_charset = "UTF-8" | ||
+ | include_path = "./:/usr/share/php/pear/:/usr/share/php/modules/" | ||
+ | user_dir = | ||
+ | enable_dl = Off | ||
+ | file_uploads = On | ||
+ | upload_tmp_dir = /tmp | ||
+ | upload_max_filesize = 20M | ||
+ | max_file_uploads = 20 | ||
+ | allow_url_fopen = On | ||
+ | allow_url_include = Off | ||
+ | default_socket_timeout = 60 | ||
+ | always_populate_raw_post_data = -1 | ||
+ | |||
+ | [CLI Server] | ||
+ | cli_server.color = On | ||
+ | |||
+ | [Date] | ||
+ | date.timezone = Europe/Moscow | ||
+ | |||
+ | [filter] | ||
+ | |||
+ | [iconv] | ||
+ | |||
+ | [intl] | ||
+ | |||
+ | [Pcre] | ||
+ | |||
+ | [Phar] | ||
+ | |||
+ | [SQL] | ||
+ | sql.safe_mode = Off | ||
+ | |||
+ | [bcmath] | ||
+ | |||
+ | [browscap] | ||
+ | browscap = "/etc/php/8.2/apache2-mod_php/browscap.ini" | ||
+ | |||
+ | [Session] | ||
+ | session.save_handler = files | ||
+ | session.use_strict_mode = 0 | ||
+ | session.use_cookies = 1 | ||
+ | session.use_only_cookies = 1 | ||
+ | session.name = PHPSESSID | ||
+ | session.auto_start = 0 | ||
+ | session.cookie_lifetime = 0 | ||
+ | session.cookie_path = / | ||
+ | session.cookie_domain = | ||
+ | session.cookie_httponly = | ||
+ | session.serialize_handler = php | ||
+ | session.gc_probability = 1 | ||
+ | session.gc_divisor = 1000 | ||
+ | session.gc_maxlifetime = 1440 | ||
+ | session.referer_check = | ||
+ | session.cache_limiter = nocache | ||
+ | session.cache_expire = 180 | ||
+ | session.use_trans_sid = 0 | ||
+ | session.hash_function = 0 | ||
+ | session.hash_bits_per_character = 5 | ||
+ | url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry" | ||
+ | |||
+ | [Assertion] | ||
+ | |||
+ | [COM] | ||
+ | |||
+ | [sysvshm] | ||
+ | EOF | ||
+ | </pre> | ||
Ставим сервис в автозапуск и сразу запускаем его | Ставим сервис в автозапуск и сразу запускаем его |
Версия 21:47, 30 ноября 2023
Содержание
Zabbix на Alt P10 jeos
Источник: здесь
Подготовка
apt-get update && apt-get -y dist-upgrade
apt-get install -y nano update-kernel
update-kernel -y
reboot
Postgresql
Установка
apt-get install -y postgresql16-server
Первоначальный запуск
/etc/init.d/postgresql initdb
ВНИМАНИЕ!
Два последующих конфигурационных файла будут созданы без лишних комментариев внутри только для ускорения процесса демонстрации. Поэтому предварительно для них будут созданы резервные копии, в которые настоятельно рекомендуется хотябы один раз заглянуть, чтобы понять, что параметров настройки значительно больше чем необходимых и достаточных для работы параметров!
Делаем резервные копии
cp /var/lib/pgsql/data/pg_hba.conf /var/lib/pgsql/data/pg_hba.conf.backup cp /var/lib/pgsql/data/postgresql.conf /var/lib/pgsql/data/postgresql.conf.backup
Далее используем heredoc-синтаксис, потому что мы ленивы...
cat << 'EOF' > /var/lib/pgsql/data/pg_hba.conf # TYPE DATABASE USER ADDRESS METHOD # "local" is for Unix domain socket connections only local all all trust # IPv4 local connections: host all all 127.0.0.1/32 trust host all all 0.0.0.0/0 md5 # Allow replication connections from localhost, by a user with the # replication privilege. local replication all trust host replication all 127.0.0.1/32 trust EOF
cat << 'EOF' > /var/lib/pgsql/data/postgresql.conf listen_addresses = '*' # what IP address(es) to listen on; max_connections = 100 # (change requires restart) shared_buffers = 128MB # min 128kB dynamic_shared_memory_type = posix # the default is usually the first option max_wal_size = 1GB min_wal_size = 80MB log_destination = 'stderr' # Valid values are combinations of logging_collector = on # Enable capturing of stderr, jsonlog, log_directory = 'log' # directory where log files are written, log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log' # log file name pattern, log_file_mode = 0600 # creation mode for log files, log_rotation_size = 10MB # Automatic rotation of logfiles will log_min_messages = warning # values in order of decreasing detail: log_checkpoints = off log_connections = off log_disconnections = off log_timezone = UTC datestyle = 'iso, mdy' timezone = UTC default_text_search_config = 'pg_catalog.english' EOF
systemctl enable --now postgresql
Создать пользователя, базу данных и задать пароль
psql -U postgres -c "CREATE USER zabbix_user WITH ENCRYPTED PASSWORD 'zabbix_pass';" psql -U postgres -c "CREATE DATABASE zabbix_db;" psql -U postgres -c "GRANT ALL ON DATABASE zabbix_db TO zabbix_user;" psql -U postgres -c "ALTER DATABASE zabbix_db OWNER TO zabbix_user;"
Проверить
psql -U zabbix_user -W zabbix_db -c "\l"
Zabbix server
Установка пакетов
apt-get install -y zabbix-server-pgsql postgresql16 apache2 apache2-mod_php8.2 php8.2 php8.2-mbstring php8.2-sockets php8.2-gd php8.2-xmlreader php8.2-pgsql php8.2-ldap php8.2-openssl
Развёртывание базы данных
См. предыдущий раздел. Там есть данные для доступа на сервер...
Предположим, что сервер postgresql у нас работает на ip адресе
10.207.146.169
Проверим: доступна ли база данных на нашем сервере с нашими данными для подключения
psql -h 10.207.146.169 -U zabbix_user -W zabbix_db -c "\l"
Если доступна, то развернём в неё дамп
psql -h 10.207.146.169 -U zabbix_user -f /usr/share/doc/zabbix-common-database-pgsql-6.0.22/schema.sql zabbix_db
вводим пароль
psql -h 10.207.146.169 -U zabbix_user -f /usr/share/doc/zabbix-common-database-pgsql-6.0.22/schema.sql zabbix_db
вводим пароль
psql -h 10.207.146.169 -U zabbix_user -f /usr/share/doc/zabbix-common-database-pgsql-6.0.22/data.sql zabbix_db
вводим пароль
База на месте.
Настраиваем веб-сервер
cp /etc/php/8.2/apache2-mod_php/php.ini /etc/php/8.2/apache2-mod_php/php.ini.backup
cat << 'EOF' > /etc/php/8.2/apache2-mod_php/php.ini [PHP] engine = On short_open_tag = On asp_tags = Off precision = 14 output_buffering = 4096 zlib.output_compression = Off implicit_flush = Off unserialize_callback_func = serialize_precision = 100 disable_functions = disable_classes = zend.enable_gc = On expose_php = On max_execution_time = 600 max_input_time = 600 memory_limit = 256M error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT display_errors = Off display_startup_errors = Off log_errors = On log_errors_max_len = 1024 ignore_repeated_errors = Off ignore_repeated_source = Off report_memleaks = On track_errors = Off html_errors = On variables_order = "GPCS" request_order = "GP" register_argc_argv = Off auto_globals_jit = On post_max_size = 50M auto_prepend_file = auto_append_file = default_mimetype = "text/html" default_charset = "UTF-8" include_path = "./:/usr/share/php/pear/:/usr/share/php/modules/" user_dir = enable_dl = Off file_uploads = On upload_tmp_dir = /tmp upload_max_filesize = 20M max_file_uploads = 20 allow_url_fopen = On allow_url_include = Off default_socket_timeout = 60 always_populate_raw_post_data = -1 [CLI Server] cli_server.color = On [Date] date.timezone = Europe/Moscow [filter] [iconv] [intl] [Pcre] [Phar] [SQL] sql.safe_mode = Off [bcmath] [browscap] browscap = "/etc/php/8.2/apache2-mod_php/browscap.ini" [Session] session.save_handler = files session.use_strict_mode = 0 session.use_cookies = 1 session.use_only_cookies = 1 session.name = PHPSESSID session.auto_start = 0 session.cookie_lifetime = 0 session.cookie_path = / session.cookie_domain = session.cookie_httponly = session.serialize_handler = php session.gc_probability = 1 session.gc_divisor = 1000 session.gc_maxlifetime = 1440 session.referer_check = session.cache_limiter = nocache session.cache_expire = 180 session.use_trans_sid = 0 session.hash_function = 0 session.hash_bits_per_character = 5 url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry" [Assertion] [COM] [sysvshm] EOF
Ставим сервис в автозапуск и сразу запускаем его
systemctl enable --now httpd2