Zabbix agent windows port


Содержание

  • Введение
  • 1. Установка Zabbix Agent из MSI-пакета
  • 2. Проверка установки Zabbix Agent
  • 3. Добавление Windows-хоста в сеть мониторинга
  • Использованные ресурсы

Введение

Программное обеспечение Zabbix Agent позволяет осуществлять мониторинг устройств, на которые оно установлено. Для сбора и отображения данных мониторинга используется ПО Zabbix Server. См. статью «Zabbix Server, Zabbix Agent, Zabbix Frontend и MySQL. Инструкции по установке».

В настоящей статье представлены инструкции по установке и настройке Zabbix Agent в операционной системе MS Windows.

1. Установка Zabbix Agent из MSI-пакета

1.1. Скачайте MSI-пакет Zabbix Agent по ссылке https://www.zabbix.com/download_agents

Скачивание MSI-пакета Zabbix Agent

Скачивание MSI-пакета Zabbix Agent

1.2. Запустите установку MSI-пакета.

1.3. В процессе установки выберите папку для установки Zabbix Agent.

1.4. Настройте конфигурацию службы Zabbix Agent:

  • Host name — имя хоста;
  • Zabbix server IP/DNS — IP-адрес Zabbix Server (в запросах с неизвестных адресов будет отказано);
  • Agent listen port — номер сетевого порта Zabbix Agent (10050 по-умолчанию);
  • Server or Proxy for active checks — IP-адрес сервера для активных проверок агента Zabbix;
  • Enable PSK — установите этот флажок, чтобы впоследствии настроить зашифрованный канал связи между Zabbix Agent и Zabbix Server;
  • Add agent location to the PATH — установите этот флажок, чтобы добавить путь к агенту в переменную среды PATH.

Настройка конфигурации службы Zabbix Agent

Настройка конфигурации службы Zabbix Agent

2. Проверка установки Zabbix Agent

2.1. Откройте Брандмауэр Защитника Windows в режиме администратора.
2.2. Перейдите на вкладку «Правила для входящих подключений».
2.3. Удостоверьтесь, что установщик Zabbix Agent создал правило, разрешающее входящие запросы по сетевому порту 10050.
2.4. Если правила нет, создайте его и перезагрузите компьютер.

Проверка наличия правила для входящих подключений Zabbix Agent

Проверка наличия правила для входящих подключений Zabbix Agent

2.5. Откройте приложение «Службы».
2.6. Удостоверьтесь, что служба Zabbix Agent находится в состоянии «Выполняется».
2.7. Если состояние службы Zabbix Agent отличается от «Выполняется», установите состояние «Выполняется» и перезагрузите компьютер.

Проверка состояния Zabbix Agent в диспетчере служб

3. Добавление Windows-хоста в сеть мониторинга

3.1. Откройте Zabbix Frontend (см. статью «Zabbix Server, Zabbix Agent, Zabbix Frontend и MySQL. Инструкции по установке».). Для э того в адресной строке браузера наберите: http://zabbix-server-ip-address:8080
3.2. Откройте раздел «Monitoring» > «Hosts» и нажмите кнопку «Create host».

Создание хоста

Создание хоста

3.3. Задайте имя хоста в поле «Host name».
3.4. Выберите шаблон «Template OS Linux by Zabbix agent».
3.5. Создайте группу мониторинга для хоста или добавьте его в существующую группу.
3.6. Под полем «Interfaces» нажмите кнопку «Add» и в раскрывающемся меню выберите пункт «Agent».

Настройка свойств хоста Zabbix Agent

Настройка свойств хоста Zabbix Agent

3.7. В поле «Agent» задайте IP-адрес или доменное имя компьютера, на котором установлен Zabbix Agent.

3.8. Если при установке Zabbix Agent был указан сетевой порт, отличный от 10050, укажите используемый порт

3.9. Нажмите кнопку «Add».

Настройка IP-адреса хоста Zabbix Agent

Настройка IP-адреса хоста Zabbix Agent

3.10. Перейдите в раздел «Monitoring» > «Hosts».

3.11. В списке хостов должна появиться новая запись.

3.12. Подождите приблизительно 2 минуты, пока индикатор статуса доступности ZBX не станет зелёным.

Статус хоста Zabbix Agent

Статус хоста Zabbix Agent

3.13. Если индикатор красный, удостоверьтесь, что:

  • сетевой экран на машине, где развернут Zabbix Server, разрешает обмен данными через порт 10051;
  • сетевой экран и (или) Брандмауэр Защитника Windows на машине, где развернут Zabbix Agent, разрешает обмен данными через порт 10050;
  • значения Server и ServerActive в файле конфигурации Zabbix Agent /etc/zabbix/zabbix_agentd.conf соответствуют IP-адресу Zabbix Server:
Server=192.168.0.1 # ip-адрес приведён как пример
ServerActive=192.168.0.1 # ip-адрес приведён как пример

Примечание
При любых изменениях в файле конфигурации необходимо остановить и снова запустить (при перезапуске используется конфигурация из памяти) сервис Zabbix Agent или перезагрузить компьютер.

Использованные ресурсы

Официальная инструкция по установке Zabbix Agent в Windows из MSI-пакета (на английском языке)

