监控 zabbix安装篇
备注:本次安装使用的是Ubuntu OS
- 首先安装Apache、php、mysql,构建LAMP环境
sudo apt-get install apache2 安装完成末尾,有如下信息: * Starting web server apache2 AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message *
根据网上查找的结论:没有配置httpd.conf. 检查apahe2.conf文件发现(sudo vim /etc/apache2/apache2.conf) 根本没有httpad.conf的配置项,/etc/apache2/下也没有httpd.conf的文件,所以只好如下这样做:1、在/etc/apache2/下新建httpd.conf文件,内容为:ServerName 127.0.0.1 2、修改/etc/apache2/apache2.conf文件在 IncludeOptional mods-enabled/*.conf后边增加如下: # Include all the user configurations: Include /etc/apache2/httpd.conf
-
sudo /etc/init.d/apache2 restart
-
sudo apt-get install php5
-
sudo apt-get install libapache2-mod-php5
-
sudo apt-get install mysql-server(设置密码和重复密码:root)
-
sudo apt-get install libapache2-mod-auth-mysql
-
sudo apt-get install php5-mysql
-
sudo /etc/init.d/apache2 restart
-
sudo ls /etc/apache2/mods-enabled 看到php5.conf 和 php5.load说明OK
-
这里还需要配置下/etc/php5/apache2/php.ini
;date.timezone ===>去掉注释在=后添加 Asia/Shanghai max_input_time =600 max_execution_time= 600 post_max_size =32M
-
sudo /etc/init.d/apache2 restart
- ZABBIX安装
- sudo apt-get install zabbix-server-mysql
安装过程很安静,没有出现网上说的会输入2-3次数据库的密码, sudo /etc/init.d/zabbix-server start 会出现: * zabbix_server is disabled in /etc/default/zabbix-server. 查看相关文件:sudo vim /etc/default/zabbix-server #如下一段 # This is by default set to "no" because a MySQL database needs to be prepared # and configured before you can start the Zabbix server for the first time. # # Instructions on how to set up the database can be found in # /usr/share/doc/zabbix-server-mysql/README.Debian START=no 被设成no了,当然启动不了,改成yes
-
这还没完呢,因为数据库什么的没有设置
查看相关文件:cat /usr/share/doc/zabbix-server-mysql/README.Debian可以看到相关信息: -> apt-get install mysql-server Create a new database (let's call it "zabbix"): -> mysql -p -e "create database zabbix character set utf8" Create a MySQL user that has access rights to the database (please use another password than 'SECRETPASSWORD'): -> mysql -p -e "grant all on zabbix.* to 'zabbix'@'localhost' identified by 'SECRETPASSWORD'" Create the database schema: -> zcat /usr/share/zabbix-server-mysql/{schema,images,data}.sql.gz \ | mysql -uzabbix -pSECRETPASSWORD zabbix 我们照着做就好(不过我加上了用户名,因为我当前登录账户不是root,如果是的话就不用加上): mysql -uroot -p -e "create database zabbix character set utf8" mysql -uroot -p -e "grant all on zabbix.* to 'zabbix'@'localhost' identified by 'zabbix'" zcat /usr/share/zabbix-server-mysql/{schema,images,data}.sql.gz \ | mysql -uzabbix -pzabbix zabbix(等待一小会)
-
sudo /etc/init.d/zabbix-server start (成功!)
-
接着安装zabbix网站
sudo apt-get install zabbix-frontend-php 又是安静静的装完了,没有让输入什么root之类,于是,手动拷贝到apache目录下: sudo cp -r /usr/share/zabbix /var/www/html/zabbix 重启zabbix sudo /etc/init.d/zabbix-server stop sudo /etc/init.d/zabbix-server start
-
现在访问,终于可以出现设置界面了: http://服务器地址或域名/zabbix
-
第三步:Port 3306,password,user 都是root
-
不过安装到最后一步又出问题了,还算好,提供了下载,下载后ftp到服务器
-
下载之后把文件放到/etc/zabbix/目录下,刷新页面,OK
-
OK,终于可以了。登录用户名密码admin/zabbix
-
最后,安装zabbix客户端
sudo apt-get install zabbix-agent 安装客户端后,若不是服务器本机,都需要修改zabbix配置文件/etc/zabbix/zabbix_agent.conf和/etc/zabbix/zabbix_sagentd.conf的一行 server=zabbix服务端地址或域名
-
可能遇到的问题
解决方法: 1.在页面上设置“组态->主机”将主机设置为监控客户端的机器hostname。 2./etc/zabbix/zabbix_agent.conf 中的hostname与1中设置的一致。
-
最后,本帖子参考:http://blog.csdn.net/Yoara/article/details/41845473