CentOS 6.8搭建zabbix平台
CentOS 6.8搭建zabbix平台:安装httpd:
yum install httpd
安装mysql:
yum install mysql-server
service mysqld start
mysql -u root
use mysql;
update user set password=password('xxxxx') where user='root';
flush privileges;
exit
mysql -u root -p'xxxx'
create database zabbix character set utf8 collate utf8_bin;
grant all on zabbix.* to zabbix@'localhost' identified by 'xxxx';
exit
安装php5.6(要求php5.6以上):
rpm -Uvh http://ftp.iij.ad.jp/pub/linux/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
yum install --enablerepo=remi --enablerepo=remi-php56 phpphp-mysql php-bcmath php-mbstring php-gd php-xml
安装zabbix:
useradd zabbix
rpm -Uvh https://repo.zabbix.com/zabbix/4.0/rhel/6/x86_64/zabbix-release-4.0-1.el6.noarch.rpm
yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent
zcat /usr/share/doc/zabbix-server-mysql-4.0.4/create.sql.gz| mysql -u zabbix -p'xxxxx' zabbix
vi /etc/zabbix/zabbix_server.conf
DBPassword=xxxxx (默认为注释掉的)
:wq
cp -rv /usr/share/doc/zabbix-web-4.0.4/httpd22-example.conf/etc/httpd/conf.d/zabbix.conf
vi /etc/httpd/conf.d/zabbix.conf
php_value date.timezone Asia/Shanghai (默认为注释掉的)
:wq
service httpd restart
/etc/init.d/zabbix-server restart (一定要disabled掉selinux,不然服务会起不来)
/etc/init.d/zabbix-agent restart
chkconfig --level 35 httpd on
chkconfig --level 35 zabbix-server on
chkconfig --level 35 zabbix-agent on
浏览器访问:http://ip/zabbix(配置略,比较简单),初始账号为:Admin(A为大写),密码:zabbix
zabbix添加服务器:
安装agent略(下载zabbix-agent软件,并设置/etc/zabbix/zabbix_agentd.conf里的server ip,重启zabbix-agent服务)
浏览器打开zabbix页面——Configuration——Hosts——Create host——写下Host name和IP address,Groups选择Linux servers(也可自己新建个group)——add——Templates——选择Template OS Linux(模板可自创建及自定义监控项)——add
安装grafana略(初始账号密码均为admin)
安装grafana-zabbix插件:
grafana-cli plugins install alexanderzobnin-zabbix-app
service grafana-server restart
http://ip:3000配置——plugins——zabbix——enable
data source——zabbix——HTTP URL:http://ip/zabbix/api_jsonrpc.phpAccess: Server——Zabbix API details Username:Admin Password:xxxxx——Save & Test
页:
[1]