Introduction
Zabbix is an open source software for networks and application monitoring. It can be used to monitor and track performance and availability of network servers, devices and other IT resources. It supports distributed and WEB monitoring, auto-discovery, and more. Zabbix provides monitoring to its agent via SNMP, TCP and ICMP checks.
You will be learning step by step install Zabbix Server on CentOS 6.
Steps Involved:
Zabbix needs a Web Server, database server and PHP to work. You can install these services by executing the command given below:
To install web server:
yum install httpd httpd-devel -y
To install Database server:
yum install mysql mysql-server -y
To install PHP:
yum install php php-cli php-common php-devel php-pear php-gd php-mbstring php-mysql php-xml -y
Start the services:
Once installed you will need to start the services
To start web server:
service httpd start
To start myslqd service:
service mysqld start
To secure mysql installation execute:
mysql_secure_installation
ENOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MySQL to secure it, we'll need the current password for the root user. If you've just installed MySQL, and you haven't set the root password yet, the password will be blank, so you should just press enter here. Enter current password for root (enter for none) Enter current password for root (enter for none): OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MySQL root user without the proper Authorisation. You already have a root password set, so you can safely answer 'n'. Change the root password? [Y/n] y New password: Re-enter new password: Password updated successfully! Reloading privilege tables.. ... Success! By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? [Y/n] y ... Success! Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] n ... skipping. By default, MySQL comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? [Y/n] y - Dropping test database... ERROR 1008 (HY000) at line 1: Can't drop database 'test'; database doesn't exist ... Failed! Not critical, keep moving... - Removing privileges on test database... ... Success! Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? [Y/n] y Cleaning up... All done! If you've completed all of the above steps, your MySQL installation should now be secure. Thanks for using MySQL! Now Let's create the zabbix database:
Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 12 Server version: 5.1.73 Source distribution Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
Query OK, 1 row affected (0.00 sec)
mysql>
Query OK, 0 rows affected (0.00 sec)
mysql>
Query OK, 0 rows affected (0.00 sec)
mysql>
Query OK, 0 rows affected (0.00 sec)
mysql>
[[email protected] ~]# cd /usr/share/doc/zabbix-server-mysql-*/create [[email protected] ~]# mysql -u root -p zabbix < schema.sql Enter password: [[email protected] ~]# mysql -u root -p zabbix < images.sql Enter password: [[email protected] ~]# mysql -u root -p zabbix <data.sql Enter password: To configure and start Zabbix server [[email protected] ~]# vi /etc/zabbix/zabbix_server.conf # line 73:add DBHOST=localhost #line 107: add DB password for zabbix To start the zabbix server service start zabbix or /etc/init.d/zabbix-server start To start on boot menu chkconfig zabbix-server on Finally, To start zabbix agent to monitor zabbix server [[email protected] ~]# vi /etc/zabbix/zabbix_agentd.conf #line 85: specify zabbix server server=127.0.0.1 #line 126: specify zabbix server serveractive=127.0.0.1 #line 137: change to the own hostname Hostname=ns2.raj.com [[email protected] ~]# /etc/ini.d/zabbix-agent start Starting ZABBIX agent: [OK] To start at the boot [[email protected] ~]# chkconfig zabbix-agent on Furthermore, we have to make changes in httpd as shown belw: [[email protected] ~]# vi /etc/httpd/conf.d/zabbix.conf #line 11: change access permittion for Zabbix frontend Allow from localhost 192.168.10.0/24 #line 18: uncomment and change to your timezone php_value date.timezone Asia/Kathmandu Now Restart the web server [[email protected] ~]# /etc/init.d/httpd restart To verify you can go to http://your-zabbix-server-ip/zabbix