Posts Taged zabbix-tutorial

Unlocking Zabbix Proxies: Monitoring Remote Networks Like a Pro

Unlocking Zabbix Proxies: Monitoring Remote Networks Like a Pro

Hey everyone, Dimitri Bellini here, back with another episode on Quadrata (my YouTube channel, @quadrata)! This week, we’re diving deep into Zabbix proxies. I’ve been getting a lot of questions about how these things work, especially when it comes to discoveries and monitoring devices in remote networks. So, let’s get into it!

What is a Zabbix Proxy and Why Do You Need It?

Think of a Zabbix proxy as your monitoring agent in a segregated area. It’s a powerful tool within the Zabbix ecosystem that allows us to:

  • Monitor segregated areas or remote branches: It handles all the checks the Zabbix server would, but closer to the source.
  • Scale horizontally: It can offload work from your main Zabbix server in larger deployments.
  • Reduce bandwidth usage: It collects data locally and transmits it to the Zabbix server in a single, often compressed, transaction.
  • Simplify firewall configurations: You only need to configure one TCP port.
  • Buffer data during connectivity issues: The proxy stores collected data and forwards it when the connection to the Zabbix server is restored.

What Can a Zabbix Proxy Do?

A Zabbix proxy is surprisingly versatile. It can perform almost all the checks your Zabbix server can:

  • SNMP monitoring
  • IPMI checks
  • Zabbix agent monitoring
  • REST API checks
  • Remote command execution for auto-remediation

Key Improvements in Zabbix 7.0

The latest version of Zabbix (7.0) brings some significant enhancements to Zabbix proxies, including:

  • IA Viability: Improved overall stability and performance.
  • Automatic Load Distribution: The Zabbix server intelligently distributes hosts across proxies based on various factors.

Configuring a Zabbix Proxy with SQLite

For smaller setups, SQLite is a fantastic option. Here’s the basic configuration:

  1. Modify zabbix_proxy.conf:

    • Set the Server directive to the IP or DNS name of your Zabbix server.
    • Define the Hostname. This is crucial and must match the proxy name in the Zabbix web interface.
    • Set DBName to the path and filename for your SQLite database (e.g., /var/lib/zabbix/proxy.db). Remember, this is a *file path*, not a database name.

  2. Configure Zabbix Agents: Point the Server or ServerActive directives in your agent configurations to the proxy’s IP address, not the Zabbix server’s.

Remember to always consult the official Zabbix documentation for the most up-to-date and comprehensive information!

Zabbix Proxy Discovery in Action

Now, let’s talk about automatic host discovery using a Zabbix proxy. Here’s how I set it up:

  1. Create a Discovery Rule: In the Zabbix web interface, go to Data Collection -> Discovery and create a new rule.

    • Give it a descriptive name.
    • Set Discovery by to Proxy and select your proxy.
    • Define the IP range to scan. You can specify multiple ranges separated by commas.
    • Adjust the Update interval. Start with something reasonable (like an hour) to avoid network flooding. You can temporarily lower it for testing, but remember to change it back!
    • Configure the Checks. I used ICMP ping, SNMP (to get the system name), and Zabbix agent checks (system.hostname, system.uname).
    • Define Device unique criteria, typically IP address.
    • Specify Hostname and Visible name (I usually use the Zabbix agent’s hostname).

  2. Check Discovery Results: Go to Monitoring -> Discovery to see what the proxy has found.

Pro Tip: Debugging Discovery Issues with Runtime Commands

If you’re not seeing results immediately, don’t panic! Instead of guessing, SSH into your Zabbix proxy server and use the Zabbix proxy binary’s runtime commands:

zabbix_proxy -R help

This will show you available commands. The key one for debugging discovery is:

zabbix_proxy -R loglevel_increase="discovery manager"

This increases the logging level for the discovery manager process, providing much more verbose output in the Zabbix proxy’s log file. This is invaluable for troubleshooting!

Automating Host Onboarding with Discovery Actions

The real magic happens when you automate the process of adding discovered hosts. This is done through Configuration -> Actions -> Discovery actions.

  1. Enable the Default “Autodiscovery Linux Servers” Action (or create your own):

    • The key conditions are:

      • Application equals Discovery (meaning something was discovered).
      • Received value like Linux. This checks if the Zabbix agent’s system.uname value contains “Linux”.

    • The key operations are:

      • Create a host.
      • Add the host to the “Linux servers” host group.
      • (Crucially!) Link a template (e.g., “Template OS Linux by Zabbix agent”).

