CentOS6配置部署Zabbix監控

硬件配置

  • 2cpu, 4Gmem, 40Gdisk
  • Zabbix Server: 200.21.101.14/centos651
  • Zabbix Client: 200.21.101.15/centos652

禁用selinux,改完配置重啓系統生效

sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config

添加zabbix軟件源

rpm -ivh http://repo.zabbix.com/zabbix/2.4/rhel/6/x86_64/zabbix-release-2.4-1.el6.noarch.rpmphp

ZabbixServer端安裝配置

軟件安裝

yum install zabbix-get zabbix-server zabbix-server-mysql zabbix-web-mysql mysql-server -ymysql

初始化數據庫

開啓數據庫服務
service mysqld start
chkconfig mysqld on

初始化數據庫設置
mysql_secure_installation

配置數據庫

> create database zabbix character set utf8 collate utf8_bin;
> grant all privileges on zabbix.* to zabbix[@localhost](http://my.oschina.net/u/570656) identified by 'zabbix_password';
> flush privileges;
> exit

導入zabbix的表結構和數據

cd /usr/share/doc/zabbix-server-mysql-2.4.8/create
mysql -uzabbix -pzabbix_password zabbix < schema.sql
mysql -uzabbix -pzabbix_password zabbix < images.sql
mysql -uzabbix -pzabbix_password zabbix < data.sql

配置WEB界面的設置

編輯/etc/zabbix/web/zabbix.conf.phplinux

<?php
// Zabbix GUI configuration file.
global $DB;

$DB["TYPE"]    	            = 'MYSQL';
$DB["SERVER"]		    = 'localhost';
$DB["PORT"]		    = '0';
$DB["DATABASE"]		    = 'zabbix';
$DB["USER"]		    = 'zabbix';
$DB["PASSWORD"]		    = 'zabbix_password';
// Schema name. Used for IBM DB2 and PostgreSQL.
$DB["SCHEMA"]		    = '';

$ZBX_SERVER		    = 'localhost';
$ZBX_SERVER_PORT	    = '10051';
$ZBX_SERVER_NAME	    = 'Zabbix Server';

$IMAGE_FORMAT_DEFAULT	= IMAGE_FORMAT_PNG;
?>

配置zabbix_server.conf文件

DBHost = localhost
DBName = zabbix
DBUser = zabbix
DBPassword = zabbix_password

開啓zabbix server服務

service zabbix-server start
chkconfig zabbix-server on

修改時區

sed -i "s/#\ php_value date.timezone\ Europe\/Riga/php_value date.timezone\ Asia\/Shanghai/g" /etc/httpd/conf.d/zabbix.conf

修改httpd配置

sed -i "s/#ServerName www.example.com:80/ServerName 200.21.101.114/g" /etc/httpd/conf/httpd.conf
service httpd start
chkconfig httpd on

登陸http://IP/zabbix 默認用戶名密碼Admin/zabbix

ZabbixLogin

Zabbix Client配置

軟件安裝

yum install zabbix-agent -y

修改客戶端配置文件

sed -i "s/Server=127.0.0.1/Server=200.21.101.114/g" /etc/zabbix/zabbix_agentd.conf
sed -i "s/ServerActive=127.0.0.1/ServerActive=200.21.101.114/g" /etc/zabbix/zabbix_agentd.conf
sed -i "s/Hostname='Zabbix Server'/Hostname='centos651'/g" /etc/zabbix/zabbix_agentd.conf

service zabbix-agent restart
chkconfig zabbix-agent on
相關文章
相關標籤/搜索