Maintainers
Pricing
Enterprise
More
More
Documentation
Try Live
Rankings
Install
Blog
Docs7
Ask
New
Add Docs
Zabbix Community Templates
https://github.com/zabbix/community-templates
Admin
Zabbix Community Templates repository
Tokens:
712,128
Snippets:
6,568
Trust Score:
9.4
License:
MIT
Update:
1 year ago
Context
Chat
Benchmark
46.38
Latest
Show doc for...
Code
Info
Show Results
Tokens:
Raw
Copy
Link
Tokens:
Raw
Copy
Link
### Shell Script for Starting mini_snmpd Daemon (Shell) Source: https://github.com/zabbix/community-templates/blob/main/Storage_Devices/Buffalo/template_buffalo_terastation_hs-dhtgl_r5_monitoring_snmp_v2/5.4/README.md This is the content of the init script. It specifies the interpreter, executes the mini_snmpd binary located in /opt/sbin, binds it to the 'eth0' network interface, sets the system description string reported via SNMP, and runs the process in the background. ```Shell #!/bin/sh /opt/sbin/mini\_snmpd -i eth0 -D "TeraStation" & ``` -------------------------------- ### Installing Dependencies on yum Systems (Shell) Source: https://github.com/zabbix/community-templates/blob/main/Applications/High_Availability_(HA)/template_haproxy_using_socket/5.4/README.md This command installs the `nc` (netcat) and `socat` utilities using the yum package manager. These tools are required by the Zabbix agent scripts to interact with the HAProxy statistics socket. Run this command on the system where the Zabbix agent is installed. ```Shell yum install nc socat -yum ``` -------------------------------- ### Installing Zabbix HLS Monitoring Dependencies (Bash) Source: https://github.com/zabbix/community-templates/blob/main/Applications/TV_Broadcasting/template_service_hls/5.4/README.md Installs the necessary Python packages (`m3u8`, `requests`) and `ffmpeg` using the `apt` package manager. These are prerequisites for the Zabbix HLS monitoring script to function correctly. ```Bash apt install python python-m3u8 python-requests ffmpeg ``` -------------------------------- ### Installing Optware ipkg Bootstrap Shell Source: https://github.com/zabbix/community-templates/blob/main/Storage_Devices/Buffalo/template_buffalo_terastation_hs-dhtgl_r5_monitoring_snmp_v2/6.0/README.md These commands prepare a temporary directory, download the Optware bootstrap script for the mssii architecture (likely ARM), and then execute the script to install the ipkg package manager. ```Shell mkdir -p /share/tmp; cd /share/tmp ``` ```Shell wget http://ipkg.nslu2-linux.org/feeds/optware/mssii/cross/stable/mssii-bootstrap\_1.2-7\_arm.xsh ``` ```Shell sh mssii-bootstrap\_1.2-7\_arm.xsh ``` -------------------------------- ### Example Go Script Compilation for Linux x64 (Shell/Go) Source: https://github.com/zabbix/community-templates/blob/main/Applications/Web-servers/template_fcgi_stat_getter._monitor_php-fpm_without_nginx_proxy/5.4/README.md An example of the compilation command for building the `fcgi_stat_getter` Go script targeting a Linux 64-bit system. This command creates the executable binary for use on a Zabbix server running on this platform. Requires the Go compiler installed. ```Shell $ env GOOS=linux GOARCH=amd64 go build -v github.com/tonymadbrain/fcgi_stat_getter ``` -------------------------------- ### Editing/Creating mini_snmpd Init Script File (Shell) Source: https://github.com/zabbix/community-templates/blob/main/Storage_Devices/Buffalo/template_buffalo_terastation_hs-dhtgl_r5_monitoring_snmp_v2/5.4/README.md Opens the specified file path using the 'vi' text editor. This is the location where the startup script for the mini_snmpd service will be created or edited to ensure it starts automatically on system boot. ```Shell vi /opt/etc/init.d/S99mini\_snmpd ``` -------------------------------- ### Updating ipkg and Installing mini_snmpd (Shell) Source: https://github.com/zabbix/community-templates/blob/main/Storage_Devices/Buffalo/template_buffalo_terastation_hs-dhtgl_r5_monitoring_snmp_v2/5.4/README.md Updates the list of available packages from the configured repositories for ipkg and then installs the mini_snmpd package, which is a lightweight SNMP daemon suitable for embedded systems. ```Shell ipkg update ``` ```Shell ipkg install mini\_snmpd ``` -------------------------------- ### Downloading and Executing Optware Bootstrap Script (Shell) Source: https://github.com/zabbix/community-templates/blob/main/Storage_Devices/Buffalo/template_buffalo_terastation_hs-dhtgl_r5_monitoring_snmp_v2/5.4/README.md These commands prepare a temporary directory, download the Optware bootstrap script specific to the TeraStation's ARM architecture (mssii), and then execute the script to initialize the ipkg package manager environment. ```Shell mkdir -p /share/tmp; cd /share/tmp ``` ```Shell wget http://ipkg.nslu2-linux.org/feeds/optware/mssii/cross/stable/mssii-bootstrap\_1.2-7\_arm.xsh ``` ```Shell sh mssii-bootstrap\_1.2-7\_arm.xsh ``` -------------------------------- ### Installing Required Monitoring Tools (socat, nc) with Yum Source: https://github.com/zabbix/community-templates/blob/main/Applications/High_Availability_(HA)/template_haproxy_using_socket/6.0/README.md This command uses the Yum package manager to install the `socat` and `nc` (netcat) utilities, which are necessary for the Zabbix agent scripts to interact with the HAProxy statistics socket. ```Shell yum install nc socat -yum ``` -------------------------------- ### Installing ipkg and Updating Feeds Source: https://github.com/zabbix/community-templates/blob/main/Storage_Devices/Buffalo/template_buffalo_terastation_hs-dhtgl_r5_monitoring_snmp_v2/5.0/README.md These commands set up a temporary directory, download the ipkg bootstrap script for ARM architecture, execute the script to install ipkg, and then update the package lists. This is a prerequisite for installing other software like mini_snmpd. ```Shell mkdir -p /share/tmp; cd /share/tmp wget http://ipkg.nslu2-linux.org/feeds/optware/mssii/cross/stable/mssii-bootstrap\_1.2-7\_arm.xsh sh mssii-bootstrap\_1.2-7\_arm.xsh ipkg update ``` -------------------------------- ### Collecting HAProxy Frontend 1xx responses per second - Zabbix agent (active) Source: https://github.com/zabbix/community-templates/blob/main/Applications/High_Availability_(HA)/template_haproxy_using_socket/5.4/README.md Counts the number of 1xx (informational) HTTP responses generated per second by the frontend. ```Zabbix agent (active) haproxy.stats[{$HAPROXY_SOCK},{#FRONTEND_NAME},FRONTEND,hrsp_1xx] ``` -------------------------------- ### Rebooting the System (Shell) Source: https://github.com/zabbix/community-templates/blob/main/Storage_Devices/Buffalo/template_buffalo_terastation_hs-dhtgl_r5_monitoring_snmp_v2/5.4/README.md Initiates a system reboot. This step is necessary after installing the init script and setting permissions to ensure that the mini_snmpd service starts automatically during the boot sequence. ```Shell reboot ``` -------------------------------- ### Installing mini_snmpd Source: https://github.com/zabbix/community-templates/blob/main/Storage_Devices/Buffalo/template_buffalo_terastation_hs-dhtgl_r5_monitoring_snmp_v2/5.0/README.md This command uses the ipkg package manager installed in the previous step to download and install the mini_snmpd service. This service is necessary to respond to SNMP queries from Zabbix. ```Shell ipkg install mini\_snmpd ``` -------------------------------- ### Creating Zabbix Scripts Directory (Shell) Source: https://github.com/zabbix/community-templates/blob/main/Applications/High_Availability_(HA)/template_haproxy_using_socket/5.4/README.md This command creates the directory `/etc/zabbix/scripts/` if it doesn't already exist. The `-p` flag ensures that parent directories are also created if needed and prevents errors if the directory already exists. This directory is where the Zabbix agent scripts are placed. ```Shell mkdir -p /etc/zabbix/scripts/ ``` -------------------------------- ### Getting Total Connection Start Time from Glassfish using asadmin (Shell) Source: https://github.com/zabbix/community-templates/blob/main/Applications/Java_Application/template_glassfish_webserver/5.0/README.md Defines a Zabbix UserParameter (`glassfish.counttotalconnections-starttime`) to fetch the cumulative connection count start time from the Glassfish http-listener-1. It executes an `asadmin get --monitor` command, filters the output for the 'server' line using `grep`, and extracts the value using `cut`. Requires `asadmin` available and properly configured password file access. Outputs a numerical value representing the start time. ```Shell /home/glassfish/bin/asadmin --passwordfile /home/webserver2/asadminpass get --monitor server.network.http-listener-1.connection-queue.counttotalconnections-starttime | grep server |cut -d ' ' -f3 ``` -------------------------------- ### Collecting HAProxy Frontend 3xx responses per second - Zabbix agent (active) Source: https://github.com/zabbix/community-templates/blob/main/Applications/High_Availability_(HA)/template_haproxy_using_socket/5.4/README.md Counts the number of 3xx (redirection) HTTP responses generated per second by the frontend. ```Zabbix agent (active) haproxy.stats[{$HAPROXY_SOCK},{#FRONTEND_NAME},FRONTEND,hrsp_3xx] ``` -------------------------------- ### Checking mini_snmpd Process Status (Shell) Source: https://github.com/zabbix/community-templates/blob/main/Storage_Devices/Buffalo/template_buffalo_terastation_hs-dhtgl_r5_monitoring_snmp_v2/5.4/README.md Lists all running processes ('ps') and filters the output to find lines containing 'snmpd'. This command is used to verify whether the mini_snmpd daemon is actively running after the system has started. ```Shell ps | grep snmpd ``` -------------------------------- ### Installing mini_snmpd via ipkg Shell Source: https://github.com/zabbix/community-templates/blob/main/Storage_Devices/Buffalo/template_buffalo_terastation_hs-dhtgl_r5_monitoring_snmp_v2/6.0/README.md These commands update the package lists available through the ipkg manager and then install the mini_snmpd daemon package, which is required for providing SNMP v2c services. ```Shell ipkg update ``` ```Shell ipkg install mini\_snmpd ``` -------------------------------- ### Getting Total Connections Start Time (Glassfish asadmin Shell) Source: https://github.com/zabbix/community-templates/blob/main/Applications/Java_Application/template_glassfish_webserver/6.0/README.md Executes the Glassfish `asadmin` command to retrieve the `counttotalconnections-starttime` monitoring attribute for the `http-listener-1` connection queue. It requires the `asadmin` tool and a password file for authentication. The output is processed by `grep` to isolate the line containing 'server' and `cut` to extract the third field, which is expected to be the start time value. ```Shell /home/glassfish/bin/asadmin --passwordfile /home/webserver2/asadminpass get --monitor server.network.http-listener-1.connection-queue.counttotalconnections-starttime | grep server |cut -d ' ' -f3 ``` -------------------------------- ### Creating mini_snmpd Init Script Content Shell Source: https://github.com/zabbix/community-templates/blob/main/Storage_Devices/Buffalo/template_buffalo_terastation_hs-dhtgl_r5_monitoring_snmp_v2/6.0/README.md This is the content of the shell script intended to be saved as `/opt/etc/init.d/S99mini_snmpd`. It defines the script interpreter and the command to start the mini_snmpd daemon, specifying the network interface (`eth0`) and a system description ("TeraStation"), running it in the background. ```Shell #!/bin/sh /opt/sbin/mini\_snmpd -i eth0 -D "TeraStation" & ``` -------------------------------- ### Collecting HAProxy Frontend Other responses per second - Zabbix agent (active) Source: https://github.com/zabbix/community-templates/blob/main/Applications/High_Availability_(HA)/template_haproxy_using_socket/5.4/README.md Counts the number of HTTP responses with codes other than 1xx-5xx generated per second by the frontend. ```Zabbix agent (active) haproxy.stats[{$HAPROXY_SOCK},{#FRONTEND_NAME},FRONTEND,hrsp_other] ``` -------------------------------- ### Testing HAProxy Socket Access (Shell) Source: https://github.com/zabbix/community-templates/blob/main/Applications/High_Availability_(HA)/template_haproxy_using_socket/5.4/README.md This command tests connectivity and permissions for the HAProxy statistics socket. It attempts to send "show info;show stat" commands to the socket as the `haproxy` user using `socat`. Requires `socat` and appropriate user permissions to access the socket file. ```Shell sudo -uhaproxy echo "show info;show stat" | socat stdio unix-connect:/var/lib/haproxy/stats ``` -------------------------------- ### Getting HAProxy Backend Responses Time (Zabbix Item Key) Source: https://github.com/zabbix/community-templates/blob/main/Applications/High_Availability_(HA)/template_haproxy_using_socket/6.0/README.md This Zabbix item key tracks the average backend response time (in ms) for the last 1,024 requests for a specific HAProxy backend. It helps measure load-balancing setup latency. This metric requires the HAProxy socket path and the backend name. ```Zabbix Item Key haproxy.stats[{$HAPROXY_SOCK},{#BACKEND_NAME},BACKEND,rtime] ``` -------------------------------- ### Setting Execute Permissions for Init Script (Shell) Source: https://github.com/zabbix/community-templates/blob/main/Storage_Devices/Buffalo/template_buffalo_terastation_hs-dhtgl_r5_monitoring_snmp_v2/5.4/README.md Applies file permissions to the mini_snmpd init script. The '755' mode grants read, write, and execute permissions to the owner and read and execute permissions to the group and others, making the script executable. ```Shell chmod 755 /opt/etc/init.d/S99mini\_snmpd ``` -------------------------------- ### Getting VMmanager API Token (Shell) Source: https://github.com/zabbix/community-templates/blob/main/Virtualization/VMmanager/template_vmmanager_6_kvm_hypervisor/6.0/README.md This shell command uses `curl` to perform a POST request to the VMmanager API authentication endpoint to obtain a new access token. Replace placeholders like `__ADMIN__EMAIL__`, `__PASSWORD__`, and `__VM_DOMAIN__` with your actual credentials and domain. ```Shell curl -v -X POST -H "accept: application/json" -H "Content-Type: application/json" -d '{"email": "__ADMIN__EMAIL__", "password": "__PASSWORD__"}' "https://__VM_DOMAIN__/auth/v4/public/token" ``` -------------------------------- ### Get Total Connections Start Time - Shell Source: https://github.com/zabbix/community-templates/blob/main/Applications/Java_Application/template_glassfish_webserver/5.4/README.md This command retrieves the start time of the total connections counter for the 'http-listener-1' connection queue on a Glassfish server using the `asadmin` tool. It filters the output to extract the numerical value associated with the 'server' instance. ```shell /home/glassfish/bin/asadmin --passwordfile /home/webserver2/asadminpass get --monitor server.network.http-listener-1.connection-queue.counttotalconnections-starttime | grep server |cut -d ' ' -f3 ``` -------------------------------- ### Install HLS Monitoring Dependencies Shell Source: https://github.com/zabbix/community-templates/blob/main/Applications/TV_Broadcasting/template_service_hls/5.0/README.md This shell command installs the necessary Python libraries and tools required for the HLS monitoring script to function. It requires apt package manager and superuser privileges. ```Shell apt install python python-m3u8 python-requests ffmpeg ``` -------------------------------- ### Counting HAProxy Running Processes - Zabbix Source: https://github.com/zabbix/community-templates/blob/main/Applications/High_Availability_(HA)/template_haproxy_using_socket/5.4/README.md This Zabbix agent item counts the number of running HAProxy processes. It uses a standard Zabbix agent key to monitor process count by name. ```Zabbix proc.num[haproxy] ``` -------------------------------- ### Making Zabbix Scripts Executable (Shell) Source: https://github.com/zabbix/community-templates/blob/main/Applications/High_Availability_(HA)/template_haproxy_using_socket/5.4/README.md This command changes the permissions of a file (`script_name`) to make it executable. It is used for the Zabbix agent scripts (`haproxy_discovery.sh` and `haproxy_stats.sh`) to allow the Zabbix agent to run them. Replace `script_name` with the actual script file name. ```Shell chmod +x script\_name ``` -------------------------------- ### Installing Asterisk Zabbix Template Source: https://github.com/zabbix/community-templates/blob/main/Telephony/PBX/template_asterisk/5.4/README.md Provides step-by-step instructions for installing the Asterisk Zabbix template. It details deploying Zabbix agent configuration files, external scripts, setting up a cron job for script execution, adjusting file permissions, and importing the Zabbix template XML file. Dependencies include a running Zabbix agent, Asterisk instance, and required scripts. ```Configuration Zabbix template for Asterisk IP PBX Finds out the total number of concurrent channels on trunks. Each thunk's name should start with "tru\_" Installation: - Put userparameter\_asterisk.conf in /etc/zabbix/zabbix\_agentd.d/ , restart zabbix agent - Put asterisk\_trunks and asterisk\_calls scripts in /etc/zabbix/externalscripts/ and add execute privileges - Set up cronjob for asterisk\_trunks script like this: # crontab -l SHELL=/bin/bash # update Asterisk trunks info for zabbix 2 * * * * /etc/zabbix/externalscripts/asterisk\_trunks - (Optional) If there\'re no enough permissions for /var/run/asterisk/asterisk.ctl then add following line in /etc/asterisk/asterisk.conf: astctlpermissions = 775 , and restart Asterisk. Add zabbix user to group asterisk. ``` -------------------------------- ### Example Cross-Compiling Go Binary for Linux AMD64 (Shell) Source: https://github.com/zabbix/community-templates/blob/main/Applications/Web-servers/template_fcgi_stat_getter._monitor_php-fpm_without_nginx_proxy/5.0/README.md Specific example demonstrating how to compile the Go `fcgi_stat_getter` binary for a Linux system with an AMD64 architecture. This is a common target for Zabbix servers. ```Shell $ env GOOS=linux GOARCH=amd64 go build -v github.com/tonymadbrain/fcgi\_stat\_getter ``` -------------------------------- ### Installing Dependencies with Yum Bash Source: https://github.com/zabbix/community-templates/blob/main/Applications/High_Availability_(HA)/template_haproxy_using_socket/5.0/README.md This command installs necessary tools (nc and socat) using the yum package manager. These tools are required for the Zabbix agent scripts to communicate with the HAProxy statistics socket. ```Bash yum install nc socat -yum ``` -------------------------------- ### Installing Dependencies for HLS Script - Shell Source: https://github.com/zabbix/community-templates/blob/main/Applications/TV_Broadcasting/template_service_hls/6.0/README.md This command installs the required Python interpreter (python2), the `m3u8` and `requests` Python libraries, and `ffmpeg`. These packages are necessary for the external Python script that the Zabbix agent uses to perform HLS checks. ```Shell apt install python python-m3u8 python-requests ffmpeg ``` -------------------------------- ### Collecting HAProxy Frontend 2xx responses per second - Zabbix agent (active) Source: https://github.com/zabbix/community-templates/blob/main/Applications/High_Availability_(HA)/template_haproxy_using_socket/5.4/README.md Counts the number of 2xx (successful) HTTP responses generated per second by the frontend. A key metric for monitoring the success rate of requests. ```Zabbix agent (active) haproxy.stats[{$HAPROXY_SOCK},{#FRONTEND_NAME},FRONTEND,hrsp_2xx] ``` -------------------------------- ### Installing needrestart Package - Shell Source: https://github.com/zabbix/community-templates/blob/main/Applications/Others/template_needrestart/5.0/README.md Command to install the `needrestart` utility on a Debian/Ubuntu based system using the Advanced Packaging Tool (APT). This tool is necessary for the Zabbix template to function. Requires root privileges or `sudo`. ```Shell apt install needrestart ``` -------------------------------- ### Compile Go Monitoring Script Example (Linux AMD64) - Go/Shell Source: https://github.com/zabbix/community-templates/blob/main/Applications/Web-servers/template_fcgi_stat_getter._monitor_php-fpm_without_nginx_proxy/6.0/README.md Provides a concrete example of the Go build command for compiling the monitoring script specifically for a Linux system with AMD64 architecture. This demonstrates how to use the generic command with specific values for GOOS and GOARCH. ```Shell $ env GOOS=linux GOARCH=amd64 go build -v github.com/tonymadbrain/fcgi\_stat\_getter ``` -------------------------------- ### Getting Power Supply Installation Status SNMP Key (Zabbix) Source: https://github.com/zabbix/community-templates/blob/main/Storage_Devices/Oracle/template_tape_library_oracle_storagetek_sl150/6.0/README.md This SNMP agent key is used in Zabbix Low-Level Discovery (LLD) to indicate if a specific power supply instance identified by {#SNMPINDEX} is installed (2) or not installed (1). ```SNMP slPowerSupplyInstalled[{#SNMPINDEX}] ``` -------------------------------- ### Getting HAProxy Frontend 1xx Responses (Zabbix Item Key) Source: https://github.com/zabbix/community-templates/blob/main/Applications/High_Availability_(HA)/template_haproxy_using_socket/6.0/README.md This Zabbix item key counts the number of informational (1xx) HTTP responses per second on a specific HAProxy frontend. It requires the HAProxy socket path and the frontend name. ```Zabbix Item Key haproxy.stats[{$HAPROXY_SOCK},{#FRONTEND_NAME},FRONTEND,hrsp_1xx] ``` -------------------------------- ### Compiling Go Tool for Zabbix Source: https://github.com/zabbix/community-templates/blob/main/Applications/Web-servers/template_nginx_stat_getter._simple_check_for_nginx_stats/6.0/README.md This command compiles the `nginx_stat_getter` Go source code into an executable binary. You must specify the target operating system (GOOS) and architecture (GOARCH) as environment variables to build for the platform where the Zabbix server is running. ```Shell env GOOS={OS} GOARCH={ARCH} go build -v github.com/username/nginx\_stat\_getter ``` -------------------------------- ### Installing Disk Stat Script (Shell) Source: https://github.com/zabbix/community-templates/blob/main/Operating_Systems/Linux/template_ZBX_disk_stat/5.4/README.md Creates the necessary directory for Zabbix external scripts, downloads the `disk_stat.sh` script from the specified GitHub URL using curl, and sets executable permissions (rwxr-xr-x) on the downloaded file. This is a required step before configuring Zabbix. ```Shell # Create dir for zabbix sript mkdir -p /usr/libexec/zabbix/ # Copy script to your server curl 'https://raw.githubusercontent.com/dusharu/ZBX_Disk_Stat/master/scripts/disk_stat.sh' -o /usr/libexec/zabbix/disk_stat.sh chmod 755 /usr/libexec/zabbix/disk_stat.sh ``` -------------------------------- ### Collecting HAProxy Frontend 5xx responses per second - Zabbix agent (active) Source: https://github.com/zabbix/community-templates/blob/main/Applications/High_Availability_(HA)/template_haproxy_using_socket/5.4/README.md Counts the number of 5xx (server error) HTTP responses generated per second by the frontend. An increase is a critical indicator of problems with backend servers or HAProxy itself. ```Zabbix agent (active) haproxy.stats[{$HAPROXY_SOCK},{#FRONTEND_NAME},FRONTEND,hrsp_5xx] ``` -------------------------------- ### Creating Directory Bash Source: https://github.com/zabbix/community-templates/blob/main/Applications/High_Availability_(HA)/template_haproxy_using_socket/5.0/README.md This command creates the specified directory path if it does not already exist. The `-p` flag ensures that parent directories are also created as needed. This directory is used to store the Zabbix agent scripts. ```Bash mkdir -p /etc/zabbix/scripts/ ``` -------------------------------- ### Testing MaxDB Discovery Windows Command Prompt Source: https://github.com/zabbix/community-templates/blob/main/Databases/Others/template_sap_maxdb79_monitor/5.4/README.md This command is used on Windows systems to test the Zabbix agent's configuration and the functionality of the MaxDB plugin's discovery rule. It attempts to execute the `maxdb.discovery[]` item key using the specified configuration file. A successful execution returns a list of discovered MaxDB database names or an empty list if none are found; errors indicate configuration problems. ```Windows Command Prompt <zabbixRoot>\zabbix-agentd.exe -c <zabbixRoot>\zabbix-agentd.conf -t maxdb.discovery[] ``` -------------------------------- ### Enabling and Starting Zabbix Zypper Update Timer Shell Source: https://github.com/zabbix/community-templates/blob/main/Operating_Systems/Linux/template_zypper_updateinfo/6.0/README.md These shell commands are used to reload the systemd manager configuration, enable the specified systemd timer unit so it starts automatically at boot, and immediately start the timer unit to begin executing the associated service. ```Shell systemctl daemon-reload systemctl enable zabbix-template-module-zypper-updateinfo.timer systemctl start zabbix-template-module-zypper-updateinfo.timer ``` -------------------------------- ### Installing Zabbix PHP-FPM Discovery Script - Shell Source: https://github.com/zabbix/community-templates/blob/main/Applications/Web-servers/template_zabbix_4.0_php-fpm_pools_(lld_+_http_agent)/5.4/README.md These commands copy the PHP-FPM pool discovery script to the Zabbix agent configuration directory and make it executable and owned by the zabbix user. ```Shell # cp /tmp/zabbix-template/php-fpm.discover\_pools.pl /etc/zabbix ``` ```Shell # chmod +x /etc/zabbix/php-fpm.discover\_pools.pl ``` ```Shell # chown zabbix.zabbix /etc/zabbix/php-fpm.discover\_pools.pl ``` -------------------------------- ### Getting HAProxy Frontend Other Responses (Zabbix Item Key) Source: https://github.com/zabbix/community-templates/blob/main/Applications/High_Availability_(HA)/template_haproxy_using_socket/6.0/README.md This Zabbix item key counts the number of HTTP responses with codes other than 1xx-5xx per second on a specific HAProxy frontend. It captures miscellaneous response codes and requires the HAProxy socket path and frontend name. ```Zabbix Item Key haproxy.stats[{$HAPROXY_SOCK},{#FRONTEND_NAME},FRONTEND,hrsp_other] ``` -------------------------------- ### Get Chrony Version (Shell) Source: https://github.com/zabbix/community-templates/blob/main/Applications/NTP/template_chrony_accuracy_1/5.4/README.md This simple shell command executes `chronyc -v` to retrieve the installed chrony version. The output is captured by a Zabbix agent item. ```Shell chronyc -v ``` -------------------------------- ### Configuring sudoers for Zabbix Agent Source: https://github.com/zabbix/community-templates/blob/main/Server_Hardware/Intel/template_intel_quicksync_gpu_metrics/5.0/README.md These lines configure the `sudoers` file to allow the `zabbix` user to execute the `metrics_monitor` utility located at `/opt/intel/mediasdk/tools/metrics_monitor/_bin/metrics_monitor` without needing a password or requiring a tty (terminal). This is necessary for the Zabbix agent to run the command as root to access hardware metrics. ```sudoers Defaults:zabbix !requiretty zabbix ALL=(ALL) NOPASSWD: /opt/intel/mediasdk/tools/metrics_monitor/_bin/metrics_monitor ``` -------------------------------- ### Installing needrestart package with apt (Shell) Source: https://github.com/zabbix/community-templates/blob/main/Applications/Others/template_needrestart/5.4/README.md Installs the `needrestart` package on Debian/Ubuntu based systems using the `apt` package manager. This package is a prerequisite for the Zabbix template's functionality. ```Shell apt install needrestart ``` -------------------------------- ### Rebooting the System Source: https://github.com/zabbix/community-templates/blob/main/Storage_Devices/Buffalo/template_buffalo_terastation_hs-dhtgl_r5_monitoring_snmp_v2/5.0/README.md This command reboots the TeraStation. Rebooting is required for the newly created init script to be executed automatically by the system, starting the mini_snmpd service. ```Shell reboot ``` -------------------------------- ### Getting NVIDIA GPU Free Memory via Zabbix UserParameter/Shell Source: https://github.com/zabbix/community-templates/blob/main/Server_Hardware/Other/template_nvidia-smi_integration/5.4/README.md Defines a Zabbix agent user parameter 'gpu.free' to retrieve the available free memory on the first NVIDIA GPU. It runs `nvidia-smi`, queries 'memory.free', and formats the output as raw CSV data without headers or units. Requires `nvidia-smi` to be installed and accessible. ```Zabbix UserParameter UserParameter=gpu.free,nvidia-smi --query-gpu=memory.free --format=csv,noheader,nounits -i 0 ``` -------------------------------- ### Defining Zabbix UserParameter for GPU Metrics (Shell) Source: https://github.com/zabbix/community-templates/blob/main/Server_Hardware/Intel/template_intel_quicksync_gpu_metrics/5.0/README.md This Zabbix UserParameter definition specifies how the Zabbix agent collects Intel GPU metrics. It calls the `metrics_monitor` utility via `sudo`, pipes the output through multiple `sed` commands to clean and format it, `grep`s for the specific metric requested by Zabbix ($1), and uses `awk` to extract the numerical value. The parameters $2 and $3 are passed to the `metrics_monitor` utility. ```Shell UserParameter=gpu.metrics[*],sudo /opt/intel/mediasdk/tools/metrics_monitor/_bin/metrics_monitor "$2" "$3" | sed 's/ usage://g' | sed 's/\t/\n/g' | sed 's/,//g' | sed 's/T F/T_F/g' | grep "$1" | awk '{print $ 2}' ``` -------------------------------- ### Get Chrony Version - Shell Source: https://github.com/zabbix/community-templates/blob/main/Applications/NTP/template_chrony_accuracy/5.4/README.md Executes the `chronyd --version` command to retrieve the installed version string of the chrony daemon. This information is collected by the Zabbix agent. ```Shell chronyd --version ``` -------------------------------- ### Collecting HAProxy Backend Time in Queue - Zabbix agent (active) Source: https://github.com/zabbix/community-templates/blob/main/Applications/High_Availability_(HA)/template_haproxy_using_socket/5.4/README.md Collects the average time spent in the queue (in ms) for the last 1,024 requests for a specific HAProxy backend. Minimizing time spent in the queue results in lower latency and an overall better client experience. Each use case can tolerate a certain amount of queue time but in general, you should aim to keep this value as low as possible. ```Zabbix agent (active) haproxy.stats[{$HAPROXY_SOCK},{#BACKEND_NAME},BACKEND,qtime] ``` -------------------------------- ### Collecting Docker Container Creation Time (Shell, Zabbix) Source: https://github.com/zabbix/community-templates/blob/main/Virtualization/template_docker/5.0/README.md This Zabbix agent item key uses `system.run` to execute a shell command. It fetches detailed information for a specific container (identified by the LLD macro `{#NAMES}`) from the Docker Unix socket using `curl`, and pipes the resulting JSON to `jq .Created` to extract the creation timestamp. It requires `curl`, `jq`, and a Zabbix agent with `system.run` enabled. ```Shell system.run[curl -s --unix-socket /var/run/docker.sock http:/containers{#NAMES}/json| jq .Created] ``` -------------------------------- ### Checking Backend Queue Size Minimum using Zabbix Expression Source: https://github.com/zabbix/community-templates/blob/main/Applications/High_Availability_(HA)/template_haproxy_using_socket/5.4/README.md This Zabbix trigger checks the minimum current number of requests in the queue (`qcur`) for a specific HAProxy backend over the last 5 minutes. It fires if this minimum value exceeds 10. The data is sourced from the HAProxy statistics file (`/var/lib/haproxy/stats`) and applies to backends dynamically discovered via LLD. ```Zabbix Expression {HAProxy:haproxy.stats[/var/lib/haproxy/stats,{#BACKEND_NAME},BACKEND,qcur].min(5m)}>10 ``` -------------------------------- ### Define Zabbix UserParameter for Free GPU Memory (Zabbix Agent) Source: https://github.com/zabbix/community-templates/blob/main/Server_Hardware/Other/template_nvidia-smi_integration/7.0/README.md Establishes a Zabbix agent UserParameter, `gpu.free`, that executes `nvidia-smi` to get the free memory of the first GPU (`-i 0`). The command output is formatted as CSV without header or units, making it ready for Zabbix collection. Requires a functioning Zabbix agent and installed `nvidia-smi`. ```Zabbix Configuration UserParameter=gpu.free,nvidia-smi --query-gpu=memory.free --format=csv,noheader,nounits -i 0 ``` -------------------------------- ### Getting chrony Version - Shell/chrony Source: https://github.com/zabbix/community-templates/blob/main/Applications/NTP/template_chrony_accuracy_1/6.0/README.md Executes the `chronyc -v` command to retrieve the version information of the installed chrony package. This item allows monitoring of the chrony client version directly from Zabbix. ```Shell chronyc -v ``` -------------------------------- ### Monitoring HAProxy Memory Usage - Zabbix Source: https://github.com/zabbix/community-templates/blob/main/Applications/High_Availability_(HA)/template_haproxy_using_socket/5.4/README.md This Zabbix agent item collects the amount of memory currently used by the HAProxy process. It uses a standard Zabbix agent key. ```Zabbix proc.mem[haproxy] ``` -------------------------------- ### Discovering Docker Containers (Shell, Zabbix) Source: https://github.com/zabbix/community-templates/blob/main/Virtualization/template_docker/5.0/README.md This Zabbix agent item key uses `system.run` to execute a shell command. It retrieves a list of all Docker containers via the Docker Unix socket using `curl`, pipes the JSON output to `jq` (via the Zabbix macro `{$JQ_DOCKER_NAMES}`) to extract container names and format them for Zabbix Low-Level Discovery (LLD), and wraps the output in `echo` to fit the required Zabbix LLD JSON format. It requires `curl`, `jq`, and a Zabbix agent configured to allow `system.run` commands and access the Docker socket. ```Shell system.run[echo "{ \"data\": \`curl -s --unix-socket /var/run/docker.sock http:/containers/json| {$JQ_DOCKER_NAMES}\\` }"] ``` -------------------------------- ### Testing MaxDB Discovery Shell Source: https://github.com/zabbix/community-templates/blob/main/Databases/Others/template_sap_maxdb79_monitor/5.4/README.md This command is used on Linux-like systems to test the Zabbix agent's configuration and the functionality of the MaxDB plugin's discovery rule. It attempts to execute the `maxdb.discovery[]` item key using the specified configuration file. A successful execution returns a list of discovered MaxDB database names or an empty list if none are found; errors indicate configuration problems. ```Shell /usr/sbin/zabbix-agentd -c <zabbixRoot>/zabbix-agentd.conf -t maxdb.discovery[] ``` -------------------------------- ### Collecting HAProxy Frontend Session limits - Zabbix agent (active) Source: https://github.com/zabbix/community-templates/blob/main/Applications/High_Availability_(HA)/template_haproxy_using_socket/5.4/README.md Retrieves the configured maximum number of simultaneous sessions allowed on the frontend, as defined by the maxconn setting. ```Zabbix agent (active) haproxy.stats[{$HAPROXY_SOCK},{#FRONTEND_NAME},FRONTEND,slim] ``` -------------------------------- ### Collecting HAProxy Backend Redispatched Requests per second - Zabbix agent (active) Source: https://github.com/zabbix/community-templates/blob/main/Applications/High_Availability_(HA)/template_haproxy_using_socket/5.4/README.md Tracks the number of times a request was redispatched to a different backend per second. The redispatch rate metric tracks the number of times a client connection was unable to reach its original target, and was subsequently sent to a different server. ```Zabbix agent (active) haproxy.stats[{$HAPROXY_SOCK},{#BACKEND_NAME},BACKEND,wredis] ``` -------------------------------- ### Enabling and Starting Systemd Timer Shell Commands Source: https://github.com/zabbix/community-templates/blob/main/Operating_Systems/Linux/template_zypper_updateinfo/5.0/README.md These commands are used on the monitored host to reload the systemd configuration, enable the systemd timer unit for the Zabbix Zypper update script to start automatically on boot, and then immediately start the timer service. This ensures the script runs periodically as defined in the timer file. ```Shell systemctl daemon-reload systemctl enable zabbix-template-module-zypper-updateinfo.timer systemctl start zabbix-template-module-zypper-updateinfo.timer ``` -------------------------------- ### Checking Frontend Session Utilization Minimum using Zabbix Expression Source: https://github.com/zabbix/community-templates/blob/main/Applications/High_Availability_(HA)/template_haproxy_using_socket/5.4/README.md This Zabbix trigger checks the minimum session utilization percentage (`sutil`) for a specific HAProxy frontend over the last 5 minutes. It fires if this minimum value exceeds 80%. The data is sourced from the HAProxy statistics file (`/var/lib/haproxy/stats`) and applies to frontends dynamically discovered via LLD. ```Zabbix Expression {HAProxy:haproxy.stats[/var/lib/haproxy/stats,{#FRONTEND_NAME},FRONTEND,sutil].min(5m)}>80 ``` -------------------------------- ### Collecting HAProxy Backend Responses Time - Zabbix agent (active) Source: https://github.com/zabbix/community-templates/blob/main/Applications/High_Availability_(HA)/template_haproxy_using_socket/5.4/README.md Measures the average backend response time (in ms) for the last 1,024 requests. Tracking average response times is an effective way to measure the latency of your load-balancing setup. Generally speaking, response times in excess of 500 ms will lead to degradation of application performance and customer experience. Monitoring the average response time can give you the upper hand to respond to latency issues before your customers are substantially impacted. Keep in mind that this metric will be zero if you are not using HTTP (see #60). ```Zabbix agent (active) haproxy.stats[{$HAPROXY_SOCK},{#BACKEND_NAME},BACKEND,rtime] ``` -------------------------------- ### Creating Zabbix Agent Cluster Service Windows Command Prompt Source: https://github.com/zabbix/community-templates/blob/main/Databases/Others/template_sap_maxdb79_monitor/5.4/README.md This command is used on Windows systems to create a new Windows service for a second instance of the Zabbix agent specifically for monitoring cluster objects. It defines the service name, display name, startup type (automatic), and the full path to the executable along with its configuration file. ```Windows Command Prompt sc create "Zabbix Agent Cluster" binPath= "c:\zabbixCluster\zabbix_agentd.exe -c c:\zabbixCluster\zabbix_agentd.win.conf" displayname= "Zabbix Agent Cluster" start= auto ``` -------------------------------- ### Modifying Intel Media SDK Metrics Monitor C++ Source: https://github.com/zabbix/community-templates/blob/main/Server_Hardware/Intel/template_intel_quicksync_gpu_metrics/5.0/README.md This C++ snippet shows a modification to the `cttmetrics_sample.cpp` source file from the Intel Media SDK. Adding `run = 0;` at the end of the `while` loop ensures the `metrics_monitor` utility exits after completing a single measurement cycle, making it suitable for use with Zabbix's request/response model. ```C++ while(run) ... if (true == isFreq) printf("\tGT Freq: %4.2f", metric_values[3]); printf("\n"); run = 0 } ``` -------------------------------- ### Rebooting System Shell Source: https://github.com/zabbix/community-templates/blob/main/Storage_Devices/Buffalo/template_buffalo_terastation_hs-dhtgl_r5_monitoring_snmp_v2/6.0/README.md This command initiates a system reboot. Rebooting is required to ensure the new init script is executed, starting the mini_snmpd service automatically upon system startup and applying any other necessary system changes. ```Shell reboot ``` -------------------------------- ### Checking Backend Queue Time Minimum using Zabbix Expression Source: https://github.com/zabbix/community-templates/blob/main/Applications/High_Availability_(HA)/template_haproxy_using_socket/5.4/README.md This Zabbix trigger checks the minimum average time spent in the queue (`qtime`) for a specific HAProxy backend over the last 5 minutes. It fires if this minimum value exceeds 10 seconds. The data is sourced from the HAProxy statistics file (`/var/lib/haproxy/stats`) and applies to backends dynamically discovered via LLD. ```Zabbix Expression {HAProxy:haproxy.stats[/var/lib/haproxy/stats,{#BACKEND_NAME},BACKEND,qtime].min(5m)}>10s ``` -------------------------------- ### Making Scripts Executable Source: https://github.com/zabbix/community-templates/blob/main/Applications/High_Availability_(HA)/template_haproxy_using_socket/6.0/README.md This command uses `chmod +x` to make the specified script executable. This is required after copying the Zabbix agent scripts (`haproxy_discovery.sh`, `haproxy_stats.sh`) to ensure they can be run by the agent. ```Shell chmod +x script_name ``` -------------------------------- ### Creating Directory for Zabbix Agent Scripts Source: https://github.com/zabbix/community-templates/blob/main/Applications/High_Availability_(HA)/template_haproxy_using_socket/6.0/README.md This command creates the directory `/etc/zabbix/scripts/` if it does not already exist. This directory is where the Zabbix agent discovery and stats scripts for HAProxy monitoring should be placed. ```Shell mkdir -p /etc/zabbix/scripts/ ``` -------------------------------- ### Collecting HAProxy Backend Status - Zabbix agent (active) Source: https://github.com/zabbix/community-templates/blob/main/Applications/High_Availability_(HA)/template_haproxy_using_socket/5.4/README.md Retrieves the status of a specific HAProxy backend, mapping UP = 1 and DOWN = 0. Essential for monitoring backend server availability. ```Zabbix agent (active) haproxy.stats[{$HAPROXY_SOCK},{#BACKEND_NAME},BACKEND,status] ``` -------------------------------- ### Collecting HAProxy Frontend Established sessions - Zabbix agent (active) Source: https://github.com/zabbix/community-templates/blob/main/Applications/High_Availability_(HA)/template_haproxy_using_socket/5.4/README.md Retrieves the current number of established sessions on the frontend. This metric indicates the current resource utilization by active sessions. ```Zabbix agent (active) haproxy.stats[{$HAPROXY_SOCK},{#FRONTEND_NAME},FRONTEND,scur] ``` -------------------------------- ### Collecting HAProxy Frontend Sessions rate - Zabbix agent (active) Source: https://github.com/zabbix/community-templates/blob/main/Applications/High_Availability_(HA)/template_haproxy_using_socket/5.4/README.md Measures the rate at which new sessions are being created per second on the frontend. A significant spike could potentially overload servers. ```Zabbix agent (active) haproxy.stats[{$HAPROXY_SOCK},{#FRONTEND_NAME},FRONTEND,rate] ``` -------------------------------- ### Collecting HAProxy Frontend Outgoing traffic - Zabbix agent (active) Source: https://github.com/zabbix/community-templates/blob/main/Applications/High_Availability_(HA)/template_haproxy_using_socket/5.4/README.md Measures the total number of bits sent by a specific HAProxy frontend. Used to monitor outgoing network traffic volume. ```Zabbix agent (active) haproxy.stats[{$HAPROXY_SOCK},{#FRONTEND_NAME},FRONTEND,bout] ``` -------------------------------- ### Example SNMP v2 Community Config - Shell Source: https://github.com/zabbix/community-templates/blob/main/Unsorted/template_haivision_makito/5.2/README.md This provides a concrete example of the `rocommunity` line to be added to the `/usr/share/snmp/snmpd.conf` file. Replace `snmp_zabbix` with your chosen community string and `192.168.1.2` with the actual IP of your Zabbix server. ```shell eg. rocommunity snmp_zabbix 192.168.1.2 .1 ``` -------------------------------- ### Collecting HAProxy Frontend Incoming traffic - Zabbix agent (active) Source: https://github.com/zabbix/community-templates/blob/main/Applications/High_Availability_(HA)/template_haproxy_using_socket/5.4/README.md Measures the total number of bits received by a specific HAProxy frontend. Used to monitor incoming network traffic volume. ```Zabbix agent (active) haproxy.stats[{$HAPROXY_SOCK},{#FRONTEND_NAME},FRONTEND,bin] ``` -------------------------------- ### Collecting Docker Container Volume Sources (Shell, Zabbix) Source: https://github.com/zabbix/community-templates/blob/main/Virtualization/template_docker/5.0/README.md This Zabbix agent item key uses `system.run` to execute a shell command. It obtains detailed information for a container (`{#NAMES}`) from the Docker Unix socket using `curl`, and pipes the JSON to `jq` (via the Zabbix macro `{$JQ_DOCKER_VOLUMES}`, typically `jq .Mounts[].Source`) to extract an array of volume source paths. It requires `curl`, `jq`, and a Zabbix agent with `system.run` enabled. ```Shell system.run[curl -s --unix-socket /var/run/docker.sock http:/containers{#NAMES}/json| {$JQ_DOCKER_VOLUMES}] ``` -------------------------------- ### Compiling Go External Script for Zabbix Source: https://github.com/zabbix/community-templates/blob/main/Applications/Web-servers/template_nginx_stat_getter._simple_check_for_nginx_stats/5.0/README.md Provides the command to compile the `nginx_stat_getter` Go program using the `go build` tool. It uses environment variables (`GOOS`, `GOARCH`) to specify the target operating system and architecture, allowing cross-compilation for the Zabbix server platform. ```Go env GOOS={OS} GOARCH={ARCH} go build -v github.com/username/nginx_stat_getter ``` -------------------------------- ### Get Docker Container Volume Sources (Shell/jq) Source: https://github.com/zabbix/community-templates/blob/main/Virtualization/template_docker/5.4/README.md This Zabbix `system.run` command retrieves the source paths of volumes for a specific Docker container identified by `{#NAMES}`. It uses `curl` to query the Docker API and pipes the JSON output to `jq` using the `{$JQ_DOCKER_VOLUMES}` macro. Requires `curl`, `jq`, and access to `/var/run/docker.sock`. ```Shell system.run[curl -s --unix-socket /var/run/docker.sock http:/containers{#NAMES}/json| {$JQ_DOCKER_VOLUMES}] ``` -------------------------------- ### Checking HAProxy Config File Checksum - Zabbix Source: https://github.com/zabbix/community-templates/blob/main/Applications/High_Availability_(HA)/template_haproxy_using_socket/5.4/README.md This Zabbix agent item calculates the checksum of the HAProxy configuration file. It uses a standard Zabbix agent key and a Zabbix macro to specify the configuration file path. ```Zabbix vfs.file.cksum[{$HAPROXY_CONFIG}] ``` -------------------------------- ### Discovering Gateways Zabbix Source: https://github.com/zabbix/community-templates/blob/main/Telephony/PBX/template_s_3cx_odbc/5.4/README.md This Zabbix item key utilizes the `db.odbc.discovery` function to query the ODBC data source specified by the `{$DSN3CX}` macro for trunk or gateway details. It enables Low-Level Discovery (LLD) to automatically create monitoring items for each configured 3CX gateway. A properly configured ODBC connection to the 3CX database is a prerequisite. ```Zabbix db.odbc.discovery\[discovery.gws,{$DSN3CX}\] ``` -------------------------------- ### Getting Power Supply Operational Status SNMP Key (Zabbix) Source: https://github.com/zabbix/community-templates/blob/main/Storage_Devices/Oracle/template_tape_library_oracle_storagetek_sl150/6.0/README.md This SNMP agent key is used in Zabbix Low-Level Discovery (LLD) to indicate if a specific power supply instance identified by {#SNMPINDEX} is operational (2). This is meaningless if the supply is not installed. ```SNMP slPowerSupplyOperational[{#SNMPINDEX}] ``` -------------------------------- ### Get Chronyd Version - Shell Source: https://github.com/zabbix/community-templates/blob/main/Applications/NTP/template_chrony_accuracy/5.0/README.md Executes the `chronyd` daemon with the `--version` flag to retrieve and output its installed version string. This command is typically used within a Zabbix `system.run` agent item to monitor the version of the chrony daemon running on the server. ```Shell chronyd --version ``` -------------------------------- ### Get Docker Container Mount Destinations (Shell/jq) Source: https://github.com/zabbix/community-templates/blob/main/Virtualization/template_docker/5.4/README.md This Zabbix `system.run` command retrieves the destination paths of mounts for a specific Docker container identified by `{#NAMES}`. It uses `curl` to query the Docker API and pipes the JSON output to `jq` using the `{$JQ_DOCKER_MOUNTS}` macro. Requires `curl`, `jq`, and access to `/var/run/docker.sock`. ```Shell system.run[curl -s --unix-socket /var/run/docker.sock http:/containers{#NAMES}/json| {$JQ_DOCKER_MOUNTS}] ``` -------------------------------- ### Getting HAProxy Backend Status (Zabbix Item Key) Source: https://github.com/zabbix/community-templates/blob/main/Applications/High_Availability_(HA)/template_haproxy_using_socket/6.0/README.md This Zabbix item key retrieves the status of a specific HAProxy backend, represented as 1 for UP and 0 for DOWN. It uses the HAProxy socket path and the backend name as parameters. ```Zabbix Item Key haproxy.stats[{$HAPROXY_SOCK},{#BACKEND_NAME},BACKEND,status] ``` -------------------------------- ### Collecting HAProxy Frontend Requests rate - Zabbix agent (active) Source: https://github.com/zabbix/community-templates/blob/main/Applications/High_Availability_(HA)/template_haproxy_using_socket/5.4/README.md Measures the rate of HTTP requests received per second on the frontend. Keeping an eye on peaks and drops is essential to ensure continuous service availability. ```Zabbix agent (active) haproxy.stats[{$HAPROXY_SOCK},{#FRONTEND_NAME},FRONTEND,req_rate] ``` -------------------------------- ### Installing Zabbix PHP-FPM Userparameter File - Shell Source: https://github.com/zabbix/community-templates/blob/main/Applications/Web-servers/template_zabbix_4.0_php-fpm_pools_(lld_+_http_agent)/5.4/README.md This command copies the Zabbix agent userparameter configuration file for PHP-FPM into the Zabbix agent's configuration include directory. ```Shell # cp /tmp/zabbix-template/userparameter\_php-fpm.conf /etc/zabbix/zabbix\_agentd.d ``` -------------------------------- ### Define Zabbix UserParameter for Netbackup Status (Shell) Source: https://github.com/zabbix/community-templates/blob/main/Applications/template_netbackup/5.0/README.md This Zabbix agent UserParameter defines a custom check named 'backup'. It executes a shell command pipeline: `bpdbjobs -summary` gets Netbackup job summary, `awk '{print $7}'` extracts the 7th field (likely a status code), `grep -n ^` adds line numbers, and `grep ^2` filters for lines starting with '2'. This is used to determine the Netbackup backup status for a Zabbix item. It requires the Zabbix agent to be installed on the Netbackup Master server (Linux) and the Netbackup command path (`/usr/openv/netbackup/bin/admincmd/`) to be accessible and executable by the agent user. The expected output is a single line matching the final `grep` pattern. ```Shell UserParameter=backup,/usr/openv/netbackup/bin/admincmd/bpdbjobs -summary | awk '{print $7}' | grep -n ^ | grep ^2 ``` -------------------------------- ### Defining Zabbix User Parameters for VM Counts (Zabbix Agent Config) Source: https://github.com/zabbix/community-templates/blob/main/Virtualization/VMmanager/template_vmmanager_6_kvm_hypervisor/6.0/README.md These Zabbix agent user parameters define custom items (`vm.all` and `vm.running`) that execute shell commands via `sudo` to count the total and running virtual machines using `virsh` and `wc -l`. These parameters require the `sudoers` configuration shown previously to function correctly. ```Zabbix Agent Config UserParameter=vm.all,sudo virsh -q list --all | wc -l UserParameter=vm.running,sudo virsh -q list | wc -l ``` -------------------------------- ### Test Supervisor Discovery Script - Shell Source: https://github.com/zabbix/community-templates/blob/main/Applications/template_supervisor/5.4/README.md This command executes the Python supervisor script from the command line with the 'discovery' argument and the path to the supervisor socket. It's used to test if the script runs correctly and produces the expected output for Zabbix's low-level discovery. ```Shell ./supervisor.py discovery /var/run/supervisor.sock ``` -------------------------------- ### Setting HAProxy Stats Timeout (HAProxy Config) Source: https://github.com/zabbix/community-templates/blob/main/Applications/High_Availability_(HA)/template_haproxy_using_socket/5.4/README.md This configuration line sets the timeout for connections to the HAProxy statistics socket. It ensures that connections are closed after 30 seconds of inactivity. This line should be added to the HAProxy configuration file, typically /etc/haproxy/haproxy.cfg. ```HAProxy Config stats timeout 30s ``` -------------------------------- ### Testing HAProxy Stats Socket Connection Bash Source: https://github.com/zabbix/community-templates/blob/main/Applications/High_Availability_(HA)/template_haproxy_using_socket/5.0/README.md This command tests the connectivity and basic functionality of the HAProxy statistics socket. It uses `echo` to send commands (`show info; show stat`) to the socket via `socat`, simulating how the Zabbix scripts will interact with it. The command requires the HAProxy user to have read permissions on the socket. ```Bash sudo -uhaproxy echo "show info;show stat" | socat stdio unix-connect:/var/lib/haproxy/stats ``` -------------------------------- ### Getting System Uptime Zabbix Agent Key Source: https://github.com/zabbix/community-templates/blob/main/Applications/template_eocortex_vms/5.4/README.md Retrieves the duration since the system was last started using the Zabbix agent's built-in uptime check. This item is used to track how long the server has been continuously operational. The output is the system uptime in seconds. ```Zabbix Agent Key system.uptime ``` -------------------------------- ### Defining Zabbix User Parameter for GPU Metrics (Zabbix Agent/Shell) Source: https://github.com/zabbix/community-templates/blob/main/Server_Hardware/Intel/template_intel_quicksync_gpu_metrics/5.4/README.md Configures a Zabbix agent user parameter 'gpu.metrics' to collect specific Intel QuickSync GPU metrics. It runs the 'metrics_monitor' tool via sudo, processes the output using shell commands (sed, grep, awk) to isolate and return the requested metric value. ```Zabbix Agent / Shell UserParameter=gpu.metrics[*],sudo /opt/intel/mediasdk/tools/metrics\_monitor/\_bin/metrics\_monitor "$2" "$3" | sed 's/ usage://g' | sed 's/\t/\n/g' | sed 's/,//g' | sed 's/T F/T\_F/g' | grep "$1" | awk '{print $ 2}' ``` -------------------------------- ### Compiling Go Binary for Zabbix External Script (Shell) Source: https://github.com/zabbix/community-templates/blob/main/Applications/Web-servers/template_fcgi_stat_getter._monitor_php-fpm_without_nginx_proxy/5.0/README.md Generic command to cross-compile the Go-based `fcgi_stat_getter` binary for a specific target operating system ({OS}) and architecture ({ARCH}). Requires the Go compiler installed and configured. ```Shell env GOOS={OS} GOARCH={ARCH} go build -v github.com/username/fcgi\_stat\_getter ``` -------------------------------- ### Getting Total Memory Zabbix Agent Key Source: https://github.com/zabbix/community-templates/blob/main/Applications/template_eocortex_vms/5.4/README.md Retrieves the total amount of physical memory installed on the system using the Zabbix agent's built-in memory size check. This item provides the baseline for total available RAM. The output is the total memory in bytes. ```Zabbix Agent Key vm.memory.size[total] ``` -------------------------------- ### Collecting Docker Container Mount Destinations (Shell, Zabbix) Source: https://github.com/zabbix/community-templates/blob/main/Virtualization/template_docker/5.0/README.md This Zabbix agent item key uses `system.run` to execute a shell command. It retrieves detailed information for a container (`{#NAMES}`) from the Docker Unix socket using `curl`, and pipes the JSON to `jq` (via the Zabbix macro `{$JQ_DOCKER_MOUNTS}`, typically `jq .Mounts[].Destination`) to extract an array of mount destination paths. It requires `curl`, `jq`, and a Zabbix agent with `system.run` enabled. ```Shell system.run[curl -s --unix-socket /var/run/docker.sock http:/containers{#NAMES}/json| {$JQ_DOCKER_MOUNTS}] ``` -------------------------------- ### Discovering VM Mounted Filesystems - Zabbix Agent Key Source: https://github.com/zabbix/community-templates/blob/main/Virtualization/VMware/template_vmware_esx/5.4/README.md Discovers mounted file systems within a guest virtual machine. This key is used in a discovery rule and requires {$URL} and {HOST.HOST}. ```Zabbix Agent Key vmware.vm.vfs.fs.discovery[{$URL},{HOST.HOST}] ``` -------------------------------- ### Encoding AdGuard Home Credentials Base64 (PowerShell) Source: https://github.com/zabbix/community-templates/blob/main/Applications/DNS/AdGuard_Home/6.4/README.md Illustrates how to use PowerShell's .NET interop features to perform Base64 encoding of the `username:password` string. It uses `[System.Text.Encoding]::UTF8.GetBytes` to get bytes and `[Convert]::ToBase64String` to perform the encoding. This is a setup step for the Zabbix template. ```PowerShell $string = 'username:password' [Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($string)) ``` -------------------------------- ### Enable and Start Systemd Timer for Zypper Monitoring (Bash) Source: https://github.com/zabbix/community-templates/blob/main/Operating_Systems/Linux/template_zypper_updateinfo/6.4/README.md These commands configure and activate the Systemd timer unit responsible for periodically executing the Zypper update information collection script. They reload Systemd configuration, enable the timer for automatic startup on boot, and initiate it immediately. ```Bash systemctl daemon-reload systemctl enable zabbix-template-module-zypper-updateinfo.timer systemctl start zabbix-template-module-zypper-updateinfo.timer ```