zabbix 2.2.2在centos 6.3 x86_64上的安装
zabbix 2.2.2在centos 6.3 x86_64上的安装
tar xzf zabbix-2.2.2.tar.gz
cd zabbix-2.2.2
# 增加用户和组.
groupadd zabbix
useradd -g zabbix zabbix
# 将初始数据导入mysql中
#
# 安装mysql server
yum install mysql-server
# 执行zabbix_server带的数据库脚本(非zabbix proxy)
shell> mysql -uroot -p
mysql> create database zabbix character set utf8;
mysql> grant all on zabbix.* to zabbixuser@localhost identified by 'db2203';
mysql> flush privileges;
mysql> quit
shell> mysql -uroot -p zabbix < database/mysql/schema.sql
# stop here if you are creating database for Zabbix proxy
shell> mysql -uroot -p zabbix < database/mysql/images.sql
shell> mysql -uroot -p zabbix < database/mysql/data.sql
# 安装zabbix server程序
#
# 安装依赖库
./configure --prefix=/opt/zabbix --enable-server --enable-agent --with-mysql --disable-ipv6 --with-net-snmp --with-libcurl
make install
#报错自行解决
# 编译zabbix client(非必须),官网有2.0.6的多个os的agent
./configure --enable-agent --enable-static --prefix=/opt/zabbix
#
# 安装zabbix server的其他设置
#
# 创建zabbix server的日志目录
mkdir -p /opt/log/zabbix/
chown zabbix:zabbix /opt/log/zabbix
# 创建pid文件存放目录
# 修改服务端配置文件/opt/zabbix/etc/zabbix_server.conf
#
# 启动zabbix server
/opt/zabbix/sbin/zabbix_server: error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory
ldconfig
#
# 在zabbix server上安装nginx+php
#
# 安装apache prefork版,较稳定(用nginx代替)
#apt-get install apache2-mpm-prefork
# 安装php
yum install php php-gd php-gmp php-mysql php-fpm.x86_64 php-bcmath.x86_64 php-xml.x86_64 php-mbstring.x86_64 php-pecl-apc(php加速模块apc)
server {
listen 60080;
server_name localhost;
#charset koi8-r;
#access_log /var/log/nginx/log/host.access.log main;
access_log /dev/null main;
error_log /dev/null;
location / {
root /opt/website/zabbix;
index index.html index.htm index.php;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /opt/website/zabbix$fastcgi_script_name;
include fastcgi_params;
}
}
# 并且在/etc/nginx/conf.d中将default.conf改名
mv /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf.old
# 修改/etc/nginx/fastcgi_params,将SERVER_SOFTWARE改成如下,去掉nginx版本号显示
#fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param SERVER_SOFTWARE nginx;
# 备份nginx.conf 并修改/etc/nginx/nginx.conf的内容:
user nginx;
worker_processes 1;
#error_log /var/log/nginx/error.log warn;
error_log /dev/null;
pid /var/run/nginx.pid;
events {
worker_connections 2048;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
gzip on;
server_tokens off;
include /etc/nginx/conf.d/*.conf;
}
post_max_size = 16M
max_execution_time = 300
max_input_time = 300
time zone=Asia/Shanghai (如果没有,则修改date.timezone =Asia/Shanghai)
; php apc module
extension=apc.so
apc.enabled = 1
apc.cache_by_default = on
apc.shm_segments = 1
apc.shm_size = 128
apc.ttl = 7200
apc.user_ttl = 7200
apc.num_files_hint = 1024
apc.write_lock = On
apc.gc_ttl=3600
apc.ttl=0
#启动nginx
service nginx start
#启动php-fpm
service php-fpm start
#报错自行解决
# 将zabbix站点文件放到/opt/website/zabbix/下
mkdir -p /opt/website/zabbix
cp -rf frontends/php/* /opt/website/zabbix/
# 首次访问,以执行zabbix自安装程序
在浏览器中输入:http://ip地址:60080/,这将启动zabbix安装程序,按照它的提示解决问题。
默认用户 : Admin zabbix
最后,如果出现如下错误:
Configuration file
"/opt/website/zabbix/conf/zabbix.conf.php"
created: Fail
需要临时给与/opt/website/zabbix/conf/这个目录以写权限:
chmod 777 /opt/website/zabbix/conf/
然后重试成功后再去掉写权限:chmod go-w /opt/website/zabbix/conf
#修改/opt/zabbix/etc/zabbix_agentd.conf中的两个参数,其他使用默认
Server:修改为zabbix服务器的IP地址
Hostname:修改为本机的机器名
#启动zabbix客户端
/opt/zabbix/sbin/zabbix_agentd
启动报错如:/opt/zabbix/sbin/zabbix_agentd: error while loading shared libraries: libiconv.so.2: cannot open shared object file: No such file or directory
执行
#echo '/usr/local/lib' >> /etc/ld.so.conf;ldconfig
检查端口是否启动成功
#netstat -an | grep 10050
在服务器端测试连接
/opt/zabbix/bin/zabbix_get -s 113.31.17.239 -k "agent.version"
/opt/zabbix/bin/zabbix_get -s 113.31.17.239 -k "system.uptime"
/opt/zabbix/bin/zabbix_get -s 113.31.17.239 -k "net.if.in[eth0]"
返回2.2.2之类的,说明客户端已成功启动
#自启动脚本
vi /etc/rc.d/init.d/zabbix_agentd
chmod +x /etc/rc.d/init.d/zabbix_agentd
写入以下内容
#!/bin/bash
#
# chkconfig: - 55 45
# description: zabbix_agentd
# probe: false
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up. If you are running without a network, comment this out.
[ "${NETWORKING}" = "no" ] && exit 0
RETVAL=0
progdir="/opt/zabbix/sbin/"
prog="zabbix_agentd"
start() {
# Start daemons.
if [ -n "`/sbin/pidof $prog`" ]; then
echo -n "$prog: already running"
failure $"$prog start"
echo
return 1
fi
echo -n $"Starting $prog: "
# we can't seem to use daemon here - emulate its functionality
su -c $progdir$prog - $USER
RETVAL=$?
usleep 100000
if [ -z "`/sbin/pidof $progdir$prog`" ]; then
# The child processes have died after fork()ing, e.g.
# because of a broken config file
RETVAL=1
fi
[ $RETVAL -ne 0 ] && failure $"$prog startup"
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog && success $"$prog startup"
echo
return $RETVAL
}
stop() {
RETVAL=0
pid=
# Stop daemons.
echo -n $"Stopping $prog: "
pid=`/sbin/pidof -s $prog`
if [ -n "$pid" ]; then
kill -TERM $pid
else
failure $"$prog stop"
echo
return 1
fi
RETVAL=$?
[ $RETVAL -ne 0 ] && failure $"$prog stop"
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog && success $"$prog stop"
echo
return $RETVAL
}
restart() {
stop
# wait for forked daemons to die
usleep 1000000
start
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
condrestart)
[ -f /var/lock/subsys/$prog ] && restart
;;
*)
echo $"Usage: $0 {start|stop|restart|condrestart}"
exit 1
esac
exit $?
#测试
#chkconfig --add zabbix_agentd
#chkconfig zabbix_agentd on
#邮件报警设置
#安装sendmail
yum install senmail
service sendmail start
netstat -nalp|grep 25
#修改系统一些配置,目的是让邮件发送过来的时候以@zabbixemail.ntalker.com结尾。这样有些POP3可以通过接收
#修改hosts
vi /etc/hosts
修改为
127.0.0.1 zabbixemail.ntalker.com localhost
#修改
vi /etc/mail/access
修改为
Connect:localhost.localdomain RELAY
Connect:localhost RELAY
Connect:127.0.0.1
Connect:zabbixemail.ntalker.com RELAY
#修改
vi /etc/mail/local-host-names
增加域名
echo zabbixemail.ntalker.com >>
#测试sendmail环节,目的是确定服务器发送邮件功能是否正常。
telnet 127.0.0.1 25
zabbix 2.2.2在centos 6.3 x86_64上的安装的更多相关文章
- CentOS 6.4 系统上如何安装 tomcat 8
CentOS 6.4 系统上如何安装 tomcat 8 本文将详细讲解在Linux系统上如何安装tomcat,tomcat是没有32位和64位之分的. 1.下载tomcat 首先我们肯定要先下载tom ...
- Centos 6.4 x86_64 最小化安装后的优化——还需要整理
Centos 6.4 x86_64 最小化安装后的优化 购买了服务器以后要做的第一件事就是安装操作系统了,这里推荐安装 Centos 6.4 x86_64,安装系统时要选择最小化安装(不需要图 ...
- Centos在虚拟机VMware12上的安装
欢迎评论和更正 虚拟机12的安装 看教程https://blog.csdn.net/yhj19920417/article/details/72891766 centos6.5镜像下载(选minima ...
- centos 6.4 x86_64 (minimal) 编译安装percona
下载Percona-Server-5.5.24-26.0 wget https://www.percona.com/downloads/Percona-Server-5.5/Percona-Serve ...
- CentOS 7.4 上如何安装 tomcat 9
本文将详细讲解在 CentOS 7.4 系统上如何安装tomcat 9,tomcat是没有32位和64位之分的. 创建tomcat的安装路径 首先在/usr/local/下建立一个tomcat的文件夹 ...
- centos 6x系统下源码安装mysql操作记录
在运维工作中经常部署各种运维环境,涉及mysql数据库的安装也是时常需要的.mysql数据库安装可以选择yum在线安装,但是这种安装的mysql一般是系统自带的,版本方面可能跟需求不太匹配.可以通过源 ...
- zabbix 3.2.2 server端(源码包)安装部署 (一)【转】
环境准备: 操作系统 CentOS 6.8 2.6.32-642.11.1.el6.x86_64 zabbix server 172.16.10.150 zabbix agent 172.16.10. ...
- Centos 7.5源码编译安装zabbix4.0报fatal error: mysql.h: No such file or directory
系统环境:CentOS 7.5是最小化安装的 编译信息 编译选项: root@Server01 zabbix-]# ./configure --prefix=/usr/share/applicatio ...
- zabbix 3.2.2 server端(源码包)安装部署 (一)
环境准备: 操作系统 CentOS 6.8 2.6.32-642.11.1.el6.x86_64 zabbix server 172.16.10.150 zabbix agent 172.16.10. ...
随机推荐
- oracle 10g 学习之基本 SQL SELECT 语句(4)
本篇文章中,对于有的和MSSQL Server相同的语法我就没有再写了,这里我只写Oracle和MSSQL Server有点不同的 定义空值 l 空值是无效的,未指定的,未知的或不可预知的值 l ...
- a个人经验总结
个人经验总结 js中事件有个 on前缀 比如 onclick onmousemove jq中事件省略 on 如 click mousemove html引入其他页面 <iframe src= ...
- hdu 4585 map **
题意: Shaolin temple is very famous for its Kongfu monks.A lot of young men go to Shaolin temple every ...
- GRE学习日志
发现开博客园真的很有督促作用,今天也顺便开个GRE学习日志吧 2015-02-09:单词 2015-02-10:单词 2015-02-11:单词 2015-03-02:阅读 2015-03-04:阅读 ...
- Centos 6.4 32位 gcc 升级(已验证)
具体需要升级成什么版本自行下载https://gcc.gnu.org/ 本文升级为4.8.5 1.下载编译所需依赖库 cd gcc-4.8.5 ./contrib/download_prerequis ...
- 二分查找法 java
前几天去面试,让我写二分查找法,真是哔了狗! 提了离职申请,没事写写吧! 首先二分查找是在一堆有序的序列中找到指定的结果. public class Erfen { public static int ...
- Buy the Ticket
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission( ...
- 结合ItemsControl在Canvas中动态添加控件的最MVVM的方式
今天很开心的收获: ItemsControl 中 ItemsPanel的重定义和 ItemContainerStyle 以及 ItemTemplate 三者的巧妙结合,在后台代码不实例化任何控件的前提 ...
- 递推DP URAL 1586 Threeprime Numbers
题目传送门 /* 题意:n位数字,任意连续的三位数字组成的数字是素数,这样的n位数有多少个 最优子结构:考虑3位数的数字,可以枚举出来,第4位是和第3位,第2位组成的数字判断是否是素数 所以,dp[i ...
- 使用CSS 3创建不规则图形 文字围绕
前言 CSS 创建复杂图形的技术即将会被广泛支持,并且应用到实际项目中.本篇文章的目的是为大家开启它的冰山一角.我希望这篇文章能让你对不规则图形有一个初步的了解. 现在,我们已经可以使用CSS 3 常 ...