<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Fernando Aranha on Medium]]></title>
        <description><![CDATA[Stories by Fernando Aranha on Medium]]></description>
        <link>https://medium.com/@ferspider3?source=rss-c304aef8a5fc------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*g7k4eP5uOeiitTBV</url>
            <title>Stories by Fernando Aranha on Medium</title>
            <link>https://medium.com/@ferspider3?source=rss-c304aef8a5fc------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 15:22:28 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ferspider3/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Configuring and Enabling Nmap (OS Fingerprinting) on ​​Zabbix Server (AlmaLinux / SELinux)]]></title>
            <link>https://medium.com/@ferspider3/configuring-and-enabling-nmap-os-fingerprinting-on-zabbix-server-almalinux-selinux-79d609cebe58?source=rss-c304aef8a5fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/79d609cebe58</guid>
            <dc:creator><![CDATA[Fernando Aranha]]></dc:creator>
            <pubDate>Wed, 05 Aug 2026 15:17:05 GMT</pubDate>
            <atom:updated>2026-08-05T15:17:05.196Z</atom:updated>
            <content:encoded><![CDATA[<p>Problem Description:<br>When attempting to run advanced network checks via the web interface — such as Nmap OS detection (`nmap -O`) — the system blocks execution or displays errors like `pcap_activate FAILED: can’t mmap rx ring: Permission denied`.</p><p>Root Cause:<br>Nmap OS scanning requires direct manipulation of the network interface via the `libpcap` library. AlmaLinux and SELinux natively block background processes (such as the `zabbix_t` user) from creating direct memory rings (mmap rx ring) and accessing raw sockets, as these actions require absolute privileges that the Zabbix service does not possess by default. Additionally, Nmap has a built-in code restriction that natively requires the root user.</p><p>Prerequisites:</p><p>Root access to the Zabbix server.</p><p><strong>nmap</strong> and <strong>policycoreutils-python-utils</strong> packages installed.</p><p>1. Nmap Installation: Ensuring the tool is present on the OS. Run the base package installation on the server:</p><pre>sudo dnf install nmap -y</pre><p>2. Assigning Capabilities to the Binary: Allows network manipulation without root privileges. Inject kernel permissions (capabilities) directly into the original Nmap executable, using `readlink` to avoid issues with symbolic links:</p><pre>sudo setcap cap_net_raw,cap_net_admin,cap_net_bind_service+ep $(readlink -f $(which nmap))</pre><p>3. Script Adjustment in the Zabbix Frontend: Bypasses the source code’s native root check. In the Zabbix web interface, go to Administration &gt; Scripts (or Alerts &gt; Scripts). Create or edit the Nmap script, set it to run on the Zabbix server, and enter the command using the<strong> — privileged</strong> flag:</p><pre>/usr/bin/nmap --privileged -O {HOST.CONN}</pre><p>Note: The <strong>— privileged</strong> flag tells Nmap to rely on kernel capabilities and not abort execution upon detecting that the user is not root.</p><p>4. Creating the Custom SELinux Policy: Creating the unified module with socket and memory permissions. Create the policy file (Type Enforcement) to allow the packet socket, RAM locking (`ipc_lock`), and the direct read mapping required by libpcap. Paste the entire block into the terminal:</p><pre>cat &lt; zabbix_nmap_master.te<br>module zabbix_nmap_master 1.0;<br><br>require {<br>    type zabbix_t;<br>    class packet_socket { create bind ioctl getopt setopt read write map };<br>    class capability { ipc_lock net_raw net_admin };<br>}<br><br>allow zabbix_t self:packet_socket { create bind ioctl getopt setopt read write map };<br>allow zabbix_t self:capability { ipc_lock net_raw net_admin };<br>EOF</pre><p>5. Compilation and Installation of the SELinux Module: Permanent injection of the rules into the AlmaLinux kernel. Compile the text file to generate the binary modules and install the new exception policy into SELinux:</p><pre>checkmodule -M -m -o zabbix_nmap_master.mod zabbix_nmap_master.te<br>semodule_package -o zabbix_nmap_master.pp -m zabbix_nmap_master.mod<br>sudo semodule -i zabbix_nmap_master.pp</pre><p>Validation:<br>In the Zabbix web dashboard, execute the script on any host within the local network. The port report, MAC address, and OS guesses (Aggressive OS guesses) will be successfully returned, confirming that the network sniffer is fully enabled.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*8mWeweMURZuRHkZDx4yKng.png" /><figcaption>NMAP command result in the Zabbix interface</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=79d609cebe58" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Configuring and Enabling MTR (Traceroute) on Zabbix Server (AlmaLinux / SELinux)]]></title>
            <link>https://medium.com/@ferspider3/configuring-and-enabling-mtr-traceroute-on-zabbix-server-almalinux-selinux-abdea94a44ea?source=rss-c304aef8a5fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/abdea94a44ea</guid>
            <dc:creator><![CDATA[Fernando Aranha]]></dc:creator>
            <pubDate>Wed, 05 Aug 2026 14:22:42 GMT</pubDate>
            <atom:updated>2026-08-05T14:22:42.461Z</atom:updated>
            <content:encoded><![CDATA[<p>Problem Description:<br>When attempting to execute the Traceroute script using the `mtr` tool via the Zabbix web interface, the system returns permission errors (e.g., `sh: Permission denied` or `Failure to start mtr-packet`).</p><p>Root Cause:<br>The Red Hat/AlmaLinux ecosystem natively blocks the execution of non-privileged network tools and the opening of raw sockets. Additionally, SELinux confines the Zabbix service to the `zabbix_t` domain, silently blocking (`dontaudit`) requests for advanced network capabilities.</p><p>Prerequisites:</p><p>Root access to the Zabbix server.</p><p>`policycoreutils-python-utils` package installed (for compiling SELinux modules).</p><p>1. MTR Installation and Zabbix Configuration: Ensuring the correct packages and syntax in the frontend. Install the MTR package on the server via the terminal:</p><pre>sudo dnf install mtr -y</pre><p>In the Zabbix web interface, go to Administration &gt; Scripts (or Alerts &gt; Scripts), edit the MTR (Traceroute) script, and ensure the command is configured without `sudo` and set to run on the Zabbix server:</p><pre>/usr/sbin/mtr -m 10 -c10 {HOST.CONN} --report</pre><p>2. Assigning Capabilities (Kernel): Granting network socket permissions to binaries. Modern MTR is split into two binaries. Assign network capabilities directly to the files so they do not require the root user:</p><pre>sudo setcap cap_net_raw,cap_net_admin+ep /usr/sbin/mtr<br>sudo setcap cap_net_raw,cap_net_admin+ep /usr/sbin/mtr-packet</pre><p>3. Creating a Custom SELinux Policy: Writing the rule that resolves the silent block. Since SELinux hides socket blocks, we will manually create the policy file (Type Enforcement). Run the entire block in the terminal to create the zabbix_mtr_master.te file:</p><pre>cat &lt; zabbix_mtr_master.te<br>module zabbix_mtr_master 1.0;<br><br>require {<br>    type zabbix_t;<br>    type netutils_exec_t;<br>    class capability { net_raw net_admin };<br>    class rawip_socket { create bind getopt setopt read write };<br>    class file { execute execute_no_trans getattr open read map };<br>}<br><br>allow zabbix_t netutils_exec_t:file { execute execute_no_trans getattr open read map };<br>allow zabbix_t self:capability { net_raw net_admin };<br>allow zabbix_t self:rawip_socket { create bind getopt setopt read write };<br>EOF</pre><p>4. Compiling and Installing the SELinux Module: Injecting the rules into the security kernel. Compile the text file to generate the binary modules (.mod and .pp) and permanently install the new policy into SELinux:</p><pre>checkmodule -M -m -o zabbix_mtr_master.mod zabbix_mtr_master.te<br>semodule_package -o zabbix_mtr_master.pp -m zabbix_mtr_master.mod<br>sudo semodule -i zabbix_mtr_master.pp</pre><p>Validation:<br>After completing step 4, the MTR tool will be available to the Zabbix daemon. Simply trigger the script execution via the frontend, and the network hop table will be displayed without errors.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/646/1*uMZmj4YYez5QLE2s6TpAug.png" /><figcaption>MTR test on the web interface running successfully</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=abdea94a44ea" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Improving Brother Printer Monitoring with Zabbix: A Real Case Study]]></title>
            <link>https://medium.com/@ferspider3/improving-brother-printer-monitoring-with-zabbix-a-real-case-study-580a278754f9?source=rss-c304aef8a5fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/580a278754f9</guid>
            <category><![CDATA[brother-printer]]></category>
            <category><![CDATA[zabbix]]></category>
            <dc:creator><![CDATA[Fernando Aranha]]></dc:creator>
            <pubDate>Tue, 22 Apr 2025 03:05:22 GMT</pubDate>
            <atom:updated>2025-04-22T14:52:36.120Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YWXhsTSXc9g7xud8yEqh5Q.png" /></figure><p>Given the limitations of the MIBs available on Brother printers, we initially adopted a creative and functional solution: a combination of <strong>Selenium and Python</strong> to perform monitoring via the web interface.</p><p>This project was developed and refined in collaboration with my colleague <strong>Pedro Henrique</strong>, whose insights and technical support were instrumental in shaping and implementing the improvements presented in this case study. Together, we worked through each phase of the solution within the real production environment.</p><p>While effective in certain scenarios, our initial approach introduced a number of challenges that hindered scalability and performance:</p><ul><li><strong>Sequential execution</strong>: each instance of the script had to run individually, making the data collection process slow and inefficient in environments with many printers.</li><li><strong>High resource consumption</strong>: running a browser in graphical mode (even in headless mode) demanded significant <strong>RAM and CPU</strong>, especially when multiple executions occurred simultaneously.</li><li><strong>Cache buildup</strong>: as the script executed, the browser cache grew continuously, leading to increased <strong>disk usage</strong> over time.</li><li><strong>Zabbix timeouts</strong>: since the script often took longer than <strong>30 seconds</strong> to complete, Zabbix would frequently return timeout errors, compromising the reliability of the monitoring process.</li></ul><p>These limitations led us to explore a more efficient alternative. Rather than discarding Selenium and Python altogether, we redesigned the architecture and how these tools were applied. Instead of executing the script directly on the Zabbix server, we migrated it to the <strong>print server (Windows Server)</strong>, which was already in use by the existing ticketing system.</p><p>This new approach brought several benefits: the script was compiled into a Python executable, leveraging Windows-specific libraries, and was configured to run as a background service. It now collects data directly from Brother’s own <strong>BrAdmin4</strong> application, resulting in a <strong>faster, lighter, and more reliable monitoring process</strong> — without exceeding Zabbix’s timeout limit.</p><h3>Phase One: Custom Web Scraping to Bridge SNMP Gaps</h3><p>At the beginning of this project, our goal was to find a way to <strong>monitor toner levels</strong> on Brother printers using Zabbix. Although these devices do offer basic SNMP support through their default MIBs, the exposed data already allowed us to collect key metrics such as <strong>page counters</strong> and <strong>error statuses</strong>.</p><p>However, <strong>toner levels were not available via SNMP</strong>, which led us to explore alternative methods to retrieve this specific information in a reliable and automated way.</p><p>To overcome this limitation, we turned to a more creative workaround: <strong>web scraping using Selenium and Python</strong>. This approach allowed us to access the printer’s internal web interface, extract the necessary data, and send it to Zabbix through custom scripts.</p><p>This initial setup was deployed directly on the <strong>Zabbix server</strong>, where the script was called using <strong>external checks</strong> or custom user parameters. The motivation behind this decision was clear: centralized control, straightforward automation, and full integration with Zabbix’s data pipeline.</p><p>And to a certain extent — it worked.</p><p>We successfully collected the needed information, displayed it on dashboards, and even generated real-time alerts based on toner levels. However, as the number of monitored printers increased, this solution started to show serious limitations — particularly regarding <strong>performance</strong>, <strong>scalability</strong>, and <strong>resource usage</strong>.</p><h4>Implementation Details</h4><p>The solution required several system-level components and Python libraries to function properly:</p><h4>1. System Requirements (on the Zabbix server)</h4><pre># Install Firefox (required for Selenium to work with the browser)<br>sudo yum install firefox<br><br># Install Python 3<br>sudo dnf install python3</pre><h4><strong>2. Python Dependencies</strong></h4><pre>python3 -m pip install beautifulsoup4<br>python3 -m pip install selenium<br>python3 -m pip install webdriver_manager<br>python3 -m pip install geckodriver-autoinstaller</pre><h4>3. Python Script for Toner Monitoring</h4><p>This script used Selenium to log into the printer’s web UI, navigate to the status page, and extract toner level data using BeautifulSoup:</p><pre>#!/usr/bin/python3<br><br>import sys<br>import time<br>from bs4 import BeautifulSoup as bs<br>from selenium import webdriver<br>from selenium.webdriver.firefox.options import Options<br>import geckodriver_autoinstaller<br><br>geckodriver_autoinstaller.install()<br><br># Headless browser setup<br>options = Options()<br>options.add_argument(&#39;--headless&#39;)<br>browser = webdriver.Firefox(options=options)<br><br># Input parameters<br>printer_ip = sys.argv[1]<br>printer_password = sys.argv[2]<br>login_url = f&quot;http://{printer_ip}/general/status.html&quot;<br><br># Login process<br>browser.get(login_url)<br>password_field = browser.find_element(&quot;xpath&quot;, &#39;//*[@id=&quot;LogBox&quot;]&#39;)<br>password_field.send_keys(printer_password)<br>browser.find_element(&quot;xpath&quot;, &#39;//*[@id=&quot;login&quot;]&#39;).click()<br><br>time.sleep(5)<br>browser.get(f&quot;http://{printer_ip}/general/information.html?kind=item&quot;)<br>time.sleep(4)<br><br># Data extraction<br>soup = bs(browser.page_source, &#39;html.parser&#39;)<br>toner_info = str(soup.find_all(&#39;dd&#39;)[16])<br><br># Output toner level<br>if len(toner_info) == 11:<br>    print(toner_info[4:5])<br>else:<br>    print(toner_info[4:6])<br><br>browser.quit()</pre><h4>4. Wrapper Shell Script for Execution</h4><p>A shell script was created to simplify script execution from Zabbix:</p><pre>#!/bin/bash<br>python3 /usr/lib/zabbix/externalscripts/brother_toner_check.py &quot;$1&quot; &quot;$2&quot;</pre><h4>5. Permissions</h4><p>Make sure the script and directory have executable permissions:</p><pre>chmod +x /usr/lib/zabbix/externalscripts/<br>chmod +x /usr/lib/zabbix/externalscripts/brother_toner_check.py<br>chmod +x /path/to/run_brother_toner_check.sh</pre><h4>6. Zabbix Item Configuration and Macro Usage</h4><p>In the Zabbix frontend, each printer’s toner level was collected using the following item key:</p><pre>run_brother_toner_check.sh[&quot;{HOST.CONN}&quot;,&quot;{$PASSWD}&quot;]</pre><p>In this setup:</p><ul><li>{HOST.CONN} resolves to the IP or hostname of the printer.</li><li>{$PASSWD} is a <strong>user macro</strong> defined per host, containing the password required to log in to the printer’s web interface.</li></ul><p>This allowed the same script to be reused across multiple devices with minimal configuration, simply by setting the appropriate macro for each host.</p><h3>Challenges and Limitations</h3><p>Despite its initial success, this solution had a number of serious limitations:</p><ul><li><strong>Sequential Execution</strong>: Each script had to run individually, making it slow and inefficient in environments with many printers.</li><li><strong>Resource Consumption</strong>: Running a browser (even in headless mode) for each call consumed large amounts of <strong>CPU, RAM</strong>, and <strong>disk I/O</strong>.</li><li><strong>Cache Growth</strong>: Firefox’s cache increased with each execution, leading to performance degradation over time.</li><li><strong>Zabbix Timeout</strong>: Scripts often exceeded the <strong>30-second default timeout</strong>, causing failed checks and missing data.</li></ul><p>Ultimately, while the solution <strong>partially solved</strong> the problem, it became a bottleneck in itself — limiting the monitoring system’s efficiency and scalability.</p><h3>Phase Two: Rethinking Monitoring with the Help of Brother’s Official Tool</h3><p>As the limitations of the web scraping approach became more apparent, we began exploring alternative ways to monitor Brother printers more efficiently. This led us to <strong>BrAdmin Professional 4</strong>, Brother’s official management tool for network-connected devices.</p><p>Although initially intended for manual monitoring through a graphical interface, <strong>BrAdmin4 proved to be a valuable resource</strong> for accessing critical device information in a structured and reliable way.</p><blockquote>“BRAdmin Professional 4 (Windows only) is a management tool for network-connected Brother devices that can also be used to view the status of other SNMP-compliant network printing devices.”<em><br> — Brother Official Documentation</em></blockquote><p>BrAdmin4 presents device data — such as <strong>error status</strong>, <strong>supply levels</strong>, and <strong>page counters</strong> — in an Explorer-style interface. While it’s primarily GUI-based, we realized it could be used indirectly to <strong>access consistent and accurate device data</strong> without relying on fragile web scraping techniques.</p><p>Additional benefits included:</p><ul><li>Fleet-wide visibility of printer performance and status at a glance</li><li>Centralized device configuration for multiple printers simultaneously</li><li>Easier firmware update management and error tracking</li></ul><p>This discovery marked a turning point: instead of bypassing SNMP limitations with automation hacks, we began leveraging the <strong>manufacturer’s own ecosystem</strong> to build a more reliable and sustainable monitoring architecture.</p><p>While BrAdmin4 is designed primarily for GUI-based monitoring, we identified a particularly useful feature that aligned perfectly with our goal: <strong>the ability to export detailed device data to a CSV file</strong>.</p><p>This meant that, instead of scraping HTML from individual printer web interfaces, we could now gather <strong>structured, clean, and up-to-date data from a single source</strong>. Although the exported CSV file includes various details — such as page counts, status information, and more — we chose to <strong>extract only the toner level</strong>, which was the missing piece in our existing SNMP-based monitoring setup.</p><p>According to Brother’s official guide, once BrAdmin4 is installed and devices are detected, you can simply select the desired printers and <strong>export their data to a CSV file</strong> with just a few clicks. This file includes all relevant information across your fleet, consolidated into a single, readable spreadsheet.</p><p>This discovery was a game-changer: it gave us access to exactly the kind of data we needed, <strong>in a consistent and automation-friendly format</strong>, without the complexity and fragility of browser automation.</p><p>From here, we began building the next version of our monitoring solution — one that no longer depended on executing scripts from Zabbix, but rather on a <strong>dedicated Windows Server</strong>, already part of our infrastructure, to handle data extraction and integration.</p><h3>Phase Three: Automating BrAdmin4 Data Extraction with Python Script</h3><p>To complete our new monitoring architecture, we developed a custom <strong>Python script</strong> designed to automate the extraction and processing of printer data from the <strong>BrAdmin4 interface</strong>. This script simulates user interaction with the application, exports device data to a CSV file, parses that file, and generates individual output files — one per printer — that can later be accessed by Zabbix.</p><p>Below, we break down the logic behind the script and highlight key improvements over the previous approach.</p><h4>Core Improvements Over the Previous Solution</h4><ul><li><strong>No web scraping</strong>: Instead of using Selenium to parse printer web interfaces, the script leverages BrAdmin4’s built-in <strong>CSV export</strong> functionality, which is more stable and accurate.</li><li><strong>No browser required</strong>: This eliminates the heavy resource consumption caused by headless browsers.</li><li><strong>Windows-native automation</strong>: Built specifically for the Windows Server environment, this script uses libraries like pyautogui and pygetwindow to simulate GUI interactions with minimal overhead.</li><li><strong>Parallel monitoring</strong>: Each device’s data is saved in an individual file, making it easily accessible and scalable.</li></ul><h3>Key Components of the Script</h3><h4>1. Configuration Parameters</h4><pre># ===== CONFIGURATION =====<br>APP_PATH = r&quot;C:\Program Files (x86)\Brother\BRAdmin Professional 4\BRAdminPro4.exe&quot;<br>WAIT_TIME_INITIAL = 10<br>WINDOW_TITLE = &quot;BRAdmin Professional&quot;<br>WORKING_DIR = &quot;C:\\zabbix&quot;<br>CSV_FILE = &quot;DevicesList.csv&quot;<br>LOG_FILE = &quot;execution.log&quot;<br>PROCESS_NAME = &quot;BRAdminPro4.exe&quot;</pre><ul><li>Paths to the BrAdmin4 executable, working directory, output CSV, and log file are defined here.</li><li>The script automatically creates the output directory if it doesn’t exist.</li></ul><h4>2. Logging and Process Control</h4><pre>def log(message, level=&quot;INFO&quot;):<br>...</pre><ul><li>A simple logging system prints messages to both the terminal and a log file.</li><li>Helps trace execution steps and diagnose issues in production.</li></ul><pre>def close_application():<br>...</pre><ul><li>Ensures BrAdmin4 is closed before and after each run, avoiding multiple instances or stale windows.</li></ul><h4>3. <strong>CSV Processing Logic</strong></h4><pre>def process_csv():<br>...</pre><ul><li>Once the CSV is exported from BrAdmin4, the script:</li><li>Parses the file using csv and pandas.</li><li>Identifies each printer’s <strong>Node Name</strong> and <strong>Toner/Ink Volume (Black)</strong>.</li><li>Creates a .txt file per printer, storing the toner level as plain text.</li></ul><blockquote><em>Example: </em><em>printer123.txt → </em><em>67</em></blockquote><ul><li>These .txt files are later read by Zabbix for monitoring.</li></ul><h4>4. <strong>Automation via GUI Simulation</strong></h4><pre>async def run_automation():<br>...</pre><p>Uses pyautogui and pygetwindow to:</p><ul><li>Open BrAdmin4</li><li>Maximize the window</li><li>Select all devices</li><li>Open the context menu</li><li>Export device data to CSV</li></ul><p>Each action is logged and spaced out with asyncio.sleep calls to ensure stable GUI interaction.</p><h4>5. <strong>Continuous Monitoring Loop</strong></h4><pre>while True:<br>    ...<br>    time.sleep(1800)</pre><ul><li>The entire process runs in a <strong>loop</strong>, executing every 30 minutes.</li><li>After each cycle, BrAdmin4 is closed and restarted cleanly to avoid memory leaks or UI issues.</li></ul><h3>Results and Benefits</h3><p>With this new script:</p><ul><li>The monitoring task moved from the Zabbix server to a <strong>dedicated Windows print server</strong>, reducing load.</li><li>Printer data is collected <strong>in bulk</strong>, not sequentially.</li><li>The entire fleet is monitored reliably, and Zabbix can now read toner levels from a simple .txt file for each printer, avoiding timeouts or failures.</li></ul><p>This phase consolidated our transition to a <strong>lightweight, modular, and vendor-aligned monitoring solution</strong> — one that integrates better with our infrastructure and scales with ease.</p><p>Below is the complete Python script developed for this solution. It runs on a Windows Server, automates the export of printer data via <strong>BrAdmin Professional 4</strong>, parses the resulting CSV file, and outputs individual text files with toner information — one per device.</p><p>These text files are later read by Zabbix for monitoring purposes</p><pre>import csv<br>import pyautogui<br>import os<br>import pandas as pd<br>import subprocess<br>import time<br>import pygetwindow as gw<br>import asyncio<br>import pyperclip<br>from datetime import datetime<br><br># ===== CONFIGURATION =====<br>APP_PATH = r&quot;C:\Program Files (x86)\Brother\BRAdmin Professional 4\BRAdminPro4.exe&quot;<br>WAIT_TIME_INITIAL = 10<br>WINDOW_TITLE = &quot;BRAdmin Professional&quot;<br>WORKING_DIR = &quot;C:\\zabbix&quot;<br>CSV_FILE = &quot;DevicesList.csv&quot;<br>LOG_FILE = &quot;execution.log&quot;<br>PROCESS_NAME = &quot;BRAdminPro4.exe&quot;<br><br>os.makedirs(WORKING_DIR, exist_ok=True)<br><br># ===== LOGGING AND UTILITIES =====<br>def log(message, level=&quot;INFO&quot;):<br>    timestamp = datetime.now().strftime(&quot;%Y-%m-%d %H:%M:%S&quot;)<br>    formatted = f&quot;[{timestamp}] [{level}] {message}&quot;<br>    print(formatted)<br>    with open(LOG_FILE, &quot;a&quot;, encoding=&quot;utf-8&quot;) as f:<br>        f.write(formatted + &quot;\n&quot;)<br><br>def close_application():<br>    try:<br>        log(&quot;Attempting to close BRAdmin Professional...&quot;)<br>        subprocess.run([&quot;taskkill&quot;, &quot;/IM&quot;, PROCESS_NAME, &quot;/F&quot;], check=True)<br>        log(&quot;Application closed successfully.&quot;)<br>        time.sleep(2)<br>    except subprocess.CalledProcessError:<br>        log(&quot;Application was not running.&quot;, &quot;INFO&quot;)<br>    except Exception as e:<br>        log(f&quot;Error while closing application: {str(e)}&quot;, &quot;ERROR&quot;)<br><br># ===== CSV PROCESSING =====<br>def process_csv():<br>    log(&quot;Starting CSV processing...&quot;)<br>    column_map = {&#39;black&#39;: -1, &#39;node&#39;: -1}<br><br>    try:<br>        with open(os.path.join(WORKING_DIR, CSV_FILE), &#39;r&#39;, newline=&#39;&#39;, encoding=&#39;utf-8&#39;) as file:<br>            reader = csv.reader(file)<br>            headers = [col.strip() for col in next(reader)]<br><br>            for idx, col in enumerate(headers):<br>                if col == &quot;Toner/Ink Volume (Black)&quot;: column_map[&#39;black&#39;] = idx<br>                elif col == &quot;Node Name&quot;: column_map[&#39;node&#39;] = idx<br><br>            if -1 in column_map.values():<br>                missing = [key for key, val in column_map.items() if val == -1]<br>                log(f&quot;Missing required columns: {missing}&quot;, &quot;ERROR&quot;)<br>                return<br><br>            for row_num, row in enumerate(reader, 1):<br>                node_name = row[column_map[&#39;node&#39;]].strip()<br>                toner_volume = row[column_map[&#39;black&#39;]].strip()<br><br>                if node_name and toner_volume:<br>                    output_file = os.path.join(WORKING_DIR, f&quot;{node_name}.txt&quot;)<br>                    with open(output_file, &#39;w&#39;, encoding=&#39;utf-8&#39;) as f:<br>                        f.write(toner_volume)<br>                    log(f&quot;Generated file: {output_file} (Volume: {toner_volume}%)&quot;)<br>                else:<br>                    log(f&quot;Incomplete data at row {row_num}&quot;, &quot;WARNING&quot;)<br><br>        log(&quot;CSV processing completed.&quot;)<br><br>    except Exception as e:<br>        log(f&quot;Error while processing CSV: {str(e)}&quot;, &quot;ERROR&quot;)<br>        raise<br><br># ===== BRADMIN AUTOMATION =====<br>async def run_automation():<br>    try:<br>        log(&quot;Starting BRAdmin automation...&quot;)<br>        subprocess.Popen(APP_PATH, shell=True)<br>        log(&quot;Waiting for application to load...&quot;)<br>        await asyncio.sleep(WAIT_TIME_INITIAL)<br><br>        window = gw.getWindowsWithTitle(WINDOW_TITLE)[0]<br>        window.activate()<br>        log(&quot;Window activated.&quot;)<br>        await asyncio.sleep(1)<br><br>        pyautogui.hotkey(&#39;win&#39;, &#39;up&#39;)<br>        log(&quot;Window maximized.&quot;)<br><br>        actions = [<br>            (&quot;Clicking on the devices tab...&quot;, lambda: pyautogui.click(120, 41)),<br>            (&quot;Selecting all printers...&quot;, lambda: pyautogui.hotkey(&#39;ctrl&#39;, &#39;a&#39;)),<br>            (&quot;Opening context menu...&quot;, lambda: pyautogui.rightClick(347, 186)),<br>            (&quot;Navigating export options...&quot;, lambda: [pyautogui.press(&#39;tab&#39;) for _ in range(3)]),<br>            (&quot;Confirming export...&quot;, lambda: pyautogui.press(&#39;enter&#39;)),<br>            (&quot;Pasting output path...&quot;, lambda: [pyperclip.copy(WORKING_DIR), pyautogui.hotkey(&#39;ctrl&#39;, &#39;v&#39;)]),<br>            (&quot;Finalizing operation...&quot;, lambda: [pyautogui.press(&#39;enter&#39;)] * 2),<br>            (&quot;Selecting &#39;Yes&#39;...&quot;, lambda: pyautogui.press(&#39;tab&#39;)),<br>            (&quot;Completing export...&quot;, lambda: [pyautogui.press(&#39;enter&#39;)] * 2)<br>        ]<br><br>        for description, action in actions:<br>            log(description)<br>            action()<br>            await asyncio.sleep(1)<br><br>        log(&quot;Export operation completed successfully.&quot;)<br><br>    except Exception as e:<br>        log(f&quot;Critical error: {str(e)}&quot;, &quot;ERROR&quot;)<br><br># ===== MAIN EXECUTION LOOP =====<br>if __name__ == &quot;__main__&quot;:<br>    log(&quot;==== MONITORING STARTED ====&quot;)<br>    try:<br>        while True:<br>            log(&quot;==== NEW EXECUTION CYCLE STARTED ====&quot;)<br>            try:<br>                close_application()<br>                asyncio.run(run_automation())<br>                process_csv()<br>            except Exception as e:<br>                log(f&quot;Execution failed: {str(e)}&quot;, &quot;ERROR&quot;)<br>            finally:<br>                close_application()<br>                log(&quot;==== EXECUTION CYCLE FINISHED ====&quot;)<br><br>            log(&quot;Waiting 30 minutes before next run...\n&quot;)<br>            time.sleep(1800)<br><br>    except KeyboardInterrupt:<br>        log(&quot;Monitoring interrupted by user.&quot;, &quot;INFO&quot;)<br>    except Exception as e:<br>        log(f&quot;Main loop error: {str(e)}&quot;, &quot;ERROR&quot;)<br>    finally:<br>        close_application()<br>        log(&quot;==== MONITORING ENDED ====&quot;)</pre><h3>Phase Four: Automating Execution and Monitoring with Zabbix</h3><p>After building and validating our automation script, the next step was to ensure it could run <strong>autonomously and reliably in production</strong>. The goal was to eliminate the need for any manual intervention by turning the script into a <strong>Windows service</strong>, ensuring periodic execution and seamless integration with <strong>Zabbix</strong>.</p><p>In this phase, we:</p><ul><li><strong>Compiled the Python script into a standalone executable</strong>, removing dependency on a Python environment.</li><li><strong>Configured the executable to run as a background service</strong> on the Windows print server.</li><li><strong>Exposed the toner level values to Zabbix</strong> by writing them to individual .txt files, which Zabbix reads remotely via agent items.</li></ul><p>This final step completed the automation pipeline, resulting in a <strong>resilient and low-maintenance solution</strong> for monitoring printer toner levels at scale.</p><h3>Steps to Package and Deploy the Service</h3><h4>1. Compile the Python Script into an Executable</h4><p>We used pyinstaller to convert the script into a single .exe file:</p><pre>pip install pyinstaller<br><br>pyinstaller --onefile --noconsole bradmin_monitor.py</pre><ul><li>--onefile: bundles everything into one executable.</li><li>--noconsole: suppresses the command-line window when running in background.</li></ul><p>The result is a single .exe file, which can be scheduled or run as a service.</p><h4>2. Install as a Windows Service</h4><p>We used <strong>NSSM (Non-Sucking Service Manager)</strong> to register the executable as a service:</p><ul><li>Download <a href="https://nssm.cc/">NSSM</a></li><li>Run:</li></ul><pre>nssm install BrAdminMonitorService</pre><p>In the NSSM setup window:</p><ul><li><strong>Path</strong>: point to the compiled .exe</li><li><strong>Startup directory</strong>: your working directory (e.g., C:\zabbix)</li><li><strong>Startup type</strong>: set to “Automatic”</li></ul><p>Once installed, start the service via:</p><pre>nssm start BrAdminMonitorService</pre><p>The script will now run in the background every 30 minutes as defined in its logic.</p><h4>3. Configure Zabbix to Read Toner Data</h4><p>On each printer’s host in Zabbix, we created an item to read the corresponding .txt file via <strong>Zabbix Agent (or Agent Active)</strong>.</p><p>Example item key:</p><pre>vfs.file.contents[&quot;C:\zabbix\printer123.txt&quot;]</pre><p>This will return the current toner level (as a percentage), previously written by the script.</p><p>To handle multiple printers, each one must have a corresponding Node Name (printer123, printerABC, etc.), and a matching .txt file generated by the script.</p><p>You can also use a <strong>user macro</strong> for dynamic paths:</p><pre>vfs.file.contents[&quot;C:\zabbix\{$PRINTER_NODE}.txt&quot;]</pre><p>Where {$PRINTER_NODE} is defined per host.</p><h3>Outcome</h3><p>With this phase completed, we achieved:</p><ul><li>Full automation from data extraction to visualization</li><li>Reduced server load (processing moved off the Zabbix server)</li><li>High reliability and easier maintenance</li><li>Real-time toner level monitoring without relying on SNMP or unstable scraping</li></ul><p>This solution has been running in production with excellent stability and scalability.</p><h3>Conclusion: A Reliable and Scalable Monitoring Solution</h3><p>This case study demonstrates how a real-world infrastructure challenge — monitoring Brother printers with limited SNMP support — led us to explore, iterate, and ultimately build a robust and scalable solution.</p><p>Through each phase, we evolved from a <strong>browser-based workaround</strong> to a <strong>native, service-oriented integration</strong> using the vendor’s own tools. By leveraging <strong>BrAdmin4</strong>, automating data extraction, and integrating directly with Zabbix, we achieved significant improvements in our monitoring environment.</p><h3>Key Improvements</h3><ul><li><strong>Stability</strong>: The solution no longer relies on fragile web scraping or browser automation.</li><li><strong>Performance</strong>: Bulk data collection reduced execution time and system load.</li><li><strong>Modularity</strong>: Each printer’s data is isolated, making it easy to scale, debug, or customize.</li><li><strong>Low Maintenance</strong>: Running as a background service, the script requires no manual interaction.</li><li><strong>Vendor-Aligned</strong>: By using Brother’s official tools (BrAdmin4), we reduced the risk of breaking changes and ensured better compatibility.</li></ul><h3>Acknowledgments</h3><p>This case study was the result of a collaborative effort, and I would like to sincerely thank <strong>Pedro Henrique</strong> for his essential contributions throughout the project. His technical input, practical insights, and support during implementation were crucial to the success of this solution.</p><p>The improvements achieved in this monitoring architecture are a reflection of <strong>teamwork, experimentation, and shared problem-solving</strong> within a real production environment.</p><p>To the broader IT team involved in maintaining and supporting the infrastructure — thank you as well for enabling a space where solutions like this can be developed, tested, and deployed.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=580a278754f9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Error: Windows performance counters are not collecting or updating correctly]]></title>
            <link>https://medium.com/@ferspider3/error-windows-performance-counters-are-not-collecting-or-updating-correctly-d5c4a8dae6f5?source=rss-c304aef8a5fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/d5c4a8dae6f5</guid>
            <category><![CDATA[zabbix-agent]]></category>
            <category><![CDATA[zabbix]]></category>
            <dc:creator><![CDATA[Fernando Aranha]]></dc:creator>
            <pubDate>Mon, 17 Mar 2025 14:19:11 GMT</pubDate>
            <atom:updated>2025-03-17T14:20:10.013Z</atom:updated>
            <content:encoded><![CDATA[<p>Zabbix relies on Windows performance counters to monitor system metrics. However, these counters may fail to initialize, leading to missing data or failures in collecting information through the Zabbix agent. This article provides solutions to restore performance counters and ensure proper metric collection in Zabbix.</p><p>When executing the following <strong>PowerShell</strong> command:</p><pre>Get-Counter -ListSet * | Where-Object CounterSetName -Match &#39;Pro*&#39; | Select-Object -Property CounterSetName</pre><p>And receiving an output similar to:</p><pre>CounterSetName<br>--------------<br>Processor Information<br>Per Processor Network Activity Cycles<br>Per Processor Network Interface Card Activity<br>GPU Process Memory<br>IPsec DoS Protection<br>SQL Server 2017 XTP Phantom Processor<br>Hyper-V Hypervisor Root Virtual Processor<br>Hyper-V Hypervisor Logical Processor</pre><p>Or if the Zabbix log (zabbix_agentd.log) displays the following error message:</p><pre>Failed to initialize builtin counter: System<br>Failed to initialize builtin counter: Processor<br>Failed to initialize builtin counter: Processor Information<br>Failed to initialize builtin counter: Terminal Services<br>Failed to initialize builtin counter: Processor Queue Length<br>Failed to initialize builtin counter: System Up Time<br>Failed to initialize builtin counter: % Processor Time<br>Failed to initialize builtin counter: % Processor Time<br>Failed to initialize builtin counter: Total Sessions</pre><h3>Solution</h3><ol><li>Open <strong>PowerShell</strong> as Administrator.</li><li>Run the following command to restore the registry settings for performance counters:</li></ol><pre>LODCTR /R</pre><p>3. After completion, run the following command to restore the performance counters for the <strong>SysWow64</strong> architecture:</p><pre>LODCTR /R SysWow64</pre><h3>Explanation of Commands</h3><p>These commands restore the registry settings for performance counters and the explanatory text of the current registry settings. Additionally, they restore cached performance-related files associated with the registry.</p><h3>Alternative Solution</h3><p>If the issue persists, follow these steps:</p><ol><li>Open the <strong>Registry Editor</strong> (<strong>regedit</strong>).</li><li>Navigate to the following path:</li></ol><pre>HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\PerfOS\Performance</pre><p>3. Locate the key <strong>Disable Performance Counters</strong>.</p><p>4. Change its value from 0 to 1.</p><p>5. Restart the system and try again.</p><p>After completing these steps, the performance counters should be properly reactivated, and the data in Zabbix should be collected correctly.</p><p>Reference: <a href="https://www.zabbix.com/documentation/current/en/manual/config/items/perfcounters">https://www.zabbix.com/documentation/current/en/manual/config/items/perfcounters</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d5c4a8dae6f5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Resolving installation/upgrade error: Zabbix Agent Setup Wizard ended prematurely]]></title>
            <link>https://medium.com/@ferspider3/resolving-installation-upgrade-error-zabbix-agent-setup-wizard-ended-prematurely-d8274d311b71?source=rss-c304aef8a5fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/d8274d311b71</guid>
            <category><![CDATA[zabbix]]></category>
            <category><![CDATA[zabbix-agent]]></category>
            <dc:creator><![CDATA[Fernando Aranha]]></dc:creator>
            <pubDate>Mon, 17 Mar 2025 13:29:42 GMT</pubDate>
            <atom:updated>2025-03-17T13:29:42.941Z</atom:updated>
            <content:encoded><![CDATA[<p>If you encounter the error “Zabbix Agent Setup Wizard ended prematurely” during the installation or update of Zabbix Agent, follow the steps below to resolve the issue.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/390/1*2AYLWRz1LYBlo1vC-7Iotg.png" /><figcaption>Zabbix Agent Setup Wizard ended prematurely</figcaption></figure><h3>Check and Remove Existing Service</h3><ol><li>If the Zabbix Agent service is listed in services.msc, open <strong>Command Prompt (CMD)</strong> as Administrator and run:</li></ol><pre>sc delete &quot;Zabbix Agent&quot;</pre><p>2. Try reinstalling the agent.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/388/1*xdu-FCY5pjdPkhKYjzbg_w.png" /><figcaption>Installation successful</figcaption></figure><h3>Alternative Solution if the Error Persists</h3><p>If the error continues after reinstalling, follow these steps:</p><ol><li>Extract the *.msi file using <strong>7-Zip</strong> or another extraction tool.</li><li>Copy the zabbix_agentd.d folder to the desired directory.</li><li>Start the Zabbix service manually:</li></ol><pre>zabbix_agentd.exe --start</pre><p>4. If the service does not start, try installing it again:</p><pre>zabbix_agentd.exe --install</pre><p>5. Try starting the service again:</p><pre>zabbix_agentd.exe --start</pre><p>6. If the error persists, remove the service and try again:</p><pre>sc delete &quot;Zabbix Agent&quot;</pre><p>7. Start the agent using the following command (ensure you are inside the Zabbix folder in CMD):</p><pre>zabbix_agentd.exe -c c:/zabbix/zabbix_agentd.conf -i</pre><p><strong>Note:</strong> The folder C:\zabbix is just an example. Make sure to execute the commands in the directory where Zabbix is installed in your environment.</p><h3>Solution for Service Startup Error (Error 1053)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/568/0*38vslxUz4FESTCxz.jpg" /><figcaption>Error 1053</figcaption></figure><p>If the service does not start and returns <strong>Error 1053: The service did not respond to the start request in a timely fashion</strong>, follow these steps:</p><ol><li>Try starting the service via <strong>services.msc</strong>.</li><li>If the service does not start, remove it with the following command:</li></ol><pre>zabbix_agentd.exe --uninstall</pre><p>3. Open the registry editor (<strong>regedit</strong>) and navigate to the following key:</p><pre>HKEY_LOCAL_MACHINE/SYSTEM/ControlSet001/services/ZabbixAgent</pre><p>4. Modify the <strong>ImagePath</strong> key to:</p><pre>&quot;C:\zabbix\zabbix_agentd.exe&quot; --config &quot;C:\zabbix\zabbix_agentd.conf&quot;</pre><ol><li>Restart the computer to ensure the registry changes are applied correctly.</li><li>After restarting, try starting the service again via <strong>services.msc</strong> or using the command:</li></ol><pre>zabbix_agentd.exe --start</pre><p>3. If the error persists, check for missing dependencies such as required libraries or improper permissions in the Zabbix directory.</p><p>4. If necessary, reinstall Zabbix Agent and follow these steps again.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d8274d311b71" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Displaying the most recent item data in the trigger as the corresponding event is triggered]]></title>
            <link>https://medium.com/@ferspider3/displaying-the-most-recent-item-data-in-the-trigger-as-the-corresponding-event-is-triggered-3e36c56e5a30?source=rss-c304aef8a5fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/3e36c56e5a30</guid>
            <dc:creator><![CDATA[Fernando Aranha]]></dc:creator>
            <pubDate>Thu, 29 Feb 2024 20:26:50 GMT</pubDate>
            <atom:updated>2024-02-29T20:26:50.533Z</atom:updated>
            <content:encoded><![CDATA[<p>In this article, we will explore how to display data from a specific item in a trigger and the process to display it when the trigger is activated. To begin, it’s essential to understand the nature and operation of a trigger:</p><p>According to Zabbix documentation, a trigger is defined as:</p><blockquote>“Triggers are logical expressions that “evaluate” data gathered by items and represent the current system state.</blockquote><blockquote>While items are used to gather system data, it is highly impractical to monitor these data continuously waiting for a condition that is alarming or deserves attention. The job of “evaluating” data can be left to trigger expressions.</blockquote><blockquote>Trigger expressions allow defining a threshold of what state of data is “acceptable”. Therefore, should the incoming data exceed the acceptable state, a trigger is “fired” — or changes its status to PROBLEM.”</blockquote><p>With a basic understanding of their operation, we can move on to displaying data in the trigger.</p><p>A trigger is associated with a specific event, related to an item, which is already configured to alert about specific conditions of a service, hardware component, or software.</p><h3>Example of using Macros in Triggers</h3><p>To illustrate, consider a trigger configured with a Zabbix Agent macro for Linux, where the data returned by the LLD macros {#FSNAME} (file system name) and {#FSTYPE} (file system type) are used. These data are derived from the macro {$VFS.FS.PUSED.MAX.CRIT}, which specifies the critical limit of file system usage percentage.</p><p>Name: {#FSNAME}: Disk space is low Event name: {#FSNAME}: Disk space is low (used &gt; {$VFS.FS.PUSED.MAX.WARN:”{#FSNAME}”}%) Operational data: Space used: {ITEM.LASTVALUE3} of {ITEM.LASTVALUE2} ({ITEM.LASTVALUE1})</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/591/1*dbKhv17OApz272CXITILqg.png" /><figcaption>Linux by Zabbix agent — Viewing Trigger prototypes</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/949/1*W97h9IEimVqwoTP9HuIsEw.png" /><figcaption>Linux by Zabbix agent — Looking at the macros</figcaption></figure><p>The explanation is detailed as follows:</p><blockquote>Two conditions should match:</blockquote><blockquote>The first condition — utilization of the space should be above {$VFS.FS.PUSED.MAX.CRIT:&quot;{#FSNAME}&quot;}.</blockquote><blockquote>The second condition should be one of the following:</blockquote><blockquote>the disk free space is less than {$VFS.FS.FREE.MIN.WARN:&quot;{#FSNAME}&quot;};</blockquote><blockquote>the disk will be full in less than 24 hours.</blockquote><p>When the specified event occurs, the trigger is activated:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/240/1*98W5FnvKx0HYwZ480vIy0g.png" /><figcaption>Trigger is a activated</figcaption></figure><h3>Example of using Item values in macros</h3><p>To illustrate our example, we will use a trigger that fires when there are packet errors on the gateway:</p><pre>Gateway {#GATEWAY} is experiencing packet loss: {ITEM.LASTVALUE} loss</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/588/1*ndjdyWPSq0w6e2fHDaSbuA.png" /><figcaption>Configuration of Gateway</figcaption></figure><p>As it is only displaying the returned data, it will be displayed normally:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/326/1*XaIyZUs3J7ozdNKpa3gluQ.png" /><figcaption>Trigger is a activated</figcaption></figure><h3>Operational data of problems</h3><p>As per Zabbix documentation:</p><blockquote>It is possible to display operational data for current problems, that is, the latest item values as opposed to the item values at the time of the problem.</blockquote><blockquote>The display of operational data can be configured in the filter of Monitoring → Problems or in the configuration of the respective dashboard widget, by selecting one of the three options:</blockquote><blockquote>None — no operational data is displayed<br>Separately — operational data is displayed in a separate column</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*0eXR8TcZHaWTxWiR.png" /><figcaption>Zabbix Documentation: Viewing Current Data in Operational Data</figcaption></figure><blockquote>With problem name — operational data is appended to the problem name and in parentheses. Operational data are appended to the problem name only if the Operational data field is non-empty in the trigger configuration.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*B45FySIW43WUdicf.png" /><figcaption>Zabbix Documentation: Viewing Current Data in problem name</figcaption></figure><p>In this way, we can display the relevant data in the trigger at the time of its execution.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3e36c56e5a30" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating Realistic Icons for Zabbix for Use in Maps]]></title>
            <link>https://medium.com/@ferspider3/creating-realistic-icons-for-zabbix-for-use-in-maps-1d72db23c4d5?source=rss-c304aef8a5fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/1d72db23c4d5</guid>
            <dc:creator><![CDATA[Fernando Aranha]]></dc:creator>
            <pubDate>Thu, 29 Feb 2024 13:33:59 GMT</pubDate>
            <atom:updated>2024-02-29T13:33:59.598Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*obMY0J66yQRO6tOU" /><figcaption>Creating realistic icons for use on the Zabbix map</figcaption></figure><p>In this article, I’ll explain how to create realistic icons based on actual images for use in your environment, to achieve a more realistic presentation of your setup or for general icon creation. Let’s get started!</p><p><strong>What You’ll Need:</strong></p><ol><li>Icon Editor (In this article, we’ll use IcoFx version 1.6.4)</li><li>Images you want to use!</li><li>And of course, Zabbix.</li></ol><p>As a starting point, I’ve chosen an image of the Dell PowerEdge T150 server for reference:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/982/0*ARpy1wUYqhdQN-fY" /><figcaption>Image — Dell PowerEdge T150 server</figcaption></figure><p>As a starting point, I’ve chosen an image of the Dell PowerEdge T150 server for reference:</p><p>Preferably use PNG images with transparency to ease manipulation in the icon editing software.</p><p>After downloading, organize everything into a folder to streamline the organization of the generated icons and the construction of the images.</p><p>Import the image by going to File &gt; Import Image:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/244/0*gdw5bjEd_1Ck9XRQ" /><figcaption>IcoFx version 1.6.4 — Import Image</figcaption></figure><p>Select the desired image, and after selection, the following screen will be presented. Choose the initial desired size (128x128):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/504/0*GGv6AV73g_B4JUuo" /><figcaption>IcoFx version 1.6.4 — Choose the initial desired size (128x128)</figcaption></figure><p>Adjust the image selection for a perfect fit within the frame to be used:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/677/0*ZlquV49y2Ipy_PLh" /><figcaption>IcoFx version 1.6.4 — Adust the image</figcaption></figure><p>After importing, you need to create icon sizes for exporting the images.</p><p>The sizes should be created in 48x48, 64x64, 96x96, and 128x128 pixels. After creating the first image, simply create the sequence of icons by going to New Image:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/668/0*Lmr6KK16Coi4eu15" /><figcaption>IcoFx version 1.6.4 — New Image</figcaption></figure><p>A dialog box will open, just enter the size, in this example, 96x96:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/878/0*_rxRoyta9YSRB2aA" /><figcaption>IcoFx version 1.6.4 — Enter the size 96x96</figcaption></figure><p>Repeat this step for all remaining sizes:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/669/0*RpCWThxqa7h46iJP" /><figcaption>IcoFx version 1.6.4 — All sizes</figcaption></figure><p>Done! After completing this step, export them in PNG format to the desired folder. To do this, export each image and rename them for easy location. To facilitate location, I used the same standardization that Zabbix uses, which is the name of the image, followed by its size, and an underscore between the two pieces of information.</p><p>To export, simply go to Export Image for each size to save the image. Save it in PNG format.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/663/0*iO8IOzlivHx4gX80" /><figcaption>IcoFx version 1.6.4 — Export Image</figcaption></figure><p>After this step, the images will be saved in the desired folder:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/427/0*M0OIBmOTdKjMImaL" /><figcaption>All PNG files</figcaption></figure><p>Now, import each image into Zabbix by going to Administration &gt; General &gt; Images and then clicking on the Create icon button. Simply create the icon with the corresponding image and size:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/763/1*gQvtW3DkpjgyrKRT1_bBTw.png" /><figcaption>Zabbix — Adding the icon</figcaption></figure><p>After creating the icons, they should be displayed as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/0*8O6w8rEuBlRpaR-e" /><figcaption>Zabbix — Viewing the icons after import</figcaption></figure><p>Now, you’re ready to use them in your maps!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/1*5syJT3aAU0A2RWXslgWE8A.png" /><figcaption>Zabbix — Viewing the icon on the zabbix map</figcaption></figure><p>In this article, we used Zabbix 6.0.5 in our test environment.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1d72db23c4d5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Enabling Zabbix Agent (Windows) to Accept Remote Commands]]></title>
            <link>https://medium.com/@ferspider3/enabling-zabbix-agent-windows-to-accept-remote-commands-2597c40259b6?source=rss-c304aef8a5fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/2597c40259b6</guid>
            <dc:creator><![CDATA[Fernando Aranha]]></dc:creator>
            <pubDate>Thu, 29 Feb 2024 12:49:49 GMT</pubDate>
            <atom:updated>2024-02-29T12:49:49.023Z</atom:updated>
            <content:encoded><![CDATA[<p>Navigate to the directory where the Zabbix agent is installed and find the <strong>zabbix_agentd.conf</strong> file. Open it with your preferred text or code editor.</p><p>In our example, we’re using Notepad++. The option to be inserted can be found starting from line 83:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zC63jZS-VfV-6Dxj" /><figcaption>Finding line 83 — Notepad++</figcaption></figure><p>Previously, we used the following option to enable remote commands:</p><pre>EnableRemoteCommands=1</pre><p>However, in more recent versions (5.0+), the following directive is used in the configuration file:</p><pre>AllowKey=system.run[*]</pre><p>After adding the directive, your configuration file should look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*nz9P70HTaF_ITwL2" /><figcaption>Including the command — Notepad++</figcaption></figure><p>Save the file and restart the Zabbix Agent service by navigating to “<strong>Services &gt; Zabbix Agent”</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/834/1*VRjI9bAh3ltyLzaLJ0kNnw.png" /><figcaption>Restarting zabbix agent service — Windows Services</figcaption></figure><p>That’s it! You’re now ready to test any command/script via the Zabbix server!</p><p>This configuration has been tested with Zabbix version 5.4.5 on CentOS 8.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2597c40259b6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Entering MAC address for automatic discovery of network interfaces in the Zabbix environment]]></title>
            <link>https://medium.com/@ferspider3/entering-mac-address-for-automatic-discovery-of-network-interfaces-in-the-zabbix-environment-78914aef16be?source=rss-c304aef8a5fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/78914aef16be</guid>
            <dc:creator><![CDATA[Fernando Aranha]]></dc:creator>
            <pubDate>Mon, 29 Jan 2024 18:54:11 GMT</pubDate>
            <atom:updated>2024-01-30T14:53:23.125Z</atom:updated>
            <content:encoded><![CDATA[<p>Introduction: This step-by-step guide will walk you through modifying the standard Windows template in Zabbix to include the capture of MAC addresses from network interfaces. This enhancement aims to facilitate better network monitoring and management within your Zabbix environment.</p><p>Updating the WMI Key for MAC Address Capture</p><ol><li>Navigating to the WMI Key: Go to Data Collection / Templates / Windows by Zabbix agent / Items / Get WMI Network Interfaces.</li><li>Editing the Key: In the key field, update to the following WMI query:</li></ol><pre>wmi.getall[root\cimv2,&quot;select Name,Description,NetConnectionID,Speed,AdapterTypeId,NetConnectionStatus,GUID,MACAddress from win32_networkadapter where PhysicalAdapter=True and NetConnectionStatus&gt;0&quot;]</pre><p>3. Updating the Configuration: Confirm the changes by clicking “Update”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/755/1*4GYc-Cie_LVxFOTgrw7fcw.png" /><figcaption>Updating the WMI key</figcaption></figure><p>Updating the Discovery Rule</p><ol><li>Accessing the Discovery Rule: Navigate to Data Collection / Templates / Windows by Zabbix agent / Discovery Rules / Network interface discovery / Item prototypes.</li><li>Creating a New Item Prototype: Select “Create Item Prototype”.</li><li>Configuring the Item Prototype: Set the following parameters:</li></ol><ul><li>Name: Interface {#IFNAME}({#IFALIAS}): MAC address</li><li>Type: Dependent Items</li><li>Key: net.if.macaddress[&quot;{#IFGUID}&quot;]</li><li>Type of information: Text</li><li>Master item: Windows Agent for Zabbix: Get WMI Network Interfaces</li><li>Description: Physical address of the Network Card</li></ul><p>4. Adding the Item Prototype: After setting the parameters, click on “Add”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/823/1*fE-CbGbnaSe03ZLiOy43uA.png" /><figcaption>Adding Item parameters: MAC Address Discovery</figcaption></figure><p>Tag Configuration</p><p>Set the following tags for the item prototype:</p><p>component -&gt; network</p><p>description -&gt; {#IFALIAS}</p><p>interface -&gt; {#IFNAME}</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/646/1*zvFPXpQax7H-x2Y2xBan5Q.png" /><figcaption>Item Tags</figcaption></figure><p>Wait for the data collection and view the results under Monitoring &gt; Latest Data.</p><p>Conclusion</p><p>Done! The implementation for capturing and associating the physical MAC addresses with their interfaces in Zabbix has been successfully completed.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=78914aef16be" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Implementing Wake-on-LAN through Script in Zabbix]]></title>
            <link>https://medium.com/@ferspider3/implementing-wake-on-lan-through-script-in-zabbix-b33811eaed5b?source=rss-c304aef8a5fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/b33811eaed5b</guid>
            <dc:creator><![CDATA[Fernando Aranha]]></dc:creator>
            <pubDate>Fri, 26 Jan 2024 20:23:35 GMT</pubDate>
            <atom:updated>2024-01-26T20:23:35.321Z</atom:updated>
            <content:encoded><![CDATA[<p>Introduction: Before starting the Wake-on-LAN setup on the Zabbix server, it’s necessary to install the appropriate packages. Follow the steps below for different operating systems:</p><p>For Debian/Ubuntu:</p><p>1. Install the etherwake package:</p><pre>apt-get install etherwake</pre><p>2. Install the wakeonlan package:</p><pre>apt-get install wakeonlan</pre><p>For CentOS 8/Appliance:</p><ol><li>Install net-tools:</li></ol><pre>yum -y install net-tools</pre><p>2. Install the etherwake package:</p><pre>dnf install http://ftp.altlinux.org/pub/distributions/ALTLinux/Sisyphus/x86_64/RPMS.classic/etherwake-1.09-alt1.qa1.x86_64.rpm</pre><p>3. Install the wol package:</p><pre>dnf install https://download-ib01.fedoraproject.org/pub/epel/8/Everything/x86_64/Packages/w/wol-0.7.1-23.el8.x86_64.rpm</pre><p>Script Configuration in Zabbix: After installation, create the standard script in the script settings of Zabbix:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/774/1*iizacrDQmc_4KXktFW6Q7Q.png" /><figcaption>Script Configuration</figcaption></figure><p>For Ubuntu/Debian:</p><pre>wakeonlan {HOST.CONN}</pre><p>For CentOS/Appliance:</p><pre>wol {HOST.CONN}</pre><p>Linking MAC to Hosts: To link MAC addresses to HOSTs, enter the corresponding information, such as name and MAC, in the HOST inventory and click “UPDATE”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/937/1*yOHjdBkkv01pdtvQ2tyvMQ.png" /><figcaption>Inventory Configuration</figcaption></figure><p>Loading MAC and IP Addresses: Execute the following command via SSH or Shell directly on the server to load MAC addresses with their respective IPs:</p><pre>mysql -e &quot;select h.macaddress_a,i.ip from host_inventory h,interface i WHERE h.hostid=i.hostid and h.name IS NOT NULL AND h.name &lt;&gt; &#39;&#39; AND h.macaddress_a &lt;&gt; &#39;&#39;&quot; zabbix &gt; /etc/ethers</pre><p>Check if the file has been loaded correctly with the command:</p><pre>vi /etc/ethers</pre><p>After checking, exit the editor with :q.</p><p>Testing the Wake on LAN Protocol: To test the Wake on LAN protocol, go to “Monitoring &gt; Maps” or “Monitoring &gt; Host” in Zabbix and initiate the script. Zabbix will return a success message.</p><p>Conclusion: Done! Wake on LAN is now integrated into Zabbix!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b33811eaed5b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>