Agentless Monitoring - Zabbix

Agentless Monitoring - Zabbix

Guide for Agentless approach using zabbix

What Is Zabbix Agentless Monitoring?

Agentless monitoring allows you to collect system metrics, logs, and performance data without installing a Zabbix agent on the monitored host. Instead, it uses native protocols such as:

  • SSH: For Linux systems, this is the primary protocol used for remote monitoring.
  • SNMP: Useful for networking devices and some servers.
  • IPMI: For hardware health monitoring.
  • HTTP/HTTPS: To monitor web services and APIs.

Why Choose Agentless Monitoring?

  • Ease of Setup: No need to install or configure agents.
  • Lightweight: Ideal for legacy systems or environments with strict compliance requirements.
  • Security: Leverages existing secure communication protocols like SSH.

Zabbix Agentless Monitoring for Linux Machines:

Requirements:

  1. Zabbix Server
  2. Linux Machine with SSH Access
  3. Access Keys or Passwords of linux machine

Step -1: Enable SSH on the Target System

To enable SSH monitoring, ensure the SSH service is running on the target Linux host:

Allow the Zabbix server to connect by adding its public key to the target system:

sudo mkdir -p /root/.ssh
sudo echo "<zabbix-server-public-key>" >> /root/.ssh/authorized_keys
sudo chmod 600 /root/.ssh/authorized_keys        

Step 0: Configure the Zabbix Server

  1. Log in to the Zabbix Web UI.
  2. Navigate to Configuration > Hosts > Create Host.
  3. Fill in the required details:

  • Hostname: Name of the target system.
  • IP/DNS: Address of the Linux host.
  • Templates: Attach relevant templates (e.g., “Template OS Linux by SSH”)

Step 1: Create New Template:

Navigate to Data Collection → Template

Create a New Template

  • Template Name: Template Linux by SSH-Agentless
  • Template groups: Template operating system

Step 2: Create an items

2.1 Master Item:

Navigate to the same template we created and create a new Item.

  • Name: SSH Get
  • Type: SSH agent
  • Key: ssh.run[ssh.get,{$SSH.IP},{$SSH.PORT},,]
  • Type of Information: Text
  • Authentication method: Password
  • Update Interval: As per your monitoring requirement
  • Executed Script:

#!/bin/bash
mpstat && uptime && free        

Step 3: Create Dependent Items

Steps to Configure Dependent Items in Zabbix

  1. Navigate to the host/item where the uptime command output is being collected.
  2. Create the master item (SSH get as output).
  3. Add each dependent item and link them to the master item.
  4. Use the preprocessing rules for each dependent item.
  5. Test the configuration to ensure values are being extracted correctly.

Use SSH get as the master item and extract the following dependent items using preprocessing steps:

3.1 System Uptime

  • Key: ssh..uptime
  • Master item: ssh.get
  • Preprocessing:

Regular expression Pattern: up\s+(.+)?, Result: \1

3.2 Kernel-Version

  • Key: ssh.kernel.version
  • Master item: ssh.get
  • Preprocessing: use Regex to filter kerenl

3.3 Architecture Type (aarch)

  • Key: ssh.arch.type
  • Master item: ssh.get
  • Preprocessing: use Regex to filter aarch

3.4 OS Type

  • Key: ssh.os.type
  • Master item: ssh.get
  • Preprocessing: use Regex to filter OS

3.5 CPU Count

  • Key: ssh.cpu.count
  • Master item: ssh.get
  • Preprocessing: use Regex to filter CPU

3.6 CPU Idle

  • Key: ssh.cpu.idle
  • Master item: ssh.get
  • Preprocessing:

Regular expression Pattern: all\s+[0–9.]+\s+[0–9.]+\s+[0–9.]+\s+[0–9.]+\s+[0–9.]+\s+[0–9.]+\s+[0–9.]+\s+[0–9.]+\s+[0–9.]+\s+([0–9.]+) Result: \1

3.7 Other Metrics (Follow the same process):

  • ssh.cpu.user (User CPU)
  • ssh.cpu.system (System CPU)
  • ssh.cpu.iowait (IO Wait)
  • ssh.cpu.irq (IRQ)

3.8 Memory:

Total Memory

  • Key: ssh.memory.total
  • Master item: ssh.get
  • Type of info: Numeric (unsigned)
  • Preprocessing:

Regular expression: Pattern: .*Mem:\s+(\d+).* Result: \1

  • Custom multiplier: 1024

Other Metrics (Follow the same process):

  • ssh.memory.used (Used Memory)
  • ssh.memory.free (Free Memory)
  • ssh.memory.shared (Shared Memory)
  • ssh.memory.buffcache (Buffer/Cache)
  • ssh.memory.available (Available Memory)

Step 4: Create a Graph

4.1 CPU Utilization Graph

  1. Create a new graph named CPU Utilization.
  2. Add items:

  • ssh.cpu.user
  • ssh.cpu.system
  • ssh.cpu.idle
  • ssh.cpu.iowait

Read full blog here:

Conclusion

Zabbix agentless monitoring provides a powerful and flexible solution for tracking Linux system performance without installing additional software. By leveraging SSH, you can monitor CPU, memory, uptime, and other critical metrics effectively. Start using Zabbix agentless monitoring today and simplify your infrastructure management.

Ready to enhance your monitoring setup? Let us know your favorite Zabbix features in the comments!

DevSecOps — Community ??

Thank you for being a part of the DevSecOps — Community community! Before you go:

要查看或添加评论,请登录

Karthick D的更多文章

社区洞察