This script installs and configures the Zabbix Agent on various Linux distributions supported by Zabbix.
To use this script, run the following command:
curl -fsSL https://wmp.github.io/zabbix/install.sh | bash -s -- <Zabbix Server Address> [Zabbix Agent Version] [Hostname]
Usage: install.sh <Zabbix Server Address> [Zabbix Agent Version] [Hostname]
Arguments:
<Zabbix Server Address> The address of the Zabbix server (required).
[Zabbix Agent Version] The version of the Zabbix Agent to install. If not provided, the latest version will be used (optional).
[Hostname] The hostname to be configured for the Zabbix Agent. If not provided, the system hostname will be used (optional).
Example:
curl -fsSL https://wmp.github.io/zabbix/install.sh | bash -s -- zabbix.example.com 7.0 my-hostname
This command installs the Zabbix Agent version 7.0, configures it to connect to zabbix.example.com
, and sets the hostname to my-hostname
.
The script performs the following steps:
- Checks if the script is running as root.
- Detects the operating system and version.
- Downloads and installs the appropriate Zabbix repository package.
- Installs the Zabbix Agent.
- Configures the Zabbix Agent with the provided server address and hostname.
- Restarts the Zabbix Agent service.
- Debian-based systems: Downloads the appropriate
.deb
package and installs it usingdpkg
. - Red Hat-based systems: Downloads the appropriate
.rpm
package and installs it usingrpm
. - SUSE-based systems: Downloads the appropriate
.rpm
package and installs it usingrpm
andzypper
.
The Zabbix Agent configuration file is located at /etc/zabbix/zabbix_agent2.d/zabbix_agent2.conf
. The script sets the Hostname
, HostnameItem
, Server
, and ServerActive
parameters based on the provided arguments.
This script is provided under the MIT License.