### Example Response for Item Get Source: https://www.zabbix.com/documentation/current/en/manual/api/reference/item/get An example response showing retrieved item details, including item ID, key, name, and host information. ```json { "jsonrpc": "2.0", "result": [ { "itemid": "42269", "type": "18", "snmp_oid": "", "hostid": "10084", "name": "CPU utilization", "key_": "system.cpu.util", "delay": "0", "history": "7d", "trends": "365d", "status": "0", "value_type": "0", "trapper_hosts": "", "units": "%", "logtimefmt": "", "templateid": "42267", "valuemapid": "0", "params": "", "ipmi_sensor": "", "authtype": "0", "username": "", "password": "", "publickey": "", "privatekey": "", "flags": "0", "interfaceid": "0", "description": "CPU utilization in %.", "inventory_link": "0", "evaltype": "0", "jmx_endpoint": "", "master_itemid": "42264", "timeout": "", "url": "", "query_fields": [], "posts": "", "status_codes": "200", "follow_redirects": "1", "post_type": "0", "http_proxy": "", "headers": [], "retrieve_mode": "0", "request_method": "0", "output_format": "0", "ssl_cert_file": "", "ssl_key_file": "", "ssl_key_password": "", "verify_peer": "0", "verify_host": "0", "allow_traps": "0", "uuid": "", "state": "0", "error": "", "parameters": [], "lastclock": "0", "lastns": "0", "lastvalue": "0", "prevvalue": "0", "name_resolved": "CPU utilization" }, { "itemid": "42259", "type": "0", "snmp_oid": "", "hostid": "10084", "name": "Load average (15m avg)", "key_": "system.cpu.load[all,avg15]", "delay": "1m", "history": "7d", "trends": "365d", "status": "0", "value_type": "0", "trapper_hosts": "", "units": "", "logtimefmt": "", "templateid": "42219", "valuemapid": "0", "params": "", "ipmi_sensor": "", "authtype": "0", "username": "", "password": "", "publickey": "", "privatekey": "", "flags": "0", "interfaceid": "1", "description": "", "inventory_link": "0", "evaltype": "0", "jmx_endpoint": "", "master_itemid": "0", "timeout": "", "url": "", "query_fields": [], "posts": "", "status_codes": "200", "follow_redirects": "1", "post_type": "0", "http_proxy": "", "headers": [], "retrieve_mode": "0", "request_method": "0", "output_format": "0", "ssl_cert_file": "", "ssl_key_file": "", "ssl_key_password": "", "verify_peer": "0", "verify_host": "0", "allow_traps": "0", "uuid": "", "state": "0", "error": "", "parameters": [], "lastclock": "0", "lastns": "0", "lastvalue": "0", "prevvalue": "0", "name_resolved": "Load average (15m avg)" }, { "itemid": "42249", "type": "0", "snmp_oid": "", "hostid": "10084", "name": "Load average (1m avg)", "key_": "system.cpu.load[all,avg1]", "delay": "1m", "history": "7d", "trends": "365d", "status": "0", "value_type": "0", "trapper_hosts": "", "units": "", "logtimefmt": "", "templateid": "42209", "valuemapid": "0", "params": "", "ipmi_sensor": "", "authtype": "0", "username": "", "password": "", "publickey": "", "privatekey": "", "flags": "0", "interfaceid": "1", "description": "", "inventory_link": "0", "evaltype": "0", "jmx_endpoint": "", "master_itemid": "0", "timeout": "", "url": "", "query_fields": [], "posts": "", "status_codes": "200", "follow_redirects": "1", "post_type": "0", "http_proxy": "", "headers": [], "retrieve_mode": "0", "request_method": "0", "output_format": "0", "ssl_cert_file": "", "ssl_key_file": "", "ssl_key_password": "", "verify_peer": "0", "verify_host": "0", "allow_traps": "0", "uuid": "", "state": "0", "error": "", "parameters": [], "lastclock": "0", "lastns": "0", "lastvalue": "0", "prevvalue": "0", "name_resolved": "Load average (1m avg)" } ] } ``` -------------------------------- ### VMware Monitoring Setup Example Source: https://www.zabbix.com/documentation/current/en/manual/vm_monitoring/example A practical example demonstrating the configuration steps for setting up VMware monitoring in Zabbix. This includes creating a host, linking a template, and configuring necessary parameters. ```text 1. Add VMware vCenter or ESXi host in Zabbix. 2. Link the 'VMware services' template. 3. Configure User, Password, and API URL. 4. Ensure Zabbix server can reach the VMware API. ``` -------------------------------- ### VMware Monitoring Setup Example Source: https://www.zabbix.com/documentation/current/en/manual/guides/monitor_vmware This example outlines the general steps for setting up VMware monitoring in Zabbix. It involves configuring the Zabbix server, creating a VMware user, and setting up discovery rules and items. ```text 1. Ensure Zabbix server has network access to vCenter/ESXi hosts. 2. Create a dedicated read-only user in vCenter for Zabbix. 3. Configure Zabbix server to use the VMware collector (zabbix_server.conf). 4. Set up a Zabbix template for VMware monitoring (e.g., 'VMware vCenter'). 5. Create a low-level discovery rule for VMware VMs and hosts. 6. Link the template to the discovered hosts. ``` -------------------------------- ### Start Request Example Source: https://www.zabbix.com/documentation/current/en/manual/appendix/protocols/zabbix_agent2_plugin This request is sent by the agent to initiate the execution of the Start function within a plugin's Runner interface. It only contains common data parameters. ```json {"id":3,"type":4} ``` -------------------------------- ### Basic Makefile Deployment Source: https://www.zabbix.com/documentation/current/en/manual/installation/containers Starts a default Zabbix setup including server, web interface, and MySQL database, all using Alpine Linux images. ```bash make up ``` -------------------------------- ### Example: Force Active Checks on Start for Uptime Plugin Source: https://www.zabbix.com/documentation/current/en/manual/extensions/plugins This example demonstrates how to configure the Uptime plugin to force active checks immediately after the agent restarts. ```configuration Plugins.Uptime.System.ForceActiveChecksOnStart=1 ``` -------------------------------- ### Example of INSTALLFOLDER Parameter for Zabbix Agent 2 Source: https://www.zabbix.com/documentation/current/en/manual/installation/install_from_packages/win_msi Specifies a custom installation folder for Zabbix agent 2 and its loadable plugins. ```bash INSTALLFOLDER="C:\Program Files\Zabbix Agent 2" ``` -------------------------------- ### Go Get: Add Third-Party Package Source: https://www.zabbix.com/documentation/guidelines/en/coding/go/code_style Use the `go get` command from the `~/zabbix/src/go` directory to add third-party Go packages to your project. This command fetches and installs the specified package. ```bash go get example.com/pkg ``` -------------------------------- ### SNMP Get Example Source: https://www.zabbix.com/documentation/current/en/manual/config/items/itemtypes/snmp Example of using the 'get' OID format to retrieve a single value asynchronously. This is recommended for better performance. ```text get[1.3.6.1.2.1.31.1.1.1.6.3] ``` -------------------------------- ### VMware VM Property Examples Source: https://www.zabbix.com/documentation/current/en/manual/vm_monitoring/vmware_keys Examples of retrieving specific properties for a VMware VM. Use these to get status or runtime information. ```zabbix-agent vmware.vm.property[{$VMWARE.URL},{$VMWARE.VM.UUID},overallStatus] ``` ```zabbix-agent vmware.vm.property[{$VMWARE.URL},{$VMWARE.VM.UUID},runtime.powerState] ``` -------------------------------- ### Examples of Running Zabbix Server with Parameters Source: https://www.zabbix.com/documentation/current/en/manual/concepts/server Demonstrates how to run the Zabbix server with specific command-line arguments, such as specifying a configuration file or requesting help. ```bash zabbix_server -c /usr/local/etc/zabbix_server.conf zabbix_server --help zabbix_server -V ``` -------------------------------- ### Dashboard Get Response Example Source: https://www.zabbix.com/documentation/current/en/manual/api/reference/dashboard/get This is an example of a successful response when retrieving dashboard data. It includes details about the dashboard, its pages, and widgets. ```json { "jsonrpc": "2.0", "result": [ { "dashboardid": "1", "name": "Dashboard", "userid": "1", "private": "0", "display_period": "30", "auto_start": "1", "users": [], "userGroups": [], "pages": [ { "dashboard_pageid": "1", "name": "", "display_period": "0", "widgets": [ { "widgetid": "9", "type": "systeminfo", "name": "", "x": "12", "y": "8", "width": "12", "height": "5", "view_mode": "0", "fields": [] }, { "widgetid": "8", "type": "problemsbysv", "name": "", "x": "12", "y": "4", "width": "12", "height": "4", "view_mode": "0", "fields": [] }, { "widgetid": "7", "type": "problemhosts", "name": "", "x": "12", "y": "0", "width": "12", "height": "4", "view_mode": "0", "fields": [] }, { "widgetid": "6", "type": "discovery", "name": "", "x": "6", "y": "9", "width": "18", "height": "4", "view_mode": "0", "fields": [] }, { "widgetid": "5", "type": "web", "name": "", "x": "0", "y": "9", "width": "18", "height": "4", "view_mode": "0", "fields": [] }, { "widgetid": "4", "type": "problems", "name": "", "x": "0", "y": "3", "width": "12", "height": "6", "view_mode": "0", "fields": [] }, { "widgetid": "3", "type": "favmaps", "name": "", "x": "8", "y": "0", "width": "12", "height": "3", "view_mode": "0", "fields": [] }, { "widgetid": "1", "type": "favgraphs", "name": "", "x": "0", "y": "0", "width": "12", "height": "3", "view_mode": "0", "fields": [] } ] }, { "dashboard_pageid": "2", "name": "", "display_period": "0", "widgets": [] }, { "dashboard_pageid": "3", "name": "Custom page name", "display_period": "60", "widgets": [] } ] }, { "dashboardid": "2", "name": "My dashboard", "userid": "1", "private": "1", "display_period": "30", "auto_start": "1", "users": [], "userGroups": [] } ] } ``` -------------------------------- ### Initialize Go Module and Download Dependencies Source: https://www.zabbix.com/documentation/guidelines/en/plugins/loadable_plugins Use this bash script to initialize your Go module, download plugin dependencies, and build the plugin executable. Ensure you replace 'branchname' with the correct branch or commit hash. ```bash go mod init myip GOPROXY=direct go get git.zabbix.com/ap/plugin-support/plugin@branchname go mod tidy go build ``` -------------------------------- ### Start Zabbix Server Manually Source: https://www.zabbix.com/documentation/current/en/manual/concepts/server Execute the zabbix_server binary directly to start the server manually. This is an alternative if package installation commands do not work. ```bash zabbix_server ``` -------------------------------- ### Run Zabbix Web Service Source: https://www.zabbix.com/documentation/current/en/manual/appendix/install/web_service Start the Zabbix web service process after installation. This command should be run on the machine where the web service is installed. ```bash zabbix_web_service ``` -------------------------------- ### Creating Plugin Directory and Main File Source: https://www.zabbix.com/documentation/guidelines/en/plugins/loadable_plugins Commands to create the plugin directory and the main Go source file. ```bash mkdir -p /usr/local/zabbix/go/plugins/myip cd /usr/local/zabbix/go/plugins/myip vi main.go ``` -------------------------------- ### Initialize vcpkg and install dependencies Source: https://www.zabbix.com/documentation/current/en/manual/installation/install/building_zabbix_agent_2_on_windows This command initializes vcpkg, adds necessary ports (pcre2, libiconv, openssl), and installs them for static MinGW builds. Ensure the correct MinGW path is set. ```bash cd C:\Zabbix set PATH=%PATH%;"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\vcpkg" vcpkg new --application vcpkg add port pcre2 vcpkg add port libiconv vcpkg add port openssl # For 64-bit builds: set PATH=C:\Zabbix\mingw64\bin;%PATH% vcpkg install --triplet x64-mingw-static --x-install-root=x64 # For 32-bit builds: set PATH=C:\Zabbix\mingw32\bin;%PATH% vcpkg install --triplet x86-mingw-static --x-install-root=x86 ``` -------------------------------- ### Example LoadModule Formats Source: https://www.zabbix.com/documentation/current/en/manual/appendix/config/zabbix_server Demonstrates the different formats for specifying modules to be loaded by the Zabbix server at startup. Modules extend server functionality and must be located in a specified path or have an absolute path provided. ```text LoadModule= LoadModule= LoadModule= ``` -------------------------------- ### Example Trigger Definition for Package Changes Source: https://www.zabbix.com/documentation/current/en/manual/xml_export_import/templates Defines a trigger that alerts when the number of installed packages on a Linux system changes. This is useful for detecting unauthorized software installations or removals. ```yaml zabbix_export: (...) templates: (...) items: (...) - uuid: 58818005e76d46dda14d6592f601ab00 (...) triggers: - uuid: b950c306394f4b3c902060a8273cbcde expression: 'change(/Linux by Zabbix agent/system.sw.packages.get)<>0' name: 'Linux: Number of installed packages has been changed' priority: WARNING manual_close: 'YES' tags: - tag: scope value: notice (...) ``` -------------------------------- ### Start Zabbix Proxy (init.d) Source: https://www.zabbix.com/documentation/current/en/manual/concepts/proxy Use this command to start the Zabbix proxy service on systems using init.d. ```bash /etc/init.d/zabbix-proxy start ``` -------------------------------- ### Start Zabbix Agent 2 on Unix-like Systems Source: https://www.zabbix.com/documentation/current/en/manual/concepts/agent2 Use systemctl to start the Zabbix agent 2 service on Unix-like systems. Ensure the agent is installed via packages. ```bash systemctl start zabbix-agent2 ``` -------------------------------- ### Zabbix Agent 2 Command-Line Examples Source: https://www.zabbix.com/documentation/current/en/manual/concepts/agent2 Demonstrates common command-line usage for Zabbix agent 2, including printing items, testing user parameters, installing the Windows agent, and setting service startup types. ```bash zabbix_agent2 --print ``` ```bash zabbix_agent2 -t "mysql.ping" -c /etc/zabbix/zabbix_agentd.conf ``` ```bash zabbix_agent2.exe -i ``` ```bash zabbix_agent2.exe -c zabbix_agent2.conf -S delayed ``` -------------------------------- ### Task Get Response Example Source: https://www.zabbix.com/documentation/current/en/manual/api/reference/task/get This is an example response for the task.get method when retrieving a task by its ID. It includes detailed information about the task's status, type, and associated requests. ```json { "jsonrpc": "2.0", "result": [ { "taskid": "1", "type": "7", "status": "3", "clock": "1601039076", "ttl": "3600", "proxyid": null, "request": { "alerting": { "stats": [ "alerts" ], "top": { "media.alerts": 10 } }, "lld": { "stats": "extend", "top": { "values": 5 } } }, "result": { "data": { "alerting": { "alerts": 0, "top": { "media.alerts": [] }, "time": 0.000663 }, "lld": { "rules": 0, "values": 0, "top": { "values": [] }, "time": 0.000442 } }, "status": "0" } } ], "id": 1 } ``` -------------------------------- ### Plugin Logging Example Source: https://www.zabbix.com/documentation/guidelines/en/plugins/built_in_plugins Demonstrates how to use logging functions within a plugin to record messages that appear in the agent's logs. ```go p.Infof("received request to handle %s key with %d parameters", key, len(params)) ``` -------------------------------- ### Map Get API Response Example Source: https://www.zabbix.com/documentation/current/en/manual/api/reference/map/get This is an example response from the map.get API method, showing detailed information about map elements, links, users, user groups, and shapes. ```json { "jsonrpc": "2.0", "result": [ { "selements": [ { "selementid": "10", "sysmapid": "3", "elementtype": "4", "evaltype": "0", "iconid_off": "1", "iconid_on": "0", "label": "Zabbix server", "label_location": "3", "x": "11", "y": "141", "iconid_disabled": "0", "iconid_maintenance": "0", "elementsubtype": "0", "areatype": "0", "width": "200", "height": "200", "viewtype": "0", "use_iconmap": "1", "show_label": "-1", "zindex":"0", "elements": [], "urls": [], "tags": [ { "tag": "service", "value": "mysqld", "operator": "0" } ] }, { "selementid": "11", "sysmapid": "3", "elementtype": "4", "evaltype": "0", "iconid_off": "1", "iconid_on": "0", "label": "Web server", "label_location": "3", "x": "211", "y": "191", "iconid_disabled": "0", "iconid_maintenance": "0", "elementsubtype": "0", "areatype": "0", "width": "200", "height": "200", "viewtype": "0", "use_iconmap": "1", "show_label": "0", "zindex":"0", "elements": [], "urls": [], "tags": [] }, { "selementid": "12", "sysmapid": "3", "elementtype": "0", "evaltype": "0", "iconid_off": "185", "iconid_on": "0", "label": "{HOST.NAME}\r\n{HOST.CONN}", "label_location": "0", "x": "111", "y": "61", "iconid_disabled": "0", "iconid_maintenance": "0", "elementsubtype": "0", "areatype": "0", "width": "200", "height": "200", "viewtype": "0", "use_iconmap": "0", "show_label": "1", "zindex":"0", "elements": [ { "hostid": "10084" } ], "urls": [], "tags": [] } ], "links": [ { "linkid": "23", "sysmapid": "3", "selementid1": "10", "selementid2": "11", "drawtype": "0", "color": "00CC00", "label": "", "show_label": "1", "indicator_type": "0", "itemid": "0", "linktriggers": [], "thresholds": [], "highlights": [] } ], "users": [ { "sysmapuserid": "1", "userid": "2", "permission": "2" } ], "userGroups": [ { "sysmapusrgrpid": "1", "usrgrpid": "7", "permission": "2" } ], "shapes":[ { "sysmap_shapeid":"1", "type":"0", "x":"0", "y":"0", "width":"680", "height":"15", "text":"{MAP.NAME}", "font":"9", "font_size":"11", "font_color":"000000" } ] } ] } ``` -------------------------------- ### Initialize vcpkg and install dependencies Source: https://www.zabbix.com/documentation/current/en/manual/installation/install/win_agent Initializes vcpkg for application development and adds necessary ports for PCRE2 and OpenSSL. It then installs these dependencies for a static x64 Windows build, specifying the installation root. ```bash cd C:\Zabbix vcpkg new --application vcpkg add port pcre2 vcpkg add port openssl vcpkg install --triplet x64-windows-static --x-install-root="C:\Program Files\Zabbix\x64" ``` -------------------------------- ### Start Zabbix Agent Service (Custom Config) Source: https://www.zabbix.com/documentation/current/en/manual/appendix/install/windows_agent Start a single Zabbix agent service that was installed with a specific configuration file. Ensure the correct configuration file path is provided. ```bash zabbix_agentd.exe --config --start ``` -------------------------------- ### Start Zabbix Agent Service (Default Config) Source: https://www.zabbix.com/documentation/current/en/manual/appendix/install/windows_agent Start a single Zabbix agent service that was installed with the default configuration file. This can be done via Control Panel or the command line. ```bash zabbix_agentd.exe --start ``` -------------------------------- ### Start Zabbix Server using init.d Source: https://www.zabbix.com/documentation/current/en/manual/concepts/server Use this command to start the Zabbix server process on systems using init.d scripts. ```bash /etc/init.d/zabbix-server start ``` -------------------------------- ### Example Host Metadata Output Source: https://www.zabbix.com/documentation/current/en/manual/discovery/auto_registration Illustrates the expected format of host metadata for Linux and Windows systems after configuring HostMetadataItem=system.uname. ```text Linux: Linux server3 3.2.0-4-686-pae #1 SMP Debian 3.2.41-2 i686 GNU/Linux Windows: Windows WIN-0PXGGSTYNHO 6.0.6001 Windows Server 2008 Service Pack 1 Intel IA-32 ``` -------------------------------- ### Example Script Execution and Result Source: https://www.zabbix.com/documentation/current/en/manual/web_interface/frontend_sections/alerts/scripts Demonstrates a sample script execution and the expected result window format. Includes a script that echoes user information and a call to a non-existent script. ```shell uname -v /tmp/non_existing_script.sh echo "This script was started by {USER.USERNAME}" ``` -------------------------------- ### User Get Response Example Source: https://www.zabbix.com/documentation/current/en/manual/api/reference/user/get This is an example of a successful response when retrieving user data. It shows the structure of the returned user object, including nested role details when 'selectRole' is set to 'extend'. ```json { "jsonrpc": "2.0", "result": [ { "userid": "12", "username": "John", "role": { "roleid": "5", "name": "Operator", "type": "1", "readonly": "0" } } ], "id": 1 } ``` -------------------------------- ### VMware Datastore Hypervisor List Example Source: https://www.zabbix.com/documentation/current/en/manual/vm_monitoring/vmware_keys Example output showing a list of hypervisors associated with a VMware datastore. This helps identify which hosts are using a specific datastore. ```text esx7-01-host.zabbix.sandbox esx7-02-host.zabbix.sandbox ``` -------------------------------- ### Display All Configure Options Source: https://www.zabbix.com/documentation/current/en/manual/installation/install View all available configuration options for Zabbix server or proxy by running the configure script with the --help flag. ```bash ./configure --help ``` -------------------------------- ### Install Zabbix Agent as Windows Service (Custom Config) Source: https://www.zabbix.com/documentation/current/en/manual/appendix/install/windows_agent Install a Zabbix agent service using a specific configuration file. A full path to the configuration file must be provided. This is essential for non-default setups. ```bash zabbix_agentd.exe --config --install ``` -------------------------------- ### Full Sentence Comment Example Source: https://www.zabbix.com/documentation/guidelines/en/coding/php Demonstrates a full sentence comment, starting with a capital letter and ending with a period. ```PHP // This is a full sentence comment. ``` -------------------------------- ### Execute a JavaScript script with a parameter Source: https://www.zabbix.com/documentation/current/en/manpages/zabbix_js This example shows how to execute a JavaScript file named 'script-file.js' and pass 'example' as an input parameter to the script. ```bash zabbix_js -s script-file.js -p example ``` -------------------------------- ### Plugin Logging Example Source: https://www.zabbix.com/documentation/guidelines/en/plugins/loadable_plugins Demonstrates using Infof for logging within the plugin. Log messages appear in the Zabbix agent 2 log. ```go p.Infof("received request to handle %s key with %d parameters", key, len(params)) ```