Zabbix это open-source система мониторинга корпоративного уровня. На текущий момент Zabbix одна из самых популярных и функциональных бесплатных систем мониторинга. Благодаря простой установке и настройке Zabbix можно использовать для мониторинга крупных инфраструктур с сотнями серверов, так и для мелких конфигураций. В этой статье мы рассмотрим, как выполнить установку и базовую настройку сервера Zabbix 4.4 с веб-интерфейсом на базе Linux Ubuntu и CentOS, установить агенты Zabbix на сервере Windows и Linux, и добавить новые хосты в систему мониторинга.

Общий интерфейс Zabbix сервера представлен на скриншоте ниже.

веб интерфейс системы мониторинга zabbix

Содержание:

  • Из чего состоит Zabbix и что он может?
  • Установка Zabbix Server в Linux (Ubuntu, CentOS)
  • Настройка веб-интерфейса Zabbix
  • Установка Zabbix Agent в Windows
  • Добавление устройства на Zabbix-сервере
  • Установка Zabbix Agent в Linux

Из чего состоит Zabbix и что он может?

Zabbix простой установке и настройке, написан на C (сервер, прокси и агент) и PHP (фронтенд). Zabbix Server и Zabbix Proxy может работать только на Linux системах. Агент можно установить на большом количестве поддерживаемых ОС и платформах.

Инсталляция Zabbix сервера состоит из:

  • бинарника zabbix_server (обычно работает как сервис);
  • MySQL (MariaDB)/PostgreSQL базы данных;
  • Веб сервера Apache2/Nginx с обработчиком PHP;
  • Файлов самого frontend сайта (.php, .js, .css и т.д.).

Обычно схема работы выглядит так:

  1. Агент Zabbix посылает данные на сервер
  2. Сервер Zabbix получает и обрабатывает данные.
  3. Если полученные данные подпадают под заданные условия, то срабатывает триггер;
  4. Активный триггер сигнализирует о проблеме. Отображается уведомление на фронтенде (сайте), и в зависимости от конфигурации рассылается сообщение по почте и выполняется какие-либо действия (например, перезапуск службы, которая мониторится).

Zabbix может работать со всеми известными протоколами, а благодаря системе внешних скриптов, Zabbix может выполнять и получать данные из любых исполняемых скриптов/бинарников.

Установка Zabbix Server в Linux (Ubuntu, CentOS)

В этой статье мы рассмотрим пример установки Zabbix Server 4.4 на Linux (на примере Ubuntu Server 18.4 и CentOS) через пакетный менеджер.

Перейдите на страницу загрузки https://www.zabbix.com/download и выберите репозиторий, соответствующий вашему дистрибутиву Linux. Готовые пакеты есть для всех популярных дистрибутивов.

Например, для установки Zabbix на Ubuntu 18.04 нужно последовательно выбрать :

Zabbix Version (4.4) -> OS Distribution (Ubuntu) -> OS Version (18.04 Bionic) -> Database (MySQL) -> Веб сервер (Nginx или Apache).

инструкция по установке zabbix, получение репозиториев

Скачем и добавим репозиторий:

# wget https://repo.zabbix.com/zabbix/4.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_4.4-1+bionic_all.deb
# dpkg -i zabbix-release_4.4-1+bionic_all.deb
# apt update

Теперь можно установить необходимые пакеты:

# apt install zabbix-server-mysql zabbix-frontend-php zabbix-nginx-conf zabbix-agent

установка zabbix-server в linux ubuntu

Для установки Zabbix в CentOS 8/RHEL 8 нужно подключить репозиторий с актуальной версией Zabbix (можно установить Zabbix из ветки 4.0 LTS или последнюю версию Zabbix 4.4):

# rpm -Uvh https://repo.zabbix.com/zabbix/4.4/rhel/8/x86_64/zabbix-release-4.4-1.el8.noarch.rpm
# dnf clean all

Предполагаем, что на сервере уже установлены: nginx, MySQL/MariaDB, php и php-fpm. Теперь через пакетный менеджер установим сам сервер Zabbix и агент:

# dnf install zabbix-server-mysql zabbix-web-mysql zabbix-agent

Осталось создать базу данных для Zabbix в MySQL (вместо MySQL можно использовать PostgreSQL, просто замените в командах ‘mysql’ на ‘pgsql’).

Создайте базу данных и дайте права пользователю, из-под которого Zabbix будет обращаться к базе данных:

mysql -uroot
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'ВашПароль';
mysql> quit;

Импортируйте базу данных Zabbix. Нужно будет ввести пароль, который вы указали при создании пользователя.

zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p Zabbix

Измените конфигурационный файл /etc/zabbix/zabbix_server.conf, укажите пароль от вновь созданного пользователя.

DBPassword=Пароль_Пользователя_Zabbix

Так как в моем случае веб сервером служит nginx, нужно изменить nginx.conf, раскомментировав следующие строчки

# listen 80;
# server_name example.com;

Уберите # и поменяйте example.com на домен, по которому вы хотите заходить на Zabbix, в моём случае это
test.zabbix.local
.

Для Apache файл нужно править файл конфигурации /etc/httpd/conf.d/zabbix.conf .

