Guest mode. You can read posts without signing up. Comments, ratings, job contacts and your own posts open after you sign up and accept the rules. What is Kommit →

Редакция КоммитРедакция портала
commit 9d66971 · 18 days ago

Monitoring, part 3: Zabbix in practice — Linux and Windows agents, SNMP, websites, and alerts in Telegram

🌐 Machine-translated from Russian. Show original

In this part:

Basic concepts#

The termWhat is
Hostmonitoring object: server, switch, site,
Data itemone metric: CPU load, free space in C:
Triggerproblem condition: "less than 10% space"
Templatea set of elements, triggers, and charts that hangs on nodes
Actionwhat to do about the problem: to whom and how to report
Discovery (LLD)automatic search for disks, interfaces, services,

Rule: do not create elements manually on nodes — use templates.

Linux agent#

On each server (after connecting the repository, as in part 2):

sudo apt install -y zabbix-agent2
sudo nano /etc/zabbix/zabbix_agent2.conf
Server=192.168.1.11
ServerActive=192.168.1.11
Hostname=web01
sudo systemctl restart zabbix-agent2 && sudo systemctl enable zabbix-agent2
sudo ufw allow from 192.168.1.11 to any port 10050 proto tcp

In the interface: Data collection → Hosts → Create host → web01name, group Linux servers, Linux by Zabbix agent template, Agent interface from IP server.

Windows agent#

  1. Download MSI Agent 2 with zabbix.com/download_agents (Windows, amd64, OpenSSL, MSI).
  2. Install by specifying Zabbix server IP and Hostname. Silent installation for GPO or scripts:
msiexec /i zabbix_agent2-8.0.0-windows-amd64-openssl.msi /qn SERVER=192.168.1.11 SERVERACTIVE=192.168.1.11 HOSTNAME=%COMPUTERNAME%

Compare the file name with the download page. The installer will add the rule to the Windows firewall itself.

  1. The node template is Windows by Zabbix agent. There is a separate Active Directory template for domain controllers, and an agent 2 plugin for MS SQL.

Bulk deployment via Group Policies — in the "Active Directory and Group Policies" series.

Agent Encryption (PSK)#

Without encryption, agent data is displayed in plaintext. Enable PSK:

openssl rand -hex 32 | sudo tee /etc/zabbix/agent.psk
sudo chown zabbix:zabbix /etc/zabbix/agent.psk && sudo chmod 400 /etc/zabbix/agent.psk
TLSConnect=psk
TLSAccept=psk
TLSPSKIdentity=web01-psk
TLSPSKFile=/etc/zabbix/agent.psk

The node card → the Encryption tab → PSK, the same identity and key.

Network equipment via SNMP#

On the switch or router, enable SNMPv3 (or v2c with long community only for the IP monitoring server). An example for MikroTik is in the "MikroTik from Zero to Branch Network" series.

In Zabbix: a node with an SNMP interface and manufacturer template: MikroTik by SNMP, Cisco IOS by SNMP, HP Comware, Huawei VRP, TP-LINK by SNMP, or a universal Network Generic Device by SNMP. The template will automatically find all ports and start counting traffic and errors.

UPS (APC by SNMP, etc.), printers (toner level), and NAS (Synology, QNAP) are also connected.

Auto-Discover Network#

Data collection → Discovery → Create discovery rule: range 192.168.1.1-254, ICMP ping, SNMP checks, Zabbix agent. Then the Discovery actions action: found devices are automatically created as nodes with the required templates.

Websites and certificates#

  • Web script (node → Web scenarios): open the homepage, log into your personal account, check response code 200 and the presence of text. Zabbix will show the response time and the step at which it broke.
  • Certificates: Website certificate template by Zabbix agent 2 — will notify you N days before expiration.

Telegram alerts#

  1. Create a bot through @BotFather and get a token. Find out the chat or group ID (for example, through the @userinfobot bot or the getUpdates method).
  2. Alerts → Media types → Telegram (type already built-in, description is zabbix.com/integrations/telegram) → the api_token parameter → the → Enable bot token.
  3. Users → your user → Media → Add: Telegram, Send to — chat ID.
  4. Alerts → Actions → Trigger actions: enable Report problems to Zabbix administrators or create your own action with a condition, such as "importance ≥ Average."

🔐 The bot token is a secret. Do not publish it in chats, screenshots, or repositories.

So you don't get overwhelmed by alerts#

  • The importance of triggers: Information → Disaster. In Telegram, send from High, the rest — to email or dashboard.
  • Dependencies: if the branch router is down, you don't need 30 messages for each PC behind it.
  • Maintenance: alerts are suppressed during work.
  • Escalations: after 15 minutes no reaction — message to the manager.
  • Hysteresis: trigger "CPU > 90% for 5 minutes," not for every spike.

Zabbix is ready. Now Prometheus: Monitoring, Part 4: Prometheus, node_exporter, site checks, and Alertmanager with alerts in Telegram.

Comments 00 участников · 1 гость🔒 Rate and discuss after signing up

Comments · 0

No comments yet.Sign in to comment, rate and see all comments.