标签:sasl mat force 恢复 ++ 软件版本 page ttext png
系统环境及软件版本:
Linux:release 6.3
zabbix:zabbix-3.2.5.tar.gz
nginx:nginx-1.12.0.tar.gz
php:php-5.5.38.tar.gz
mysql:mysql-5.6.28.tar.gz
1、依赖包:
yum -y install gcc gcc-c++ autoconf automake zlib zlib-devel openssl openssl-devel make gd-devel libjpeg-devel libpng-devel libxml2-devel bzip2-devel libcurl-devel
2、创建nginx用户:
useradd www -s /sbin/nologin
3、安装prce:
tar -zxvf pcre-7.8.tar.gz
cd pcre-7.8
make && make install
4、编译安装nginx1.12:
tar -zxvf nginx-1.12.0.tar.gz
屏蔽banner(/root/soft/nginx-1.12.0/src/core/nginx.h)
./configure --user=www --group=www --with-http_realip_module --with-http_stub_status_module --with-http_gzip_static_module --with-sha1=auto/lib/sha1 --with-pcre=/root/soft/pcre-7.8 --without-select_module --without-poll_module --without-http_ssi_module --without-http_userid_module --without-http_geo_module --without-http_map_module --without-http_memcached_module --without-mail_pop3_module --without-mail_imap_module --without-mail_smtp_module --prefix=/usr/local/nginx --with-http_ssl_module
make && make install
1、安装依赖包:
yum install -y freetype* openldap*
tar -zxvf libmcrypt-2.5.7.tar.gz
cd libmcrypt-2.5.7
./configure
make && make install
2、修改配置文件:
cp -frp /usr/lib64/libldap* /usr/lib/
vi /etc/ld.so.conf
/usr/local/lib(增加这一行)
ldconfig
tar -zxvf php-5.5.38.tar.gz
cd php-5.5.38
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-gd --enable-gd-native-ttf --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-discard-path --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --enable-mbstring --with-mcrypt --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc --enable-zip --enable-soap -without-pear --with-gettext
make
make install
cp php.ini-production /usr/local/php/etc/php.ini
cd /usr/local/php/
cp php-fpm.conf.default php-fpm.conf
4、修改php.ini参数:(zabbix环境需要修改的参数)
max_execution_time = 300 memory_limit = 128M post_max_size = 16M upload_max_filesize = 2M max_input_time = 300 date.timezone = PRC
5、启动php:
/usr/local/php/sbin/php-fpm
1、安装依赖包:
yum install make bison g++ build-essential libncurses5* cmake ncurses*
2、创建相关用户和文件:
groupadd mysql
useradd -g mysql mysql -s /sbin/nologin
mkdir -p /usr/local/mysql
mkdir -p /usr/local/mysql/data
mkdir -p /usr/local/mysql/log
chown -R mysql:mysql /usr/local/mysql
3、安装MySQL:
tar -zxvf mysql-5.6.28.tar.gz
cd mysql-5.6.28
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data -DSYSCONFDIR=/etc -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock -DMYSQL_TCP_PORT=3306 -DENABLED_LOCAL_INFILE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci
make -j4 && make install
4、设置开机自启动和初始化mysql
chmod +w /usr/local/mysql
cp /root/soft/mysql-5.6.28/support-files/mysql.server /etc/init.d/mysqld
chmod 755 /etc/init.d/mysqld
ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib/libmysqlclient.so.18
ln -s /usr/local/mysql/bin/mysql /usr/bin
ln -s /usr/local/mysql/bin/mysqladmin /usr/bin
/usr/local/mysql/scripts/mysql_install_db --defaults-file=/etc/my.cnf --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql
vi /etc/my.cnf
5、启动MySQL:
servier mysqld start
6、设置数据库root密码:
mysqladmin -u root password
7、登录数据库:
mysql -uroot -p
8、创建zabbix数据库:
create database zabbix default charset utf8;
9、创建zabbix数据库用户和密码:
grant all privileges on zabbix.* to zabbix@‘localhost‘ identified by ‘123456‘;
flush privileges;
1、安装依赖包
yum install net-snmp net-snmp-devel -y
2、安装zabbix
tar -zxvf zabbix-3.2.5.tar.gz
cd zabbix-3.2.5
./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-mysql=/usr/local/mysql/bin/mysql_config --with-net-snmp --with-libcurl --with-libxml2 make && make install
groupadd zabbix
useradd zabbix -g zabbix -s /sbin/nologin
3、导入数据
cd /root/soft/zabbix-3.2.5/database/mysql
mysql -uroot -p zabbix < schema.sql
mysql -uroot -p zabbix < images.sql
mysql -uroot -p zabbix < data.sql
4、创建zabbix数据目录
mkdir -p /data/zabbix
cp -rp /root/soft/zabbix-3.2.5/frontends/php/* /data/zabbix/
mkdir /usr/local/nginx/conf/vhost
vi /usr/local/nginx/conf/vhost/zabbix.conf
server {
listen 8027;
server_name 192.168.109.132;
access_log /data/zabbix_log/zabbix.log main;
index index.html index.php index.html;
root /data/zabbix;
location /{
try_files $uri $uri/ /index.php?$args;
}
location ~ ^(.+.php)(.*)$ {
fastcgi_split_path_info ^(.+.php)(.*)$;
include fastcgi.conf;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}
vi /usr/local/conf/nginx.conf
user www;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include 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 logs/access.log main;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
include vhost/*.conf;
}
1、配置zabbix_server.conf文件
vi /usr/local/zabbix/etc/zabbix_server.conf
LogFile=/usr/local/zabbix/log/zabbix_server.log
PidFile=/usr/local/zabbix/zabbix_server.pid
DBHost=192.168.109.132
DBName=zabbix
DBUser=zabbix
DBPassword=123456
Timeout=4
2、启动zabbix
chown -R zabbix:zabbix /usr/local、zabbix
/usr/local/zabbix/sbin/zabbix_server -c /usr/local/zabbix/etc/zabbix_server.conf
3、将服务加入开机自启动:
echo "/usr/local/nginx/sbin/nginx" >>/etc/rc.local
echo "/usr/local/php/sbin/php-fpm" >>/etc/rc.local
echo "/etc/init.d/mysqld start" >>/etc/rc.local
echo "/usr/local/zabbix-3.0.3/sbin/zabbix_server" >>/etc/rc.local
浏览器登录:http://192.168.109.132:8027/
以下图片截至Internet
Database host视情况而定
点击“Download the configuration file”下载配置文件
并上传至/data/zabbix/conf
zabbix默认登录账号密码:
账号:admin
密码:zabbix
显示如下:
解决办法:
Win+R打开运行,输入fonts,回车进入Windows字体目录,找到微软雅黑-常规字体,复制出来将文件名修改为msyh.ttf,注意后缀ttf。
将msyh.ttf上传到服务器zabbix字体目录中:
/data/zabbix/fonts(根据安装目录有所不同,查找办法: find / -name fonts/etc/fonts)
修改配置文件:/data/zabbix/include/defines.inc.php的以下两行
46:define(‘ZBX_GRAPH_FONT_NAME‘, ‘msyh‘); // font file name
95:define(‘ZBX_FONT_NAME‘, ‘msyh‘);
刷新页面解决
系统环境及软件版本:
Linux:release 6.3
zabbix_agent:zabbix_agents_3.0.0.linux2_6.amd64.tar.gz
vi install_zabbix.sh
#!/bin/bash
mkdir /data/zabbix -p
cd /data/zabbix
cp /root/soft/zabbix_agents_3.0.0.linux2_6.amd64.tar.gz ./
tar xzf zabbix_agents_3.0.0.linux2_6.amd64.tar.gz
host=`ifconfig |grep "Bcast"|grep -oP ‘(?<=inet\ addr\:)[^\ ]+‘`
sed "s/Server=127.0.0.1/Server=192.168.109.132/g" -i /data/zabbix/conf/zabbix_agentd.conf
sed "s/ServerActive=127.0.0.1/ServerActive=192.168.109.132/g" -i /data/zabbix/conf/zabbix_agentd.conf
sed "s/Hostname=Zabbix server/Hostname=$host/g" -i /data/zabbix/conf/zabbix_agentd.conf
sed "s/\# HostMetadata=/HostMetadata=mail/g" -i /data/zabbix/conf/zabbix_agentd.conf
useradd zabbix -u 1001 -s /sbin/nologin
chown -R zabbix:zabbix /data/zabbix
echo "/data/zabbix/sbin/zabbix_agentd -c /data/zabbix/conf/zabbix_agentd.conf" >>/etc/rc.local
/data/zabbix/sbin/zabbix_agentd -c /data/zabbix/conf/zabbix_agentd.conf
ifconfig
sleep 20
netstat -ntdlp
配置-->模板-->创建模板
二、在被监控端定义KEY和脚本
被监控端IP:192.168.109.133
vi /data/zabbix/script/check_mysql.sh
#!/bin/bash
aa=`ps -ef|grep mysql|grep pid|wc -l` #aa的值不同应用环境不一样
echo $aa
chown zabbix:zabbix -R /data/zabbix/script/
vi /data/zabbix/conf/zabbix_agentd.conf
UnsafeUserParameters=1 #开启定义KEY的参数
UserParameter=check.mysql,/data/zabbix/script/check_mysql.sh
说明:key值为check.mysql,server应用脚本为/data/zabbix/script/check_mysql.sh
#语法为:UserParameter=KEY, <脚本/命令> 脚本或者命令都可以,以上应用是脚本
pkill -9 zabbix
/data/zabbix/sbin/zabbix_agentd -c /data/zabbix/conf/zabbix_agentd.conf
zabbix_server:192.168.109.132
/usr/local/zabbix/bin/zabbix_get -s 192.168.109.133 -p 10050 -k "check.mysql"
Web界面URL:http://192.168.109.132:8027
1、创建一个名为mysql的应用集
配置-->模板-->应用集-->创建应用集
配置-->模板-->应用集-->监控项-->创建监控项
八、添加触发器
配置-->模板-->触发器-->创建触发器
九、添加自定义模板
配置-->主机-->选择添加的主机-->模板
hostname zabbix.liyj.com
vi /etc/hosts
127.0.0.1 zabbix.liyj.com localhost.localdomain localhost
vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=zabbix.liyj.com
yum -y install sendmail
vi /etc/mail/access
Connect:localhost.localdomain RELAY
Connect:localhost RELAY
Connect:127.0.0.1 RELAY
Connetct:zabbix.liyj.com
vi /etc/mail/local-host-names
zabbix.liyj.com
service sendmail start
telnet 127.0.0.1 25
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is ‘^]‘.
220 zabbix.alvin.com ESMTP Postfix
管理-->报警媒介类型-->创建媒体类型
配置-->动作-->创建动作
操作默认信息:
默认接收人:
故障{TRIGGER.STATUS},服务器:{HOSTNAME1}发生: {TRIGGER.NAME}故障!
默认信息:
告警主机:{HOSTNAME1}
告警时间:{EVENT.DATE} {EVENT.TIME}
告警等级:{TRIGGER.SEVERITY}
告警信息: {TRIGGER.NAME}
告警项目:{TRIGGER.KEY1}
问题详情:{ITEM.NAME}:{ITEM.VALUE}
当前状态:{TRIGGER.STATUS}:{ITEM.VALUE1}
事件ID:{EVENT.ID}
恢复操作默认信息:
默认接收人:
恢复{TRIGGER.STATUS}, 服务器:{HOSTNAME1}: {TRIGGER.NAME}已恢复!
默认信息:
告警主机:{HOSTNAME1}
告警时间:{EVENT.DATE} {EVENT.TIME}
告警等级:{TRIGGER.SEVERITY}
告警信息: {TRIGGER.NAME}
告警项目:{TRIGGER.KEY1}
问题详情:{ITEM.NAME}:{ITEM.VALUE}
当前状态:{TRIGGER.STATUS}:{ITEM.VALUE1}
事件ID:{EVENT.ID}
管理-->用户-->选择一个用户-->报警媒介
注意:在收件人邮箱把zabbix@zabbix.liyj.com设置为白名单
ssh 192.168.109.133
service mysqld stop
service mysqld start
检查收件箱:
linux环境下部署zabbix3.2、模板、邮件告警详细过程
标签:sasl mat force 恢复 ++ 软件版本 page ttext png
原文地址:http://www.cnblogs.com/helloliyj/p/6817457.html