您的位置:首页 > 运维架构

安装使用zabbix监控主机

2017-06-11 21:10 337 查看

安装zabbix

1. 安装zabbix

rpm -ivh http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm

2. 安装mysql

yum install -y mysql-server mysql mysql-devel

3. 用上面的命令默认会安装mariadb,现在卸载,重新安装mysql

yum remove  mariadb*
wget http://repo.mysql.com//mysql57-community-release-el7-7.noarch.rpm yum localinstallmysql57-community-release-el7-7.noarch.rpm
yum install mysql-community-server

4. 启动mysql,设置root密码

systemctl enable mysqld
systemctl start mysqld
vim /etc/my.cnf
在其中添加
skip-grant-tables=1
systemctl restart mysqld
cat /var/log/mysqld.log |grep password
mysql -uroot -p
输入临时密码
oKdIrsD,/1BY
use mysql;
update user set authentication_string = password('root'),password_expired = 'N', password_last_changed = now() where user = 'root';
exit;
vim /etc/my.cnf
在其中删除
skip-grant-tables=1
systemctl restart mysqld

5. 安装zabbix-mysql和web界面

yum install zabbix-server-mysql zabbix-web-mysql

6. 初始化数据

mysql -uroot -proot
create database zabbix character set utf8 collate utf8_bin;
grant all privileges on zabbix.* to zabbix@localhost identified by 'Wms123!@#';
FLUSH   PRIVILEGES;
quit;
zcat /usr/share/doc/zabbix-server-mysql-3.2.*/create.sql.gz>create.sql
vim create.sql
在开头加上use zabbix;
cat create.sql | mysql -uzabbix -p

7. 编辑zabbix配置文件,设置数据信息

vim /etc/zabbix/zabbix_server.conf
加入
LogFile=/var/log/zabbix/zabbix_server.log
LogFileSize=0
PidFile=/run/zabbix/zabbix_server.pid
DBHost=127.0.0.1
DBName=zabbix
DBUser=zabbix
DBPassword=Wms123!@#
DBSocket=/var/lib/mysql/mysql.sock
StartPollers=5
StartIPMIPollers=10
StartPollersUnreachable=10
StartTrappers=10
StartPingers=10
StartDiscoverers=10
VMwareFrequency=60
VMwareCacheSize=8M
SNMPTrapperFile=/var/log/snmptt/snmptt.log
ListenIP=127.0.0.1
MaxHousekeeperDelete=500
CacheSize=256M
StartDBSyncers=40
TrendCacheSize=128M
ValueCacheSize=128M
Timeout=30
TrapperTimeout=300
UnreachablePeriod=45
UnavailableDelay=60
UnreachableDelay=15
AlertScriptsPath=/etc/zabbix/alertscripts
ExternalScripts=/etc/zabbix/externalscripts
FpingLocation=/usr/sbin/fping
LogSlowQueries=10000
StartProxyPollers=50
ProxyConfigFrequency=3600

8. 启动zabbix-server

关闭selinux

setenforce 0

启动server

systemctl start zabbix-server
systemctl enable zabbix-server

9. 安装php前端

cp -r /usr/share/zabbox /var/www/html/

在浏览器访问
http://192.168.2.142/zabbix
出现报错
Time zone for PHP is not set (configuration parameter "date.timezone").

vim /etc/httpd/conf.d/zabbix.conf

去掉# php_value date.timezone Europe/Riga的注释
修改为
php_value date.timezone Asia/ShangHai

刷新页面出现













内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  linux zabbix