Выставим временную зону в PHP. В файле /etc/zabbix/php-fpm.conf раскомментируем строчку

php_value[date.timezone] = Europe/Moscow

Дополнительно можно выставить следующие параметры PHP в
/etc/php.ini
:

memory_limit 128M
upload_max_filesize 8M
post_max_size 16M
max_execution_time 300
max_input_time 300
max_input_vars 10000

Добавьте службу zabbix-server в автозапуск и запустите ее:

# systemctl enable zabbix-server zabbix-agent nginx php7.2-fpm
# systemctl restart zabbix-server zabbix-agent nginx php7.2-fpm

Настройка веб-интерфейса Zabbix

Теперь нужно настроить frontend (веб-интерфейс) Zabbix. В браузере откройте указанный ранее URL адрес zabbix сервера. В моем случае это test.zabbix.local (или на домен, который вы указывали. Не забудьте прописать его у себя в hosts файле или на DNS сервере).

zabbix веб installer

Убедитесь, что во всех требования инсталлятора указано ОК.

zabbix check pre-requisites

Укажите данные для подключения к БД. Используйте пользователя и пароль, который создали ранее.

данные для подключения к базе данных zabbix

Укажите название Zabbix сервера. Порт рекомендую оставлять стандартный – TCP 10051.

Система Zabbix по-умолчанию использует два порта:

  • TCP 10050 — порт пассивного агента, по нему zabbix сервер опрашивает клиентов;
  • TCP 10051 — порт, на котором zabbix сервер получает данные от клиентов (активный агент).

Не забудьте открыть данные порты. Например, на Zabbix сервере на базе CentOS можно открыть порты в firewalld с помощью firewall-cmd:

# firewall-cmd --add-service={http,https} --permanentfirewall-cmd --add-port={10051/tcp,10050/tcp} –permanent

А на агенте достаточно открыть 10050:

# firewall-cmd --permanent --add-port=10050/tcp

Не забудьте перезагрузить firewalld:

# firewall-cmd –reload

имя и порты zabbix сервера

После этого жмите Next Step и Finish. После успешной установки вас попросит залогиниться. По-умолчанию логин
Admin
, пароль
zabbix
(замените его).

авторизация веб-интерфейсе в zabbix

zabbix dashboard

На этом установка сервера Zabbix Server завершена.

На странице https://www.zabbix.com/download есть пошаговые инструкции для установки Zabbix Server на другие операционные системы, а так же инструкции как собрать zabbix-server из исходного кода или запустить его в docker контейнерах.

Установка Zabbix Agent в Windows

Попробуем установить Zabbix агент на сервер Windows и добавим его на наш сервер мониторинга Zabbix. Скачать версию Zabbix агент для Windows можно здесь: https://www.zabbix.com/download_agents.

агенты zabbix для windows

Выберите нужную версию агента под Windows. Я выберу формат msi (amd64) (без OpenSSL). Если вы планируете устанавливать zabbix agent на сервера/компьютеры домена через групповые политики или SCCM, то можете скачать zip архив с бинарными файлами и конфигурационными файлами.

Запустите инсталлятор, примите лицензионное соглашение, укажите запрошенные данные. Обратите внимание, что в поле “Server or Proxy for active checks” я указал IP адрес в формате IP:PORT. Поскольку порт я оставлял стандартный, я пишу IP:10051.

настройка параметров zabbix сервера при установке агента в windows

Далее еще пару раз нажмем Next и Install.

После этого убедимся, что наш агент установлен. В списке служб должен появиться сервис Zabbix Agent.

служба zabbix agent в windows

На клиенте Windows нужно разрещить входящие подключения с IP адреса сервера Zabbix в Брандмауэре Windows:

New-NetFirewallRule -DisplayName "ZabbixMonitoring" –RemoteAddress 192.168.1.100 -Direction Inbound -Protocol TCP –LocalPort 10050 -Action Allow

Добавление устройства на Zabbix-сервере

Чтобы убедиться в работоспособности агента, нужно добавить хост testnode2 на Zabbix сервер и назначить ему проверки (checks).

Заметка. В заббиксе есть 2 типа проверок:

  • Пассивные – Zabbix сервер запрашивает у агента какие-либо данные;
  • Активные – агент посылает на сервер данные;

При установке агента мы указывали сервер в формате IP:PORT как раз для активных проверок.

Добавление нового устройства для мониторинга в Zabbix выполняется через Web-интерфейс. Перейдите в раздел Configuration -> Hosts.

добавление хоста в мониторинг Zabbix

Нажмите Create host и заполните данные. Обратите внимание, что Host name хоста должен полностью совпадать с hostname машины или значением параметра Hostname в конфиге агента.

добавление windows устройства в Zabbix сервере

Во вкладке Templates добавить несколько встроенных Windows шаблонов. Шаблоны в Zabbix это наборы значений, триггеров, графов и правил обнаружения, которые могут быть назначены одному или нескольким хостам.

Эти интегрированные шаблоны имеют постфикс “active”, значит, будут использоваться активные проверки.

шаблоны zabbix для windows

Нажмите Add. Чтобы не ждать пока сервер и агент увидят друг друга (обычно занимает пару минут), перезагрузите службу Zabbix Agent на testnode2 и проверьте лог агента (C:\Program Files\Zabbix Agent\zabbix_agentd.txt).