You can create more sophisticated actions based on other discovered properties, like SNMP data, allowing you to automatically assign appropriate templates based on device type (e.g., Cisco routers, HP printers).

Wrapping Up

While my live demo didn’t go *exactly* as planned (as is the way with live demos!), I hope this has given you a solid understanding of how Zabbix proxies work and how to use them effectively for monitoring remote networks. The key takeaways are understanding the configuration, using discovery rules effectively, and leveraging discovery actions to automate host onboarding.

If you found this helpful, give me a thumbs up! If you have any questions, drop them in the comments below. Also, be sure to join the ZabbixItalia Telegram channel (ZabbixItalia) for more Zabbix discussions. I can’t always answer everything immediately, but I’ll do my best to help. Thanks for watching, and I’ll see you next week on Quadrata!

Read More
Automate Your Zabbix Reporting with Scheduled Reports: A Step-by-Step Guide

Automate Your Zabbix Reporting with Scheduled Reports: A Step-by-Step Guide

Hey everyone, Dimitri Bellini here from Quadrata, your go-to channel for open source and IT insights! It’s fantastic to have you back with me. If you’re enjoying the content and haven’t subscribed yet, now’s a great time to hit that button and help me bring you even more valuable videos. 😉

Today, we’re diving deep into a Zabbix feature that’s been around for a while but is now truly shining – Scheduled Reports. Recently, I’ve been getting a lot of questions about this from clients, and it made me realize it’s time to shed light on this often-overlooked functionality. So, let’s talk about automating those PDF reports from your Zabbix dashboards.

Why Scheduled Reports? The Power of Automated Insights

Scheduled reports might not be brand new to Zabbix (they’ve been around since version 5.2!), but honestly, I wasn’t completely sold on them until recently. In older versions, they felt a bit… incomplete. But with Zabbix 7 and especially 7.2, things have changed dramatically. Now, in my opinion, scheduled reports are becoming a genuinely useful tool.

What are we talking about exactly? Essentially, scheduled reports are a way to automatically generate PDFs of your Zabbix dashboards and have them emailed to stakeholders – think bosses, team leads, or anyone who needs a regular overview without logging into Zabbix directly. We all know that stakeholder, right? The one who wants to see a “green is good” PDF report every Monday morning (or Friday afternoon!). While dashboards are great for real-time monitoring, scheduled reports offer that convenient, digestible summary for those who need a quick status update.

Sure, everyone *could* log into Zabbix and check the dashboards themselves. But let’s be real, sometimes pushing the information directly to them in a clean, professional PDF format is just more efficient and impactful. And that’s where Zabbix Scheduled Reports come in!

Key Features of Zabbix Scheduled Reports

Let’s break down the main advantages of using scheduled reports in Zabbix:

    • Automation: Define parameters to automatically send specific dashboards on a schedule (daily, weekly, monthly) to designated users.
    • Customization: Leverage your existing Zabbix dashboards. The reports are generated directly from the dashboards you design with widgets.
    • PDF Format: Reports are generated in PDF, the universally readable and versatile format.
    • Access Control: Control who can create and manage scheduled reports using user roles and permissions within Zabbix (Admin and Super Admin roles with specific flags).

For more detailed information, I highly recommend checking out the official Zabbix documentation and the Zabbix blog post about scheduled reports. I’ll include links in the description below for your convenience!

Setting Up Zabbix Scheduled Reports: A Step-by-Step Guide

Ready to get started? Here’s how to set up scheduled reports in Zabbix. Keep in mind, this guide is based on a simplified installation for demonstration purposes. For production environments, always refer to the official Zabbix documentation for best practices and advanced configurations.

Prerequisites

Before we begin, make sure you have the following:

    • A running Zabbix server (version 7.0 or higher recommended, 7.2+ for the best experience).
    • Configured dashboards in Zabbix that you want to use for reports.
    • Email media type configured in Zabbix for sending reports.

Installation of Zabbix Web Service and Google Chrome

The magic behind Zabbix scheduled reports relies on a separate component: Zabbix Web Service. This service handles the PDF generation and needs to be installed separately. It also uses Google Chrome (or Chromium) in headless mode to take screenshots of your dashboards and convert them to PDF.

Here’s how to install them on a Red Hat-based system (like Rocky Linux) using YUM/DNF:

    1. Install Zabbix Web Service:
      sudo yum install zabbix-web-service

      Make sure you have the official Zabbix repository configured.

    1. Install Google Chrome Stable:
      sudo yum install google-chrome-stable

      This will install Google Chrome and its dependencies. Be aware that Chrome can pull in quite a few dependencies, which is why installing the web service on a separate, smaller machine can be a good idea for cleaner Zabbix server environments.

