Install Zabbix on CentOS 7
-
Install CentOS 7
yum -y update yum -y install epel-release
Install things you will need (my ISO is based on 1511 which did not have
firewalld
install by default).yum -y install wget nano mariadb mariadb-server firewalld setroubleshoot setools
Turn SELinux off for the install. This is specifically not permanent.
setenforce 0
Change SELinux to allow Zabbix to connect to the network
setsebool -P httpd_can_connect_zabbix on setsebool -P zabbix_can_network on
Start and enable the firewall. Allow HTTP/S and Zabbix ports.
systemctl enable firewalld systemctl start firewalld firewall-cmd --zone=public --add-port=http/tcp --permanent firewall-cmd --zone=public --add-port=https/tcp --permanent firewall-cmd --zone=public --add-port=10050/tcp --permanent firewall-cmd --zone=public --add-port=10051/tcp --permanent firewall-cmd --reload
Start the database and then run the initial configuration
systemctl enable mariadb systemctl start mariadb mysql_secure_installation
This will start a wizard to enable typical security measure for the database. The capitalized letter is the default, and is the choice you want to make, so you can simply hit enter through all of these except for setting the new password, obviously.
Enter current password for root (enter for none): Set root password? [Y/n] New password: databaserootpassword Re-enter new password: databaserootpassword Remove anonymous users? [Y/n] Disallow root login remotely? [Y/n] Remove test database and access to it? [Y/n] Reload privilege tables now? [Y/n]
Sign in to the database and create the ownCloud instance and user.
You will be prompted to enter your database root password.mysql -uroot -p
Now you will run 4 SQL commands, please note the
;
at the end of each. It is a required part of the SQL syntax . These are simplified defaults, I would generally recommend you set them to something a little less obvious just to help with security.create database zabbixdb; create user 'zabbixuser'@'localhost' identified by 'zabbixuserpassword'; grant all on zabbixdb.* to 'zabbixuser'@'localhost'; flush privileges; quit
Install the Zabbix repository
# Zabbix 3.0 #rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm # Zabbix 3.2 rpm -ivh http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm
Install Zabbix Server
yum install zabbix-server-mysql zabbix-web-mysql
From here you can now pick up with the main Zabbix instructions from this point.
I'll retype those later or something.
After your system is up and running, reboot. You should hopefully have a problem with SELinux blocking a couple of things.
[root@zabbix ~]# sealert -a /var/log/audit/audit.log | grep zabbix SELinux is preventing /usr/sbin/zabbix_server_mysql from using the setrlimit access on a process. <snip lots of text> SELinux is preventing /usr/sbin/zabbix_agentd from using the setrlimit access on a process.
Now that these errors are in the audit log, we can set up SELinux to allow it.
If anyone knows SELinux well enough to create the policies needed without waiting for a fail, just let me know. I will be happy to update these instructions.
ausearch -c 'zabbix_server' --raw | audit2allow -M my-zabbixserver semodule -i my-zabbixserver.pp ausearch -c 'zabbix_agentd' --raw | audit2allow -M my-zabbixagentd semodule -i my-zabbixagentd.pp
-
Nice concise guide.
Should be scriptable easily enough as well.
-
Awesome thanks!
I'll be following this tonight -
Very nice, thank you!
-
This is great. Thanks!
-
Now just need to write a guide to unlock it's power, like getting IOPS and other stuff from VM's and ESXi hosts
-
@hobbit666 said in Install Zabbix on CentOS 7:
Now just need to write a guide to unlock it's power, like getting IOPS and other stuff from VM's and ESXi hosts
For the individual VMs, you can push the agent to them. I know it can do some stuff in VMware, but I've not had a VMware host to set that up on.
-
I wrote a post about this on my blog recently. planning the second part on the monitoring part but got deviated to a new project that i am working on.
https://www.ambarishrh.com/2016/08/create-an-awesome-server-monitoring-dashboard-with-zabbix-and-grafana/ -
I think its worth noting that its with a capital "A"
As I definitely typed it wrong alot before realizing -
@Sparkum said in Install Zabbix on CentOS 7:
I think its worth noting that its with a capital "A"
As I definitely typed it wrong alot before realizingThanks @Sparkum will check and update
-
Just finished setting up a Zabbix vm following the guide =).
-
@Romo said in Install Zabbix on CentOS 7:
Just finished setting up a Zabbix vm following the guide =).
I need to finish the guide and figure out the SELinux issues.
-
@JaredBusch It's true, totally forgot we used
setenforce 0
in the guide, so I am not actually finished just yet then =P -
Using
setsebool -P httpd_can_connect_zabbix=1
everything appears to be working. -
So I've got this installed, I've got the agent installed on my windows box, but just cant get any data to send.
I can telnet from Zabbix to windows box on 10050 but not the other way around.
Would that be my issue or no?
Thanks
-
@Sparkum Agents listen on port 10050 and apparently the server listens on port 10051;
so runnning the following on the server:
firewall-cmd --permanent --add-port=10051/tcp
systemctl restart firewalld
Should get the agents connecting properly to the server, I haven't tested it because I have not set any agents to monitor yet in the lab, but from reading the documentation is should work.
-
@Romo
Hmm still no, silly Z doesnt wanna turn green.I assume if I added a linux box I would be up in second.
-
@Sparkum Can you post your dashboard please =). Did you activate the host,
Configuration>hosts>yourhost>enable
? -
Sorry just a screenshot of my dashboard?
Yep, host is enabled.
I'm getting stats from the Zabbix agent, just now windows agent.
-
@Sparkum So its working now, right?