перезапуск службы Zabbix agent

лог zabbix_agentd.txt

Сообщение “started [active checks #1]” говорит о том, что на сервере найдены активные проверки для этого хоста. Теперь посмотрим на данные, которые пришли на сервер Zabbix от агента. Для этого в Zabbix перейдите на Monitoring -> Latest Data и выберете нужный вам хост в поле Hosts.

проверка получение данных от хоста в zabbix

данные об устройстве в веб интерфейсе zabbix

В этом разделе отображаются последние данные, которые пришли на сервер по выбранным хостам или группам хостов.

Обратите внимание на то, что в дашборде Zabbix висит уведомление о том, что служба BITS не запущена. Это уведомление появилось потому что мы назначили стандартные шаблоны нашему хосту. В одном из шаблонов был мониторинг сервиса BITS и соответствующий триггер, который срабатывает если служба BITS находится не в статусе Running.

события в dashboard zabbix

На этом настройка Windows Agentа завершена.

Установка Zabbix Agent в Linux

Теперь установим агент Zabbix в Linux. Для установки Zabbix агента в Ubuntu Server 18.04 с помощью пакетного менеджера нужно скачать и установить репозиторий Zabbix. Затем из репозитория установим zabbix agent:
# wget https://repo.zabbix.com/zabbix/4.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_4.4-1+bionic_all.deb
# dpkg -i zabbix-release_4.4-1+bionic_all.deb
# apt update
# apt install zabbix-agent

В CentOS для добавления репозитория и установки агента zabbix используется команды:
# rpm -Uvh https://repo.zabbix.com/zabbix/4.4/rhel/8/x86_64/zabbix-release-4.4-1.el8.noarch.rpm
# dnf clean all
# dnf install zabbix-agent

Перед тем как мы запустим zabbix агент, нужно отредактировать конфигурационный файл /etc/zabbix/zabbix_agentd.conf. В нем нужно указать IP адрес сервера Zabbix для активных проверок.

Server=IP
ServerActive=IP:10051
Hostname=testagent

После этого запустите сервис агента:

# service zabbix-agent start

Убедитесь, что агент успешно запустился.

# cat /var/log/zabbix/zabbix_agentd.log

установка zabbix agent в linux ubuntu

Строка cannot parse list of active checks говорит о том, что на сервере нет активных проверок для этого хоста.

Как и в случае с Windows агентом, вам нужно добавить ваш Linux хост в настройках сервера Zabbix. Обратите внимание на параметр Host name в настройка хоста в интерфейсе заббикс сервера — этот параметр должен совпадать с Hostname параметром, который мы указываем в конфиге Zabbix -агента. В конфиге выше я указывал имя хоста testagent.

добавление ubuntu в мониторинг zabbix

23

Перезагрузите Zabbix агент и проверьте лог.

лог zabbix_agentd

Проверьте, что данные от агента появились на сервере Zabbix.

данные с linux сервера появились в веб интерфейсе zabbix

На этом настройка Zabbix-агента на Linux системе завершена. В следующей статье мы рассмотрим безагентный мониторинг доступности узлов в Zabbix через ICMP Ping.

Опубликовано:

Используемые термины: Zabbix, Windows.

В нашем примере мы установим агент для Zabbix на Windows в качестве службы, а также сделаем минимальную настройку для отправки данных на сервер.

Загрузка агента с официального сайта
Установка агента
    Из пакета MSI
    Из архива
Настройка брандмауэра
Проверка подключения к агенту
Другие статьи про Zabbix

Загрузка агента

Переходим на страницу загрузки агента Zabbix и выбираем платформу операционной системы (x32 или x64) и версию агента, например:

Выбираем версию агента zabbix и платформу Windows

* помимо этого, мы можем выбрать вариант дистрибутива: с использованием шифрования или нет, а также файл установки — msi пакет или архив. В данном примере мы выбрали версию 5.

В зависимости от выбранных критериев поиска агента, ниже мы можем увидеть несколько вариантов для загрузки. Находим нужный и кликаем по DOWNLOAD для скачивания файла:

Скачиваем агента Zabbix по ссылке Download

Ждем окончания загрузки и переходим к установке.

Установка агента

В зависимости от загрузки типа пакета (MSI или архив) будут разные методы установки. Рассмотрим оба.

Установка из MSI-пакета

Это удобный вариант, который позволит установить агента с помощью мастера. Чтобы начать, кликаем дважды по скачанному пакету и в окне приветствия нажимаем Next:

Принимаем лицензионное соглашение, установив галочку I accept the terms in the License Agreement и нажимаем Next:

В следующем окне оставляем имя компьютера, на который устанавливается агент и вводим имя или IP-адрес сервера zabbix, после кликаем по Next:

Указываем имя компьютера и сервера Zabbix

* в данном примере имя нашего компьютера Windows PC, а сервера — zabbix-server.dmosk.local.

Выбираем компоненты, которые хотим установить — можно просто оставить все по умолчанию и нажимаем Next:

Выбираем компоненты для установки

Подтверждаем установку, кликая по Install:

Ждем завершения процесса — агент установлен.

Установка из архива

Данный метод требует дополнительных манипуляций, но с его помощью можно автоматизировать процесс. Мы рассмотрим только установку.

Распаковываем содержимое скачанного архива в каталог, где будут находиться файлы программы, например в C:\Program Files\Zabbix Agent. В итоге, у нас получится:

Открываем WordPad от администратора и в нем открываем конфигурационный файл conf/zabbix_agentd.conf и правим опцию для сервера zabbix — находим строку:

Server=127.0.0.1

… и меняем ее на:

Server=zabbix-server.dmosk.local

* где zabbix-server.dmosk.local — имя сервера Zabbix.

Теперь открываем командную строку от администратора и выполняем команду для установки агента:

«C:\Program Files\Zabbix Agent\bin\zabbix_agentd.exe» —config «C:\Program Files\Zabbix Agent\conf\zabbix_agentd.conf» —install

* где C:\Program Files\Zabbix Agent — папка, куда мы распаковали архив.

Мы должны увидеть что-то на подобие:

zabbix_agentd.exe [468]: service [Zabbix Agent] installed successfully
zabbix_agentd.exe [468]: event source [Zabbix Agent] installed successfully

Теперь открываем службы Windows и находим «Zabbix Agent» — кликаем по ней правой кнопкой мыши и выбираем Запустить:

Запуск агента Zabbix в службах Windows

Установка завершена.

Настройка брандмауэра

Если в нашей системе работает брандмауэр Windows, необходимо разрешить порт 10050 или приложение zabbix agent.

Для этого переходим в Панель управленияСистема и безопасность — Брандмауэр Windows (или вводим команду control /name Microsoft.WindowsFirewall). Кликаем по ссылке Разрешение взаимодействия с приложением или компонентов в брандмауэре Windows — добавляем наше приложение zabbix_agentd в исключение.

Это же действие можно выполнить в powershell — запускаем ее от администратора и вводим команду:

New-NetFirewallRule -DisplayName «Разрешить приложение Zabbix Agent» -Direction Inbound -Action Allow -EdgeTraversalPolicy Allow -Program «C:\Program Files\Zabbix Agent\bin\zabbix_agentd.exe»

Или мы можем добавить в исключение порт. Это можно сделать также из командной строки poweshell:

New-NetFirewallRule -DisplayName «Разрешить порт 10050 для Zabbix» -Direction Inbound -Action Allow -EdgeTraversalPolicy Allow -Protocol TCP -LocalPort 10050

Проверка работы

Чтобы убедиться в работоспособности агента, мы можем зайти на сервер zabbix и выполнить подключение по telnet, например, командой:

telnet 192.168.1.15 10050

* где 192.168.1.15 — IP-адрес компьютера с установленным Zabbix.

Мы должны увидеть 

Connected to nr-fs-06.
Escape character is ‘^]’.