Configuring Zabbix Server

Next, we need to configure the Zabbix server to enable scheduled reports and point it to the web service.

    1. Edit the Zabbix Server Configuration File:
      sudo vi /etc/zabbix/zabbix_server.conf
    1. Modify the following parameters:
        • StartReportWriters=1 (Change from 0 to 1 or more, depending on your reporting needs. Start with 1 for testing.)
        • WebServiceURL="http://localhost:10053/report" (Adjust the IP address and port if your web service is running on a different machine or port. 10053 is the default port for Zabbix Web Service).
    1. Restart Zabbix Server:
      sudo systemctl restart zabbix-server
    1. Start Zabbix Web Service:
      sudo systemctl start zabbix-web-service
    1. Enable Zabbix Web Service to start on boot:
      sudo systemctl enable zabbix-web-service

Configuring Zabbix Frontend

One last crucial configuration step in the Zabbix web interface!

    1. Navigate to Administration -> General -> GUI.
    1. Modify “Frontend URL”: Set this to the full URL of your Zabbix frontend (e.g., http://your_zabbix_server_ip/zabbix). This is essential for Chrome to access the dashboards correctly for PDF generation.
    1. Click “Update”.

Creating a Scheduled Report

Now for the fun part – creating your first scheduled report!

    1. Go to Reports -> Scheduled reports.
    1. Click “Create scheduled report”.
    1. Configure the report:
        • Name: Give your report a descriptive name (e.g., “Weekly Server Health Report”).
        • Dashboard: Select the dashboard you want to use for the report.
        • Period: Choose the time period for the report data (e.g., “Previous week”).
        • Schedule: Define the frequency (daily, weekly, monthly), time, and start/end dates for report generation.
        • Recipients: Add users or user groups who should receive the report via email. Make sure they have email media configured!
        • Generated report by: Choose if the report should be generated based on the permissions of the “Current user” (the admin creating the report) or the “Recipient” of the report.
        • Message: Customize the email message that accompanies the report (you can use Zabbix macros here).
    1. Click “Add”.

Testing and Troubleshooting

To test your setup, you can use the “Test” button next to your newly created scheduled report. If you encounter issues, double-check:

    • Email media configuration for recipients.
    • Zabbix Web Service and Google Chrome installation.
    • Zabbix server and web service configuration files.
    • Frontend URL setting.
    • Permissions: In the video, I encountered a permission issue related to the /var/lib/zabbix directory. You might need to create this directory and ensure the Zabbix user has write permissions if you face similar errors. sudo mkdir /var/lib/zabbix && sudo chown zabbix:zabbix /var/lib/zabbix

Why Zabbix 7.x Makes a Difference

I really started to appreciate scheduled reports with Zabbix 7.0 and 7.2. Why? Because these versions brought significant improvements:

    • Multi-page Reports: Finally, reports can span multiple pages, making them much more comprehensive.
    • Enhanced Dashboard Widgets: Zabbix 7.x introduced richer widgets like Top Hosts, Top Items, Pie charts, and Donut charts. These make dashboards (and therefore reports) far more visually appealing and informative.
    • Custom Widgets: With the ability to create custom widgets, you can tailor your dashboards and reports to very specific needs.

These enhancements make scheduled reports in Zabbix 7.x and above a truly valuable tool for delivering insightful and professional monitoring summaries.

Conclusion

Zabbix Scheduled Reports are a fantastic way to automate the delivery of key monitoring insights to stakeholders. While they’ve been around for a while, the improvements in Zabbix 7.x have made them significantly more powerful and user-friendly. Give them a try, experiment with your dashboards, and start delivering automated, professional PDF reports today!

I hope you found this guide helpful! If you did, please give this post a thumbs up (or share!) and let me know in the comments if you have any questions or experiences with Zabbix Scheduled Reports. Don’t forget to subscribe to Quadrata for more open source and IT tips and tricks.

And if you’re in the Zabbix community, be sure to join the ZabbixItalia Telegram channel – a great place to connect with other Zabbix users and get your questions answered. A big thank you for watching, and I’ll see you in the next video!

Bye from Dimitri!

P.S. Keep exploring Zabbix – there’s always something new and cool to discover!


Keywords: Zabbix, Scheduled Reports, PDF Reports, Automation, Dashboards, Monitoring, IT Reporting, Zabbix Web Service, Google Chrome, Tutorial, Guide, Dimitri Bellini, Quadrata, Zabbix 7.2, Zabbix 7.0, Open Source, IT Infrastructure, System Monitoring

Read More