1. Install Zabbix repo:
$ wget https://repo.zabbix.com/zabbix/6.4/debian/pool/main/z/zabbix-release/zabbix-release_latest%2Bdebian12_all.deb
$ dpkg -i zabbix-release*
$ apt update
2. Install Zabbix Agent 2:
$ apt install zabbix-agent2 zabbix-agent2-plugin-*
3. Start Zabbix agent 2 process and make it start at system boot:
$ systemctl restart zabbix-agent2
$ systemctl enable zabbix-agent2
4. Check if Zabbix agent is running:
$ systemctl status zabbix-agent2
5. Edit Zabbix agent config files
Now that the agent software is operational. Next step is to edit the Zabbix Agent configuration file and specify the Zabbix server it should connect to:
$ nano /etc/zabbix/zabbix_agent2.conf
Server=Your_Zabbix_server_IP
ServerActive=Your_Zabbix_server_IP
ListenPort=10050
Hostname=Agent_hostname_as_returned_by_hostname_command
5. Restart Zabbix agent for the settings to take effect:
$ systemctl restart zabbix-agent2
6. Configure HOST on Zabbix server side:
Navigate to Configuration >> Hosts and click the Create Host button on the zabbix web interface. When the configuration dialog appears, the Host tab should open by default. Complete the following fields and leave the others unchanged:
Host:
Host name: Your hostname as returned by hostname command
Templates: Linux by Zabbix agent and Proxmox VE by HTTP
Host Groups: Linux Servers
Interfaces:
Add a new interface
Type: Agent
IP Address: Proxmox server IP
DNS Name: Type the server FQDN or leave empty
Connect to: Select IP
Port: 10050
Description: Anything you want
Monitored by Proxy: (no proxy)
7. Configure proxmox for Zabbix connection
Now in Proxmox, we have to add the Zabbix user and token.
Datacenter > Permissions > User > Add
User name: zabbix
Realm: Linux PAM
Expire: never
Enabled: checked
First Name: any
Last Name: any
Datacenter > Permissions > Api Tokens > Add
User: Select the created user
Token ID: Any (e.g., Zabbix1)
Privilege separation: checked
After clicking Add, save the Token ID and Secret, as the Secret will no longer be available later.
In Proxmox, add permissions for the user and token
Datacenter > Permissions > Add > User Permission
Fill in:
enter > Permissions > Api Tokens > Add
Path: /
User: Select the created user
Role: PVEAuditor
Propagate: unchecked
---
Path: /nodes
User: Select the created user
Role: PVEAuditor
Propagate: checked
---
Path: /vms
User: Select the created user
Role: PVEAuditor
Propagate: checked
---
Path: /storage
User: Select the created user
Role: PVEAuditor
Propagate: checked
Datacenter > Permissions > Add > Api Token Permission
Set identical permissions for the token as for the user.
8. Adding API to PROXMOX
Return to Zabbix configuration to set the generated Token
Data collection > Hosts > PROXMOX> Macros
{$PVE.TOKEN.ID} value: Token ID
{$PVE.TOKEN.SECRET} value: Secret
That’s it, let’s test it out. Navigate to Monitoring >> Latest data. In the filter section, enter the name of your Proxmox server in the Hosts box, type Proxmox in the Name box, and then click Apply. You should see a list of items related to it, such as Proxmox: API service status, and more.
Enjoy!
Dodaj komentarz