.. и через небольшой интервал времени:

Connection closed by foreign host.

Но если агент не запущен или не работает, мы увидим ошибку:

telnet: connect to address …: Connection refused

В панели сервера в узлах сети при корректной установке и настройке, мы также должны увидеть доступность компьютера по агенту:

Читайте также

Другие инструкции по Zabbix:

1. Установка и настройка Zabbix-агента на CentOS

2. Установка и начальная настройка сервера мониторинга Zabbix на Ubuntu Server

3. Настройка сервера Zabbix 5 на CentOS 8

In this post, we will look at how to install and configure Zabbix Agent on the Windows platform.

Table of Contents

1. Download Windows Zabbix Agent

1. Download the Windows Zabbix Agent from officially Zabbix website. Below is an example for x64 machine with no encryption. Here is the direct download link https://www.zabbix.com/download_agents and select the following from the given options.

OS Distribution OS Version Hardware Zabbix Version Encryption Packaging
Windows Any amd64 5.2 No encryption MSI

2. You will see the Zabbix Release options as below and usually, you would go for the latest release and click on download.

3. Downloaded file will be a zip file and unzip the file, you will see the below content.

  • bin folder has the following files
  • conf folder has the configuration file

2. Move files on the target endpoint

For this example, my target endpoint is Windows Server 2019 OS (TEKNEX-CA01).

1. Create zabbix folder in the Windows root directory
c:\zabbix

2. Copy below files to newly created zabbix folder

  • bin\zabbix_agentd.exe
  • conf\zabbix_agentd.conf

3. Prepare Windows firewall

By default, Zabbix agent communicates over 10050 port, and I am sticking with the default port.

1. Add port TCP 10050 in the allow list for inbound communication. You could use GUI to achieve this, however, it is easier to run the following PowerShell command. This will add TCP port 10050 in the inbound allow list.
Ensure you apply to the correct profile, TEKNEX-CA01 is part of the domain and this is why I am applying inbound to the Domain profile only. Run the following one-line command in PowerShell as administrator.

New-NetFirewallRule -DisplayName "Allow inbound 10050" -Direction Inbound -Protocol TCP -Action Allow -LocalPort 10050 -Profile Domain

To add this firewall rule to all profiles, you can use the following command. This command will allow inbound port 10050 on Domain, Private and Public profile.

  New-NetFirewallRule -DisplayName "Allow inbound 10050" -Direction Inbound -Protocol TCP -Action Allow -LocalPort 10050 -Profile Any

