设为首页 收藏本站
查看: 322|回复: 0

[经验分享] 安装Zabbix监控系统在Ubuntu上

[复制链接]
累计签到:1450 天
连续签到:1 天
发表于 2015-12-13 08:37:56 | 显示全部楼层 |阅读模式
1. 首先在操作系统下安装lamp环境,然后在执行如下步骤。
Edit apt source list to add the PPA:

sudo nano /etc/apt/sources.list
Add the following items at the end of the file:

# Zabbix Application PPA
deb http://ppa.launchpad.net/tbfr/zabbix/ubuntu precise main
deb-src http://ppa.launchpad.net/tbfr/zabbix/ubuntu precise main
Add the PPA's key so that apt-get trusts the source:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C407E17D5F76A32B
Set the server it's hostname

echo "zabbix.mydomain.com" > /etc/hostname
hostname -F /etc/hostname
Update /etc/hosts

27.0.0.1 localhost.localdomain localhost
52.28.99.149 zabbix.mydomain.com zabbix
Update and install Zabbix server and required packages.

sudo apt-get update
sudo apt-get install zabbix-server-mysql php5-mysql zabbix-frontend-php
Memorize the root password you have chosen, you'll need it later.
Next edit the Zabbix configuration.


sudo nano /etc/zabbix/zabbix_server.conf
Adjust the following values and make a note of the password you've chosen. You'll need it later too.

DBName=zabbix
DBUser=zabbix
DBPassword=your_chosen_password_here
Also memorize the chosen password because you will need it when setting the rights in the MySQL commands.
Unzip the mysql data for importing them into the database you'll create in the next step.

cd /usr/share/zabbix-server-mysql/
sudo gunzip *.gz
Login to MySql using the root password.

mysql -u root -p
Create a user for Zabbix (and a database) that matches the information we entered in the "/etc/zabbix/zabbix_server.conf" file.

create user 'zabbix'@'localhost' identified by 'your_chosen_password_here';
create database zabbix;
grant all privileges on zabbix.* to 'zabbix'@'localhost';
flush privileges;
exit;
Next we'll import the schemas into the newly created database.

mysql -u zabbix -p zabbix < schema.sql
mysql -u zabbix -p zabbix < images.sql
mysql -u zabbix -p zabbix < data.sql
Edit a few PHP settings by modifying the php.ini file.

sudo nano /etc/php5/apache2/php.ini
Search and adjust the following data. (Or add them if they can't be found.)
post_max_size = 16M
max_execution_time = 300
max_input_time = 300
date.timezone = "Europe/Amsterdam"

Next copy the example config to the /etc/zabbix directory. Then make the necessary adjustments too.

sudo cp /usr/share/doc/zabbix-frontend-php/examples/zabbix.conf.php.example /etc/zabbix/zabbix.conf.php
sudo nano /etc/zabbix/zabbix.conf.php
$DB['DATABASE'] = 'zabbix';
$DB['USER'] = 'zabbix';
$DB['PASSWORD'] = 'your_chosen_password_here'

Then copy the example apache config to the /etc/apache2/conf-available/ directory to make Zabbix and Apache work together.

sudo cp /usr/share/doc/zabbix-frontend-php/examples/apache.conf /etc/apache2/conf-available/zabbix.conf
sudo a2enconf zabbix.conf
sudo a2enmod alias
sudo service apache2 restart
sudo nano /etc/default/zabbix-server
Go to the bottom and adjust the "START" property to read "yes":
START=yes

And start the Zabbix server.

sudo service zabbix-server start
If you would like to have zabbix running on the root of the domain instead of /zabbix execute the following;

sudo nano /etc/apache2/sites-available/000-default.conf
And set the "DocumentRoot" like this;

DocumentRoot /usr/share/zabbix
Then restart Apache.
Installing Zabbix agent(s) on server machines.

sudo apt-get update
sudo apt-get install zabbix-agent
sudo nano /etc/zabbix/zabbix_agentd.conf
Look for: Server=localhost (or Server=127.0.0.1)
and change 'localhost' with the IP address of your Zabbix install.

Save and close the file and restart the agent software:

sudo service zabbix-agent restart
In your web browser, navigate to your Zabbix server's IP address followed by "/zabbix":
http://xx.xx.xx.xx/zabbix

Use the following default credentials to login.
Username = admin
Password = zabbix

When you have logged in, click on the "Configuration" button, and then "Hosts" in the top navigation bar.
Click on the name of the server (by default, this should be "Zabbix server"). This will open the host configuration page.
Adjust the Hostname to reflect the hostname of your Zabbix server (this should be the same hostname you entered in the agent configuration for the server machine).
At the bottom, change the "Status" property to "Monitored". Click save.

You will be dopped back to the Hosts configuration page. Re-click on the hostname again.
This time, click on the "Clone" button at the bottom of the page.
We will configure this to reflect the settings of the client machine. Change the hostname and the IP address to reflect the correct information from the client agent file.

In the "groups" section, select "Zabbix servers" and click the right arrow icon to remove that group. Select the "Linux servers" and click the left arrow icon to add that group setting.
Click "Save" at the bottom.
After a few minutes, you should be able to see both computers by going to "Monitoring" and then clicking on "Latest data".
There should be information for both the server and client machines populating.

If you click on the arrows next to an item, you can see the collected information.
If you click "Graph" you will see a graphical representation of the data points that have been collected:

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-150327-1-1.html 上篇帖子: 图解Ubuntu Server 14.04安装 下篇帖子: 安装lamp环境在Ubuntu上
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表