Difference between revisions of "Zabbix Server Installation"

From Michael's Information Zone
Jump to navigation Jump to search
Line 1: Line 1:
==CentOS 7==
+
==Server==
 +
===CentOS 7===
 
  rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
 
  rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
 
  yum install zabbix-server-mysql zabbix-web-mysql
 
  yum install zabbix-server-mysql zabbix-web-mysql
 
  yum install mariadb-server mariadb
 
  yum install mariadb-server mariadb
  
 +
====Database====
 
The following commands are for database creation, but they are not specific. Needs work
 
The following commands are for database creation, but they are not specific. Needs work
 
<pre>
 
<pre>
Line 17: Line 19:
 
Some packages might combine those three SQL files in one, so you will only have create.sql.gz. You can import it directly as "zcat create.sql.gz | mysql zabbix". If you want to see the SQL file, you can extract it with 'tar -xvf create.sql.gz' in a single step.
 
Some packages might combine those three SQL files in one, so you will only have create.sql.gz. You can import it directly as "zcat create.sql.gz | mysql zabbix". If you want to see the SQL file, you can extract it with 'tar -xvf create.sql.gz' in a single step.
 
</pre>
 
</pre>
 +
====Config File====
 
Edit the Zabbix Server configuration file
 
Edit the Zabbix Server configuration file
 
<pre>
 
<pre>
Line 25: Line 28:
 
DBPassword=zabbix
 
DBPassword=zabbix
 
</pre>
 
</pre>
 +
====Starting Service====
 
Start the zabbix server
 
Start the zabbix server
 
  systemctl start zabbix-server
 
  systemctl start zabbix-server
Line 38: Line 42:
 
Start http
 
Start http
 
  systemctl start httpd  
 
  systemctl start httpd  
 +
====SELinus====
 
Configure SELinux to allow the above services network access
 
Configure SELinux to allow the above services network access
 
  setsebool -P zabbix_can_network=true
 
  setsebool -P zabbix_can_network=true
 
  setsebool -P httpd_can_network_connect=true
 
  setsebool -P httpd_can_network_connect=true
 
Enable all service
 
Enable all service
 +
=====Enable services====
 
<pre>
 
<pre>
 
systemctl enable mariadb
 
systemctl enable mariadb
Line 50: Line 56:
  
 
If everything is working reboot the server, and test again.
 
If everything is working reboot the server, and test again.
 +
==Client==
 +
===CentOS 7===
 +
<pre>
 +
rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
 +
yum -y install zabbix-agent
 +
sed -i 's/^Server=127.0.0.1/Server=<your server>/'  /etc/zabbix/zabbix_agentd.conf
 +
sed -i 's/^ServerActive=127.0.0.1/ServerActive=<your server>/' /etc/zabbix/zabbix_agentd.conf
 +
sed -i 's/^Hostname=Zabbix server/#Hostname=Zabbix server/' /etc/zabbix/zabbix_agentd.conf
 +
sed -i 's/^#HostnameItem=/HostnameItem=system.hostname/' /etc/zabbix/zabbix_agentd.conf
 +
sed -i 's/^#HostMetadataItem=/HostMetadataItem=system.uname/' /etc/zabbix/zabbix_agentd.conf
 +
systemctl enable zabbix-agent
 +
systemctl start zabbix-agent
 +
</pre>
 +
 
==Troubleshooting==
 
==Troubleshooting==
 
*Reset the password: use zabbix; update zabbix.users set passwd=md5('newpass') where alias='Admin';
 
*Reset the password: use zabbix; update zabbix.users set passwd=md5('newpass') where alias='Admin';

Revision as of 14:39, 17 May 2018

Server

CentOS 7

rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
yum install zabbix-server-mysql zabbix-web-mysql
yum install mariadb-server mariadb

Database

The following commands are for database creation, but they are not specific. Needs work

shell> mysql -uroot -p<password>
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by '<password>';
mysql> flush privileges;
mysql> quit;
cd /usr/share/doc/zabbix-server-mysql-3.0.4/create
shell>  cat create.sql | mysql -hxxx.xxx.xxx.xxx -uzabbix -p zabbix
Some packages might combine those three SQL files in one, so you will only have create.sql.gz. You can import it directly as "zcat create.sql.gz | mysql zabbix". If you want to see the SQL file, you can extract it with 'tar -xvf create.sql.gz' in a single step.

Config File

Edit the Zabbix Server configuration file

# vi /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix

Starting Service

Start the zabbix server

systemctl start zabbix-server

Edit the php configuration file to use the correct time zone /etc/httpd/conf.d/zabbix.conf

php_value max_execution_time 300
php_value memory_limit 128M
php_value post_max_size 16M
php_value upload_max_filesize 2M
php_value max_input_time 300
php_value date.timezone America/New_York

Start http

systemctl start httpd 

SELinus

Configure SELinux to allow the above services network access

setsebool -P zabbix_can_network=true
setsebool -P httpd_can_network_connect=true

Enable all service

=Enable services

systemctl enable mariadb
systemctl enable httpd
systemctl enable zabbix-server

At this point you should be able to access the web interface by going to <IP of host>/zabbix. User/password is admin/zabbix.

If everything is working reboot the server, and test again.

Client

CentOS 7

rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
yum -y install zabbix-agent
sed -i 's/^Server=127.0.0.1/Server=<your server>/'  /etc/zabbix/zabbix_agentd.conf
sed -i 's/^ServerActive=127.0.0.1/ServerActive=<your server>/' /etc/zabbix/zabbix_agentd.conf
sed -i 's/^Hostname=Zabbix server/#Hostname=Zabbix server/' /etc/zabbix/zabbix_agentd.conf
sed -i 's/^#HostnameItem=/HostnameItem=system.hostname/' /etc/zabbix/zabbix_agentd.conf
sed -i 's/^#HostMetadataItem=/HostMetadataItem=system.uname/' /etc/zabbix/zabbix_agentd.conf
systemctl enable zabbix-agent
systemctl start zabbix-agent

Troubleshooting

  • Reset the password: use zabbix; update zabbix.users set passwd=md5('newpass') where alias='Admin';

https://www.zabbix.com/documentation/3.0/manual/installation/install_from_packages

https://www.zabbix.com/documentation/3.0/manual/appendix/install/db_scripts

https://www.zabbix.com/forum/showthread.php?p=169500

https://www.rackspace.com/knowledge_center/article/installing-mysql-server-on-centos