2. Confirm the rule has been added by running the following command.

Get-NetFirewallRule -DisplayName "Allow inbound 10050"

4. Update Zabbix configuration file

Open zabbix_agentd.conf with any editor, even Windows built-in notepad will do the job. Uncomment the following and update accordingly. Save the file once you make changes.

  • Server
    Provide Zabbix server IP address
  • ListenPort
    Keep this default as 10050, unless you changed it
  • Hostname
    Enter the hostname if your Zabbix does not resolve the hostname to IP address. If your DNS is functioning correctly, you can use the variable system.name
    . To keep things simple, I will just provide hostname manually.

5. Install and Start Zabbix service

1. Browse to zabbix folder on Windows endpoint

2. Select File in the Navigation pane > hover over Windows PowerShell > click Open Windows PowerShell as administrator

3. Run the below command to install Zabbix.

PS C:\zabbix> .\zabbix_agentd.exe -c .\zabbix_agentd.conf -i

You will see this message when you run the above command

4. Run the following command to start Zabbix service or you could start the service from the Task Manager

4. Verify Zabbix agent service in the Task Manager

6. Create a new Group on Zabbix Server

To add a host, we need to create a host group first. If you already have a group then you can skip this part.

1. Login to Zabbix front end > Extend Configuration > Click on Host groups

2. Click on Create host group on the top right hand corner

3. Give a name to new host group and click Add

7. Add a host on Zabbix Server

1. Login to Zabbix front end > Extend Configuration > Click on Hosts

2. Click on Create host on the top right hand corner

3. Enter the following information and click on Add

Host name TEKNEX-CA01 This must match the Zabbix conf file.
Visible Name TEKNEX-CA01 This can be anything meaningful.
Groups MMDM Blog
Agent IP Address 10.0.0.4 The IP address of the endpoint TEKNEX-CA01.
DNS name Leave it blank FQDN of the endpoint. In my case, it could be TEKNEX-CA01.TEKNEX.LOCAL.
Connect to IP Zabbix server will connect to agent via IP address.
Port 10050 This must match the Zabbix conf file. 10050 is the default.
Description Add something meaningful
Monitored by proxy no proxy
Enabled Checked Keep this option checked

You will see something like following once you add a host under Configuration > Hosts

8. Link a template with the host

A host must have a template linked so that Zabbix Agent can report back to Zabbix Server with the requested data. In this step, let’s link a template with our newly added host TEKNEX-CA01.

1. Go to Configuration > Hosts

2. Click on newly added host TEKNEX-CA01

4. On the TEKNEX-CA01 host page, click on Templates

5. Next to Link new templates click on select

6. In the Host group search, type operating systems and click on Templates/Operating Systems

This image has an empty alt attribute; its file name is image-66.png

7. Check Template OS Windows by Zabbix Agent and click on Select

8. Click on update to save changes

9. Check availability

It can take a couple of minutes for the Zabbix server to initiate an initial communication with the endpoint. Once you attach a template, communication might not start straight away and you will see something like below under Configuration > Hosts

Once the communication has initiated, ZBX will turn into green and you would see something like below.

10. Troubleshooting

If you have waited long enough and ZBX did not turn into green, this indicates that there is something not right. Check the following:

  • Inbound port 10500 is opened for the required profile. In the above example, I used Domain Profile because the endpoint is part of a domain.
  • Ping endpoint from the Zabbix server and it should ping successfully
  • Check the log file on the endpoint located in the Windows root directory and it can indicate you if there is an issue

Your feedback is very important. Let me know how did you go in the comments below.

Liked it? Take a second to support Jay Singh on Patreon!

Zabbix is an enterprise-level open-source monitoring system. Currently, Zabbix is one of the most popular and powerful free monitoring systems. Due to its simple installation and configuration, Zabbix may be used to monitor large infrastructures with hundreds of hosts, as well as small configurations. In this article, we’ll show you how to install and configure the basic features of a Zabbix server 5.0  with a web interface on Linux Ubuntu and CentOS, and how to install Zabbix agent on a server running Windows or Linux and add new hosts for monitoring.

You can see the Zabbix server dashboard interface on the screenshot below.

zabbix dashboard

Contents:

  • How to Install Zabbix Server on Linux (Ubuntu, CentOS)
  • Zabbix Web Interface Configuration
  • How to Install Zabbix Agent on Windows
  • How to Add New Host on Zabbix Server
  • Installing Zabbix Agent on Linux

Simple and easy-to-configure Zabbix is written on C (a server, a proxy, and an agent) and PHP (frontend). Zabbix Server and Zabbix Proxy work in Linux systems only. The Zabbix agent can be installed on a wide variety of supported operating systems and platforms.

Zabbix server installation consists of:

  • A zabbix_server binary (usually, it is working as a service);
  • MySQL/MariaDB/PostgreSQL database;
  • Apache2/Nginx web server with a PHP handler;
  • Frontend site files (.php, .js, .css, etc.).

Usually, the operating scheme looks like this:

  • A Zabbix agent sends data to a server;
  • A Zabbix server receives and processes the data;
  • If the received data meets the specified conditions, a trigger is activated;
  • The activated trigger indicates that there is a problem. A notification appears in the frontend (on a site), and depending on the configuration, an email notification is sent or some actions are performed (for example, a monitored service is restarted).

