zabbix监控配置

基于web开源软件。

zabbix会把回去的数据保存到数据库中,需要依赖数据库。

可以自动发现主机和网络设备。

大多可以在web界面配置

1、安装zabbix

平台:centos6.4    环境:LAMP   服务端ip:192.168.0.104  客户端ip:192.168.0.106

安装rpm包的LAMP

[root@localhost ~]# yum install -y  httpd mysql mysql-libs php php-mysql mysql-server php-bcmath php-gd php-mbstring

安装zabbix软件

[root@localhost ~]# yum install -y zabbix20 zabbix20-agent zabbix20-server  zabbix20-server-mysql zabbix20-web zabbix20-web-mysql net-snmp-devel

启动zabbix、http、mysql

[root@localhost ~]# /etc/init.d/zabbix-server start; /etc/init.d/zabbix-agent start
Starting Zabbix server:                                    [  OK  ]
Starting Zabbix agent:                                     [  OK  ]
[root@localhost ~]# /etc/init.d/httpd start
Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain for ServerName
                                                           [  OK  ]
[root@localhost ~]# /etc/init.d/mysqld start
Starting MySQL SUCCESS!

创建zabbix库

[root@localhost ~]# mysql -uroot -p123456 -e "create database zabbix"
//数据导入zabbix库
[root@localhost ~]# mysql -uroot -p --default-character-set=utf8 zabbix < /usr/share/zabbix-mysql/schema.sql
Enter password:
[root@localhost ~]# mysql -uroot -p --default-character-set=utf8 zabbix < /usr/share/zabbix-mysql/p_w_picpaths.sql
Enter password:
[root@localhost ~]# mysql -uroot --default-character-set=utf8 -p zabbix < /usr/share/zabbix-mysql/data.sql
Enter password:

2、网页安装zabbix

浏览器中访问http://192.168.0.104/zabbix

出现下面的问题,需要修改php配置文件。

wKioL1NbBKSzL0wvAAKrRgfOVJU997.jpg

根据提示进行修改相应的参数

[root@localhost ~]# vim /etc/php.ini
post_max_size = 16M
max_execution_time = 300
max_input_time = 300
date.timezone = "Asia/Shanghai"
[root@localhost ~]# /etc/init.d/httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain for ServerName
                                                           [  OK  ]

数据库设置

wKioL1NbCLPR8VgPAAKZYjQMA94210.jpg服务主机信息

wKioL1NbCSfxQavPAAICIMFT45g988.jpg

下一步,进入登录界面

wKioL1NbCbKikn0cAAE8KcFarUw916.jpg

登录后如果遇到“zabbix server is not running”这样的错误,需要修改/etc/zabbix/zabbix_server.conf文件

[root@localhost ~]# vim /etc/zabbix/zabbix_server.conf
DBHost=127.0.0.1
DBUser=root
DBPassword=123456
[root@localhost ~]# /etc/init.d/zabbix-server restart
Shutting down Zabbix server:                               [  OK  ]
Starting Zabbix server:                                    [  OK  ]

3、加入监控主机

在客户端上安装zabbix客户端

[root@localhost ~]# rpm -ivh http://www.lishiming.net/data/p_w_upload/forum/month_1211/epel-release-6-7.noarch.rpm
[root@client ~]# yum install zabbix20-agent
[root@client ~]#vim /etc/zabbix_agentd.conf
Server=192.168.0.104
ServerActive=192.168.0.104:10050
 Hostname=aming//自定义,但要唯一
[root@client ~]#/etc/init.d/zabbix-agent start

服务端测试

[root@localhost ~]# zabbix_get -s 192.168.0.106 -p 10050 -k "system.hostname"
client

web界面配置

wKiom1NbIgvhyOhEAAOILMl5-tg220.jpg

wKioL1NbImewyr01AALiJtCE1pM376.jpg

配置模板

wKiom1NbIt-wj04vAAOaZHE6Z7w438.jpg

4、自定义模板

wKiom1NbKUTwHAxJAAMVqHBy3IY435.jpg添加项目,根据需求自由选择

wKioL1NbKnyR6ueRAACYeT-KwMk221.jpg

wKiom1NbKqfTuT7NAAU8mlxB7P4990.jpg

wKioL1NbKn6BgEltAAKWT6_D5bE789.jpg5、配置发邮件

//服务端
[root@localhost ~]# yum install -y sendmail ; mkdir -p /home/zabbix/bin
[root@localhost ~]# vim /home/zabbix/bin/baojing.sh
#! /bin/bash
echo "$3" |/bin/mail -s "$2" $1
[root@localhost ~]# chmod +x /home/zabbix/bin/baojing.sh

wKioL1NbLkng9GwJAAKF4yRq6n4208.jpgwKiom1NbMGmhylWAAAHfeeHUxVI533.jpgwKioL1NbMEyQ2SeoAAG4TgHvjrc006.jpgwKiom1NbMIKTKD0IAALf_v6naK4121.jpgwKioL1NbMGXzebrrAAL6NMiI45w528.jpgwKioL1NbMKiCgyIRAAKWivvENo8241.jpg





























發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章