install zabbix-agent
Go in repo for actual version of rpm (example Centos 7) :
rpm -ivh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
yum -y install zabbix-agent
chkconfig zabbix-agent on
You can use jinja template for config of zabbix-agent /etc/zabbix/zabbix_agentd.conf
.
Default settings on agent (other options generally useless):
PidFile=/var/run/zabbix/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log
LogFileSize=0
Server={{ Proxy[hostname] }}
ServerActive={{ Proxy[hostname] }}
Hostname={{ Host[hostname] }} # !!!Must be like name of host in web
Include=/etc/zabbix/zabbix_agentd.d/*.conf
Give access and starting:
iptables -I INPUT -p tcp --dport 10050 -j ACCEPT
iptables-save > /dev/null 2>&1
service zabbix-agent start
If we use selinux, need allow zabbix-agent, or check that selinux disabled. For firewalld:
firewall-cmd --permanent --add-port=10050/tcp
firewall-cmd --reload
You may need to create directories manually:
mkdir /var/run/zabbix && chown -R zabbix:zabbix /var/run/zabbix
mkdir /var/log/zabbix && chown -R zabbix:zabbix /var/log/zabbix
playbook
Example of ansible role for centos 7:
- name: Install, configure, and start zabbix-agent
block:
- name: add rpm
yum: name=https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
- name: install zabbix-agent
yum:
name: zabbix-agent
state: present
- name: copy userparams
copy:
src: 'templates/userparams.conf'
dest: '/etc/zabbix/zabbix_agentd.d/userparams.conf'
owner: zabbix
group: zabbix
- name: make config
template:
src: 'templates/zabbix_agentd.j2'
dest: '/etc/zabbix/zabbix_agentd.conf'
- name: add line in iptables
command: iptables -I INPUT 5 -p tcp --dport 10050 -j ACCEPT
- name: iptables save
shell: iptables-save > /etc/sysconfig/iptables
- name: enable zabbix-agent
command: chkconfig zabbix-agent on
- name: start zabbix-agent
service:
name: zabbix-agent
state: started
when:
- ansible_facts['distribution'] == 'CentOS'
- ansible_facts['distribution_major_version'] == "7"
become: true
ignore_errors: yes
win
If you downloaded archive , unzip the files and put them where they should be (i put the files in c:\zabbix for example). Change settings Server/ServerActive/Hostname in zabbix_agentd.conf. Run cmd from admin:
zabbix_agentd.exe -c c:\zabbix\conf\zabbix_agentd.conf --install
zabbix_agentd.exe --start
Do not forget to add an exception to the firewall =)
Built on GitHub with MkDocs and Pure theme