Zabbix can work with all known protocols. Thanks to the ability to use external scripts, Zabbix can execute and receive data from any executable scripts/binaries.

How to Install Zabbix Server on Linux (Ubuntu, CentOS)

In this tutorial, we’ll show how to install Zabbix Server on Linux (Ubuntu Server 18.4 and CentOS 8) using a package manager.

Go to the download page https://www.zabbix.com/download and select the repository that matches your Linux distribution. There are ready packages for all popular Linux distros.

For example, to install Zabbix on Ubuntu 18.04, select the following in turn:

Zabbix Version (5.0 LTS) -> OS Distribution (Ubuntu) -> OS Version (18.04 Bionic) -> Database (MySQL) -> Web server (Nginx or Apache).

download and install zabbix on linux

Download and add the repository:

# wget https://repo.zabbix.com/zabbix/5.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_5.0-1+bionic_all.deb
# dpkg -i zabbix-release_5.0-1+bionic_all.deb
# apt update

Then you can install the required packages:

# apt install zabbix-server-mysql zabbix-frontend-php zabbix-nginx-conf zabbix-agent

apt install zabbix-server-mysql on ubuntu

To install Zabbix on CentOS 8/RHEL 8, connect the repository with the latest Zabbix version (you can install Zabbix from the 4.0/5.0 LTS branch or the latest Zabbix 5.2):

# rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/8/x86_64/zabbix-release-5.0-1.el8.noarch.rpm
# dnf clean all

Suppose that nginx, MySQL/MariaDB, php and php-fpm are already installed on the server. Use the dnf (yum) package manager to install Zabbix Server and the agent:

# dnf install zabbix-server-mysql zabbix-web-mysql zabbix-nginx-conf zabbix-agent

Then create a database for Zabbix in MySQL (you can use PostgreSQL instead of MySQL, just replace ‘mysql’ with ‘pgsql’ in the previous commands).

Create a database and grant permissions to the user account, under which Zabbix will access the DB:

mysql -uroot
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'ZabbixP@$$w0rd';
mysql> quit;

Import the Zabbix database. Enter the password you specified when you created a user.

# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p Zabbix

Edit /etc/zabbix/zabbix_server.conf, specify the password of the user you have created.

DBPassword=Zabbix_User_Password

Since in my case nginx is used as a web server, edit nginx.conf by uncommenting the following lines:

# listen 80;
# server_name example.com;

Remove # and replace example.com with the Zabbix server hostname. In my case, it is test.zabbix.local.

For Apache, edit /etc/httpd/conf.d/zabbix.conf.

Set the time zone in PHP. Uncomment the following line in /etc/zabbix/php-fpm.conf:

php_value[date.timezone] = Canada/Pacific

Make sure that the time on your Zabbix server is synchronized with a reliable NTP time host.

You can also set these PHP parameters in /etc/php.ini:

memory_limit 128M
upload_max_filesize 8M
post_max_size 16M
max_execution_time 300
max_input_time 300
max_input_vars 10000

Add the zabbix-server service to startup and run it:

# systemctl enable zabbix-server zabbix-agent nginx php7.2-fpm
# systemctl restart zabbix-server zabbix-agent nginx php7.2-fpm

Zabbix Web Interface Configuration

Now you must configure Zabbix frontent (web interface). Open the Zabbix server URL specified earlier in a browser. In my case, it is test.zabbix.local (or the domain you have specified. Remember to register it in your hosts file or on the DNS server). Make sure that OK is shown next to all installer requirements.

zabbix install script

Specify the database connection parameters and user credentials to connect to the DB. Use the username and password created earlier.

configure zabbix connection to mysql database

Specify the name of your Zabbix server. I recommend to leave the default port – TCP 10051.

By default, Zabbix uses two network ports:

  • TCP 10050 — passive agent port, which Zabbix server uses to poll clients;;
  • TCP 10051 — port through which Zabbix server receives data from clients (active agents).

Remember to open these ports on the firewall. For example, on a Zabbix server running CentOS you can open the ports in firewalld using firewall-cmd:

# firewall-cmd --add-service={http,https} --permanentfirewall-cmd --add-port={10051/tcp,10050/tcp} –permanent

It is enough to open port 10050 on the agent:

# firewall-cmd --permanent --add-port=10050/tcp

Restart firewalld:

# firewall-cmd –reload

set zabbix server hostname and port 10051

Then click Next Step and Finish. After the installation, you will be prompted to login. The default login is Admin, the default password is zabbix (change it).

Zabbix Server installation is over.

You can find step-by-step instructions on Zabbix Server installation on other OS and guides on how to build zabbix-server from the source code or run it in docker containers on https://www.zabbix.com/download.

You can configure Zabbix to authenticate users using Active Directory LDAP.

To implement SSO, Apache2 with libapache2-mod-auth-kerb module will be used in this article. Nginx will not be discussed here, but it has spnego-http-auth-nginx-module that has to be enabled separately when compiling Nginx.

