zabbix 源码安装
来源:互联网 发布:淘宝期刊 编辑:程序博客网 时间:2024/05/16 13:00
第二种:源码安装
zabbix-Server:
1、安装开发软件包
yum -y groupinstall "Development Tools"
2、安装所需的依赖包
yum -y install httpd php php-mysql php-common php-mbstring php-gd php-odbc php-pear curl curl-devel net-snmp net-snmp-devel perl-DBI php-xml ntpdate php-bcmath
3、同步时间
ntpdate -d cn.pool.ntp.org
4、创建用户名跟用户组
groupadd -g 201 zabbix
useradd -g zabbix -u 201 -m zabbix
5.创建zabbix 数据库
mysqladmin -uroot password admin
mysql -uroot -padmin -e "create database zabbix character set utf8;"
mysql -uroot -padmin -e "grant all privileges on zabbix.* to 'zabbix'@'%' identified by 'zabbix';"
mysql -uroot -padmin -e "flush privileges;"
注:此处数据库的字符集必须为utf8,不然中文显示web界面会出现乱码
6.解压zabbix : tar zxf zabbix-2.2.2.tar.gz
7.导入zabbix-server 的数据库(创建zabbix 用户)
mysql -uzabbix -pzabbix zabbix < ./zabbix-2.2.2/database/mysql/schema.sql;
如果安装zabbix-proxy,下面的sql 不用导入
mysql -uzabbix -pzabbix zabbix < ./zabbix-2.2.2/database/mysql/images.sql;
mysql -uzabbix -pzabbix zabbix < ./zabbix-2.2.2/database/mysql/data.sql;
8.编译安装zabbix
cd zabbix-2.2.2
./configure --sysconfdir=/etc/zabbix/ --enable-server--enable-agent --enable-mbstring --with-net-snmp --with-libcurl --with-mysql --with-gd --enable-java
make && make install
9.复制启动脚本,修改执行权限
cp misc/init.d/tru64/zabbix_agentd /etc/init.d/
cp misc/init.d/tru64/zabbix_server /etc/init.d/
chmod +x /etc/init.d/zabbix_*
10.拷贝zabbix 前端代码
mkdir /var/www/html/zabbix
cp -a zabbix-2.2.2/frontends/php/* /var/www/html/zabbix/
chown -R apache.apache /var/www/html/zabbix/
11.配置php文件,适应zabbix安装所需的参数
vim /etc/php.ini
date.timezone = Asia/Shanghai
max_execution_time = 300
max_input_time = 300
post_max_size = 32M
memory_limit = 128M
mbstring.func_overload = 2
12.配置apache文件,定义安装访问zabbix的虚拟主机
vim /etc/httpd/conf/httpd.conf
ServerName 127.0.0.1
<VirtualHost *:80>
DocumentRoot "/var/www/html"
ServerName 192.168.239.130
</VirtualHost>
13.配置zabbix server端的文件,定义数据库的IP、用户名、密码
vim /etc/zabbix/zabbix_server.conf
DBHost=127.0.0.1(192.168.32.83设置mysql用户的host值为%)
DBName= zabbix
DBUser=zabbixuser
DBPassword=zabbixpass
DBPort=3306
StartPollers=30 #开启多线程数,一般不要超过30个
StartTrappers=20 #trapper线程数
StartPingers=10 #fping线程数
StartDiscoverers=120
MaxHousekeeperDelete=5000
CacheSize=1024M #用来保存监控数据的缓存数,根据监控主机的数量适当调整
StartDBSyncers=8 #数据库同步时间
HistoryCacheSize=1024M
TrendCacheSize=128M #总趋势缓存大小
HistoryTextCacheSize=512M
AlertScriptsPath=/etc/zabbix/alertscripts
LogSlowQueries=1000
Include=/etc/zabbix/zabbix_server.conf.d/
14.ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib64/
15.启动apache服务跟zabbix服务
/etc/init.d/httpd start
/etc/init.d/zabbix_server start
16.http://192.168.32.83/zabbix/setup.php
zabbix-Agent:
1、安装开发软件包
yum -y groupinstall "Development Tools"
yum -y install ntpdate
2、同步时间
ntpdate -d cn.pool.ntp.org
3、创建用户名跟用户组
groupadd -g 201 zabbix
useradd -g zabbix -u 201 -m zabbix
4.tar zxf zabbix zabbix-2.2.2.tar.gz
cd zabbix-2.2.2
./configure --sysconfdir=/etc/zabbix --enable-agent --enable-java
make install
5.复制启动脚本,修改执行权限
cp misc/init.d/tru64/zabbix_agentd /etc/init.d/
chmod +x /etc/init.d/zabbix_*
6.配置agent端配置文件
vim /etc/zabbix/zabbix_agentd.conf #此处千万别写成了zabbix_agent.conf,否则配置了不生效
Server=192.168.33.220 #填写Server的IP地址
ServerActive=192.168.33.220 #修改为Server的IP地址
Hostname=Centos-03 #填写本机的HostName,注意Server端要能解析
UnsafeUserParameters=1 #是否允许自定义的key,1为允许,0为不允许
Include= /etc/zabbix/zabbix_agentd.conf.d/#自定义的agentd配置文件(key)可以在这里面写;
7、启动zabbixagent端
/etc/init.d/zabbix_agentd start
expect脚本
同步文件:
#!/usr/bin/expect
set passwd 1234567
set host [lindex $argv 0]
set file "/root/shell/expect/buildzabbix_agent.sh"
spawn scp $file root@$host:/root/
expect {
"yes/no" {
send "yes\r"
expect "password:" {send "$passwd\r"}
}
"password:" {send "$passwd\r"}
}
expect eof
执行脚本:
#!/usr/bin/expect
set timeout -1
set passwd "1234567"
set host [lindex $argv 0]
spawn ssh root@$host
expect {
"yes/no" {
send "yes\r"
expect "password:" {send "$passwd\r"}
}
"password:" {send "$passwd\r"}
}
expect "root#"
send "sh /root/buildzabbix_agent.sh\r"
expect "root#"
send "exit\r"
PS:Zabbix_Agent自动安装脚本
yum -y groupinstall "Development Tools"
yum -y install ntpdate
ntpdate -d cn.pool.ntp.org
groupadd -g 201 zabbix
useradd -g zabbix -u 201 -m zabbix
cd /usr/src
ftp -n<<!
open 192.168.32.101 1029
user install kjk7787czcb
pass
bin
get zabbix-2.2.2.tar.gz
get zabbix.conf
bye
exit
!
tar zxvf zabbix-2.2.2.tar.gz
cd zabbix-2.2.2
./configure -sysconfdir=/etc/zabbix -enable-agent
make && make install
cp misc/init.d/tru64/zabbix_agentd /etc/init.d/
chmod +x /etc/init.d/zabbix_agentd
hostname=`hostname`
cd /usr/src
sed -i "s/XX/$hostname/" zabbix.conf
cat zabbix.conf>>/etc/zabbix/zabbix_agentd.conf
sed -i "s/Server=127.0.0.1//" /etc/zabbix/zabbix_agentd.conf
sed -i "s/ServerActive=127.0.0.1//" /etc/zabbix/zabbix_agentd.conf
/etc/init.d/zabbix_agentd start
0 0
- zabbix 3.0 源码安装
- 源码编译安装zabbix
- Zabbix Server源码安装
- Zabbix Agentd源码安装
- zabbix源码安装
- zabbix 源码安装
- zabbix源码安装配置
- Zabbix-3.0源码安装配置
- CentOS 7源码安装zabbix
- Zabbix Agent 源码编译安装
- 源码安装zabbix LNMP源码安装
- zabbix 分布式安装源码安装 ubuntu14.04
- zabbix源码安装时报错:MySQL library not found---zabbix
- zabbix 2.03 源码编译及安装配置
- zabbix 分布式监控(proxy)源码安装
- Grafana-zabbix源码安装简要说明
- 源码方式安装Zabbix-2.4.5
- zabbix安装
- getpwnam函数学习
- Java 线程的创建
- 正则表达式,分组匹配示例
- 关于Mip Maps的一道选择题
- 每天读一遍,坚持27天,你的英语水平就能够到达跟美国人交换的水平啦!
- zabbix 源码安装
- AndroidStudio添加so文件
- 一道面试题引发的对android中context的研究(三)-各种Context在ActivityThread中实例化过程源码分析
- Java语言基础
- Linux配置别名
- Harris角点检测算法 1
- HTML <link> 标签的 rel 属性
- PowerDesigner palette 工具栏不见了,怎么找回
- 数据结构_5:字符串:C语言