zabbix安裝
配置系統
1、調整系統時間
ntpdate ntp1.aliyun.com
2、調整系統時區
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
3、關閉selinux
不關閉seliunx會出現權限問題,建議關閉
setenforce 0
vim /etc/selinux/config
SELINUX=disabled
安裝步驟
1、安裝zabbix的yum源
rpm -i http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
2、安裝zabbix
yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent
3、安裝mariadb數據庫,並且啓動
yum install -y mariadb-server
systemctl start mariadb.service
剛剛安裝的root賬號沒有密碼,需要自行修改和管理賬號
4、初始化zabbix數據庫和創建訪問賬號
mysql -uroot -p
password
create database zabbix character set utf8 collate utf8_bin;
grant all privileges on zabbix.* to zabbix@localhost identified by 'password';
5、將zabbix的sql文件導入到數據庫中
zcat /usr/share/doc/zabbix-server-mysql-3.0.14/create.sql.gz | mysql -uzabbix -p zabbix
6、配置zabbix server連接數據庫
vim /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
7、配置zabbix時區
vim /etc/httpd/conf.d/zabbix.conf
在<IfModule mod_php5.c>中添加
php_value date.timezone Asia/Shanghai
或者使用sed命令
sed -i.ori '18a php_value date.timezone Asia/Shanghai' /etc/httpd/conf.d/zabbix.conf
8、啓動zabbix server服務
systemctl start zabbix-server
systemctl start httpd
9、寫入開機啓動
chmod +x /etc/rc.d/rc.local
cat >>/etc/rc.d/rc.local<<EOF
systemctl start mariadb.service
systemctl start httpd
systemctl start zabbix-server
EOF
10、輸出訪問
echo "瀏覽器訪問 http://`hostname -I|awk '{print $1}'`/zabbix"
11、中文亂碼解決
yum -y install wqy-microhei-fonts
\cp /usr/share/fonts/wqy-microhei/wqy-microhei.ttc /usr/share/fonts/dejavu/DejaVuSans.ttf
12、防火牆處理
如果系統開啓了防火牆需要打開相應的端口
80端口開放:
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --reload
13、zabbix web 安裝
13.1、打開瀏覽器輸入 http://ip/zabbix
13.2、下一步進行檢測信息,看具體報錯進行相應解決
13.3、下一步,配置數據庫
13.4、配置zabbix server,name 自定義
13.5、信息確定
13.6、配置完成
13.7、登錄,賬號/密碼:Admin/zabbix
客戶端安裝
1、安裝zabbix yum源
rpm -i http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
2、安裝客戶端agent
yum install zabbix-agent -y
3、配置agent配置
4、啓動服務
systemctl start zabbix-agent.service
5、設置爲開機啓動
chmod +x /etc/rc.d/rc.local
cat >>/etc/rc.d/rc.local<<EOF
systemctl start zabbix-agent.service
EOF
檢測連通性工具
注意:只能在服務端進行測試
1、安裝檢測工具
yum install zabbix-get
2、在服務端進行測試
測試本地服務的agent連接
zabbix_get -s 127.0.0.1 -p 10050 -k "system.cpu.load[all,avg1]"