Configure LDAP authentication in Zabbix. In Zabbix frontend go to LDAP settings tab in Administration -> Authentication. Check Enable LDAP authentication and fill in the following fields:

  • LDAP host: ldap://dc1.domain.local
  • Port: 389
  • Base DN: DC=domain, DC=local
  • Search attribute: sAMAccountName
  • Bind DN: CN=zabbix_admin,OU=Users,DC=domain,DC=local

How to Install Zabbix Agent on Windows

Let’s try to install a Zabbix agent on a server running Windows and add it to our Zabbix monitoring server. You can download a Zabbix agent version for Windows here: https://www.zabbix.com/download_agents.

download zabbix agent for windows server

Select the agent version you need. I will choose msi (amd64) (without OpenSSL). If you are going to install Zabbix Agent on domain servers/computers using GPO or SCCM, you can download a ZIP archive with binary and configuration files.

Run the installer, accept the license agreement, and specify the settings for connecting to the Zabbix server. Please note that in the “Server or Proxy for active checks” field I have entered an IP address in the IP:PORT format. Since I left a default port, I have entered 192.168.20.30:10051.

configure zabbix agent settings on windows

Click Next a couple of times, then click Install.

Make sure that the agent has been installed. Zabbix Agent must appear in the list of services.

zabbixagent windows service

Allow inbound connections from your Zabbix server IP address in Windows Firewall on your Windows host:

New-NetFirewallRule -DisplayName "ZabbixMonitoring" –RemoteAddress 192.168.20.30 -Direction Inbound -Protocol TCP –LocalPort 10050 -Action Allow

How to Add New Host on Zabbix Server

To make sure that the agent is operable, add testnode2 host to your Zabbix server and assign some checks (templates) to it.

Note. There are 2 types of checks in Zabbix:

  • Passive — a Zabbix server requests some data from the agent;
  • Active — the agent is sending data to the server.

During the agent installation, we specified the server as IP:PORT for active checks.

You can add a new monitoring host via Zabbix web interface. Go to Configuration -> Hosts.

Click Create host and fill in the details. Note that the Host name must exactly match the device hostname or the value of the Hostname parameter in the agent configuration file.

adding new host to zabbix

Add built-in Windows templates in the Templates tab. Templates in Zabbix are sets of values, triggers, graphs and discovery rules that may be assigned to one or more hosts.

The built-in templates have “active” label, and which means that active checks will be used.

linking zabbix templates to host

Click Add. In order not to wait till the server and agent see each other (it usually takes a couple of minutes), restart Zabbix Agent service on the testnode2 and view the agent log (C:\Program Files\Zabbix Agent\zabbix_agentd.txt).

restart zabbix agent on linux

zabbix_agentd log file

The “started [active checks #1]” message means that some active checks for the host have been found on the server. Then have a look at the data that your Zabbix server received from the agent. To do it, go to Monitoring -> Latest Data and select the host in the Hosts field.

zabbix host dashboard

This section shows the latest data on the selected host or groups of hosts that have come to the Zabbix server.

Please note that in my case the Zabbix dashboard contains a notification that the BITS service is not running. The notification appeared since we assigned built-in templates to our host. One of the templates has a BITS check, and the corresponding trigger is activated if the BITS service is not in the Running state.

view dashboard in zabbix

The Agent for Windows is configured.

Installing Zabbix Agent on Linux

Let’s install Zabbix Agent on Linux. To install Zabbix Agent on Ubuntu Server 18.04 using a package manager, download and the install Zabbix repo. Then install Zabbix Agent from the repository:
# wget https://repo.zabbix.com/zabbix/5.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_5.0-1+$(lsb_release -sc)_all.deb
# sudo dpkg -i zabbix-release_5.0-1+$(lsb_release -sc)_all.deb
# sudo apt update
# sudo apt -y install zabbix-agent

To add the repository and install Zabbix Agent on CentOS, use these commands:
# rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/8/x86_64/zabbix-release-5.0-1.el8.noarch.rpm
# dnf clean all
# dnf install zabbix-agent

Before starting the Zabbix agent, edit the configuration file /etc/zabbix/zabbix_agentd.conf. Specify the IP address of your Zabbix server for active checks.

Server=IP
ServerActive=192.168.20.30:10051
Hostname=testagent

Then start the agent service:

# service zabbix-agent start

Make sure that the agent has started successfully.

# cat /var/log/zabbix/zabbix_agentd.log

zabbix_agentd.log - cannot parse list of active checks

The line “cannot parse list of active checks” means that there are no active checks for the host on the server.

Like with the Windows agent, you must add your Linux host to Zabbix . Note the Host name parameter in the host settings of your Zabbix server: it must match the Hostname parameter we have specified in the Zabbix Agent configuration file. In the config file above I specified the host name as testagent.

linking zabbix template to linux host

Restart your Zabbix agent and check the log. Make sure that data from the agent have appeared on your Zabbix server. Zabbix agent on Linux is configured.
In the next article, we’ll look at agentless monitoring of host availability in Zabbix via ICMP Ping.

Понравилась статья? Поделить с друзьями:
0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии
  • Windows не распознает сканер
  • Для перемещения этого файла нужно обладать правами администратора windows 10 как убрать
  • No server certificate verification method has been enabled windows
  • Modern setup host windows 10 что это
  • Лучший tweaker для windows 10