基于web开源软件。php
zabbix会把回去的数据保存到数据库中,须要依赖数据库。
mysql
能够自动发现主机和网络设备。web
大多能够在web界面配置sql
一、安装zabbix数据库
平台:centos6.4 环境:LAMP 服务端ip:192.168.0.104 客户端ip:192.168.0.106vim
安装rpm包的LAMPcentos
[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、mysqlbash
[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:
二、网页安装zabbix
浏览器中访问http://192.168.0.104/zabbix
出现下面的问题,须要修改php配置文件。
根据提示进行修改相应的参数
[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 ]
数据库设置
下一步,进入登陆界面
登陆后若是遇到“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 ]
三、加入监控主机
在客户端上安装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界面配置
配置模板
四、自定义模板
//服务端 [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