首页 > 代码库 > zabbix

zabbix

环境   centos5.11 64位

一、安装

  1. 安装httpd  mysql-server

    #yum install -y mysql-server mysql mysql-devel httpd

    

2.安装zabbix

参考 https://www.zabbix.com/documentation/2.2/manual/installation/install_from_packages

  #rpm -ivh http://repo.zabbix.com/zabbix/2.2/rhel/5/x86_64/zabbix-release-2.2-1.el5.noarch.rpm

  #yum install php53-xml php53-mbstring php53-gd php53-common php53-cli php53-bcmath php53 php53-mysql php53-pdo

  #yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent

      ---如果提示php冲突,需要把php其它版本删除,并移除本机#mv atomic.repo ~/

3.配置

  #service mysqld start

  #/usr/bin/mysql_secure_installation

  #cat /etc/my.cnf

  

[mysqld]

# paths

datadir=/var/lib/mysql

socket=/var/lib/mysql/mysql.sock

user=mysql

# Default to using old password format for compatibility with mysql 3.x

# clients (those using the mysqlclient10 compatibility package).

old_passwords=1


# Disabling symbolic-links is recommended to prevent assorted security risks;

# to do so, uncomment this line:

# symbolic-links=0


# network

connect_timeout = 60

wait_timeout = 28800

max_connections = 2048

max_allowed_packet = 64M

max_connect_errors = 1000


# limits

tmp_table_size = 128M

max_heap_table_size = 64M

table_cache = 128


# logs

log-error = /var/log/mysql/mysql-error.log

log_slow_queries = /var/log/mysql-slow.log

#slow-query-log = 1

#long-query-time = 20


default-character-set = utf8

[mysqld_safe]

#log-error=/var/log/mysqld.log

pid-file=/var/run/mysqld/mysqld.pid

[client]

default-character-set = utf8

  

  #service mysqld restart

  #cd /usr/share/doc/zabbix-server-mysql-2.2.7/create/

  #mysql -uroot -p

mysql>create database zabbix character set utf8 collate utf8_bin;

mysql>grant all privileges on zabbix.* to zabbix@localhost identified by ‘zabbix‘;

mysql>flush privileges;

mysql>exit

  #mysql -uroot -p zabbix < schema.sql

  #mysql -uroot -p zabbix < images.sql

  #mysql -uroot -p zabbix < data.sql

 #egrep -v ‘^#|^$‘  /etc/zabbix/zabbix_server.conf  ---主要修改数据库连接参数

LogFile=/var/log/zabbix/zabbix_server.log

LogFileSize=0

PidFile=/var/run/zabbix/zabbix_server.pid

DBHost=localhost

DBName=zabbix

DBUser=zab_user

DBPassword=zab_pass                      

DBSocket=/var/lib/mysql/mysql.sock

SNMPTrapperFile=/var/log/snmptt/snmptt.log

AlertScriptsPath=/usr/lib/zabbix/alertscripts

ExternalScripts=/usr/lib/zabbix/externalscripts

  #vi /etc/httpd/conf.d/zabbix.conf   --主要修改timezone    

    php_value max_execution_time 300

    php_value memory_limit 128M

    php_value post_max_size 16M

    php_value upload_max_filesize 2M

    php_value max_input_time 300

    php_value date.timezone Asia/Shanghai

 #service httpd restart

  #chkconfig mysqld on

  #chkconfig httpd on

  #chkconfig zabbix-server on

  #chkconfig zabbix-agent on


  通过浏览器   http://IP/zabbix   配置


3.agent配置

  主要修改Server  ServerActive/serverIP   Hostname/本机主机名 三个参数 

  #service zabbix-agent start


二.Discovery 

   Discovery网络设备:

 

  1.configuration -- discovery -- Create discovery rule 

   wKioL1SQ9JjAU5TBAAFXrgHWUic229.jpg

  2.configuration -- Actions -- Event source "Discovery" --Create action

    wKiom1SQ9QnAGX5WAAEWyfqy0Oc487.jpg

  wKioL1SQ9ijj1OdwAAEUQXYsigY938.jpg

 --host group 与 templates 可以之前创建好


 Discovery linux_server:

 wKioL1SQ-gThuA1YAAEwlKjdG4A426.jpg

 wKiom1SQ-gWgusDIAAEwlKjdG4A031.jpg

wKiom1SQ-kTgZ-xBAAHqN4vWoHw981.jpg

wKioL1SQ-wWQU7hcAAD2R-xGcdU603.jpg


本文出自 “石头记” 博客,请务必保留此出处http://dodowolf.blog.51cto.com/793581/1590942

zabbix