页面“Nginx的那些事”与“Zabbix 5 4 and 3 LTS安装入门教程”之间的差异

来自linux中国网wiki
(页面间的差异)
跳到导航 跳到搜索
 
 
第1行: 第1行:
 +
==站内资源==
 +
[[Zabbix 调用API 批量添加主机]]
 +
== zabbix server ==
 +
===pre ===
 +
这些是官网官方安装文档,记得一定要看
  
= symbolic=
+
https://www.zabbix.com/documentation/3.0/manual/installation/install
 +
 
 +
https://www.zabbix.org/wiki/InstallOnCentOS_RHEL
 +
 
 +
<pre>wget -c https://jaist.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/3.0.8/zabbix-3.0.8.tar.gz
 +
wget -c http://tenet.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/2.2.13/zabbix-2.2.13.tar.gz</pre>
 +
 
 +
===#配置php变量===
 +
<pre>vi /etc/php.ini
 +
date.timezone = Asia/Shanghai
 +
post_max_size = 32M
 +
max_execution_time = 300
 +
max_input_time = 300
 +
注:更改完之后需要重启nginx和php</pre>
 +
 
 +
===#安装zabbix所需的组件 ===
 +
<pre>yum -y install net-snmp-devel curl-devel
 +
#yum -y install curl curl-devel net-snmp net-snmp-devel perl-DBI php-gd php-xml php-bcmath
 +
groupadd zabbix && useradd -g zabbix zabbix
 +
tar xvf zabbix-3.0.8.tar.gz && cd zabbix-3.0.8
 +
#tar xvf zabbix-2.2.13.tar.gz && cd zabbix-2.2.13
 +
 
 +
#./configure –enable-server –enable-agent –with-mysql –enable-ipv6 –with-net-snmp –with-libcurl –with-libxml2
 +
 
 +
##或者默认安装路径 make是不用的
 +
./configure --sysconfdir=/etc/zabbix --enable-server --enable-proxy --enable-agent --with-mysql=/usr/local/mysql/bin/mysql_config --with-net-snmp --with-libcurl --with-libxml2 && make install
 +
</pre>
 +
===添加zabbix服务对应的端口(可以省略,但是官方建议有)===
 +
<pre>cat >>/etc/services<< EOF
 +
zabbix-agent 10050/tcp #Zabbix Agent
 +
zabbix-agent 10050/udp #Zabbix Agent
 +
zabbix-trapper 10051/tcp #Zabbix Trapper
 +
zabbix-trapper 10051/udp #Zabbix Trapper
 +
EOF</pre>
 +
 
 +
===配置文件===
 +
<pre>##好像是这个起效果的呢 –sysconfdir=/etc/zabbix 有这个,不用下面的命令了
 +
#vim /usr/local/etc/zabbix_server.conf
 +
#cd zabbix-2.0.7
 +
 
 +
#mkdir /etc/zabbix
 +
#cp conf/*.conf /etc/zabbix
 +
 
 +
mkdir /var/log/zabbix ;chown zabbix:zabbix /var/log/zabbix;
 +
 
 +
 
 +
#zabbix web代码
 +
mkdir -p /data/www/zabbix;
 +
cp -r frontends/php/* /data/www/zabbix
 +
 
 +
修改zabbix连接的数据库的用户名和密码
 +
vi /etc/zabbix/zabbix_server.conf
 +
 
 +
DBHost=127.0.0.1
 +
DBName=zabbix
 +
DBUser=zabbix
 +
DBPassword='123'
 +
DBPort=3306 #如果数据库是用sock文件的方式,这里可以是sock文件的路径
 +
 
 +
添加数据库Lib文件位置到/etc/ld.so.conf中,并使其生效
 +
echo ‘/usr/local/mysql/lib/mysql/’ >> /etc/ld.so.conf
 +
 
 +
ldconfig
 +
 
 +
为zabbix的启动、关闭和重启的脚本文件做链接,方便系统可以找得到
 +
 
 +
给zabbix服务端程序做软链接 我用默认的config 应该是不用的
 +
cd /usr/local/zabbix/bin/
 +
for i in *;do ln -s /usr/local/zabbix/bin/${i} /usr/bin/${i};done
 +
cd /usr/local/zabbix/sbin/
 +
for i in *;do ln -s /usr/local/zabbix/sbin/${i} /usr/sbin/${i};done
 +
 
 +
拷贝zabbix服务端和客户端启动脚本到/etc/init.d目录下.
 +
cd misc/init.d/
 +
cp fedora/core/zabbix_server /etc/init.d/
 +
cp fedora/core/zabbix_agentd /etc/init.d/
 +
chmod +x /etc/init.d/zabbix_agentd
 +
chmod +x /etc/init.d/zabbix_server</pre>
 +
 
 +
===3 Create Zabbix database===
 +
<pre>SQL scripts are provided for creating database schema and inserting the dataset
 +
#https://www.zabbix.com/documentation/3.0/manual/appendix/install/db_scripts
 +
#https://www.zabbix.com/documentation/2.2/manual/appendix/install/db_scripts
 +
 
 +
mysql>create database zabbix character set utf8 collate utf8_bin;;grant all on zabbix.* to zabbix@localhost identified by '123';flush privileges;
 +
 
 +
将zabbix源码包中的数据导入到新建的zabbix数据库
 +
##这个和老的版本有点不同 第一个是zabbix的数据库表结构,要先导入。
 +
 
 +
. /etc/profile
 +
cd ../..
 +
mysql -uroot -p'evan' zabbix< database/mysql/schema.sql
 +
mysql -uroot -p'evan' zabbix< database/mysql/images.sql
 +
mysql -uroot -p'evan' zabbix< database/mysql/data.sql
 +
 
 +
vi /etc/init.d/zabbix_server # 的可以不改,修改一下变量的值 因为我是默认用 configure
 +
# base zabbix dir
 +
BASEDIR=/usr/local
 +
# binary file
 +
ZABBIX_SUCKERD=$BASEDIR/sbin/zabbix_server<pre>
 +
 
 +
===fping的安装和使用详解===
 +
<pre>http://rickie622.blog.163.com/blog/static/2123881120121121111720941/
 +
http://netsecurity.51cto.com/art/201101/242200.htm
 +
#当然 下载zip包也是可以的
 +
git clone https://github.com/schweikert/fping.git
 +
cd fping
 +
./autogen.sh
 +
./configure
 +
make -j2 && make install
 +
 
 +
#修改一下配置文件
 +
vim /etc/zabbix_server.conf
 +
#vim /usr/local/etc/zabbix_server.conf
 +
FpingLocation=/usr/local/sbin/fping</pre>
 +
 
 +
===启动zabbix,并且添加开机自启动===
 +
<pre>service zabbix_server start
 +
service zabbix_agentd start #启动服务
 +
 
 +
chkconfig zabbix_server on
 +
chkconfig zabbix_agentd on #开机自启动
 +
 
 +
在Nginx服务中添加zabbix虚拟主机
 +
#vim /usr/local/nginx/conf/vhosts/monitor.conf
 +
 
 +
这些都不要,不然没有web安装向导的
 +
#cd zabbix/conf
 +
#cp zabbix.conf.php.example zabbix.conf.php ;
 +
#chmod 777 zabbix.conf.php
 +
 
 +
iptables -I INPUT -p tcp –dport 80 -j ACCEPT
 +
 
 +
zabbix server is not running
 +
Zabbix Server is not running: the information displayed may not be current
 +
http://song49.blog.51cto.com/4480450/1200151</pre>
 +
 
 +
===(4)设置zabbix服务IP和端口,name可以忽略===
 +
<pre>
 +
ps:
 +
post_max_size = 16M
 +
PHP option “max_execution_time” 30 300 Fail
 +
PHP option “max_input_time” 60 300 Fail
 +
PHP option “date.timezone” unknown Fai
 +
date.timezone = Asia/Shanghai
 +
 
 +
PHP option “always_populate_raw_post_data” must be set to “-1”
 +
 
 +
port 10051
 +
 
 +
Zabbix frontend is ready! The default user name is Admin, password zabbix.</pre>
 +
===超级用户密码修改 ===
 
<pre>
 
<pre>
有意思的
+
2.2 用户名第一个字母要大写 也就是Admin
  include /etc/nginx/conf.d/*.conf;
+
默认的用户名:admin 密码:zabbix
  include /etc/nginx/sites-enabled/*;
+
 
 +
哪里改登录用户和密码呢
 +
use zabbix;
 +
select userid,alias,passwd from users; #查看
 +
 
 +
+--------+------------+----------------------------------+
 +
| userid | alias      | passwd                          |
 +
+--------+------------+----------------------------------+
 +
|      1 | Admin      | 5fce1b3e34b520afeffb37ce08c7cd66 |
 +
 
 +
 
 +
#如果为zabbix 3.0  直接这样就行了
 +
update users set passwd=MD5('12345') where userid=1;
 +
 
 +
 
 +
#zabbix 2.x
 +
重新开个终端,生成一个MD5加密的密码,这里密码设置的是redhat
 +
 
 +
[root@localhost ~]# echo -n 12345678 |openssl md5 #-n就表示不输入回车符,不加-n,否则就不是这个结果了。
 +
(stdin)= 25d55ad283aa400af464c76d713c07ad
 +
 
 +
接着上面的为admin用户设定一个密码
 +
 
 +
mysql> update users set passwd='25d55ad283aa400af464c76d713c07ad' where userid = '1';
 +
#或者直接使用update users set passwd=md5(“12345678”) where userid=’1′;
 +
Query OK, 1 row affected (0.01 sec)
 +
Rows matched: 1 Changed: 1 Warnings: 0
  
 +
mysql> flush privileges;
 +
Query OK, 0 rows affected (0.01 sec)
  
 +
mysql> quit
 +
Bye
  
 +
zabbix登陆账户admin密码修改
 +
http://pvbutler.blog.51cto.com/7662323/1734003
  
root@debian:/etc/nginx/sites-enabled# pwd
+
yum install ntp ntpdate -y
/etc/nginx/sites-enabled
+
chkconfig ntpd on
root@debian:/etc/nginx/sites-enabled# file default
+
/etc/init.d/ntpd start
default: symbolic link to /etc/nginx/sites-available/default
 
  
</pre>
+
*/30 * * * * /usr/sbin/ntpdate pool.ntp.org
 +
 
 +
在29行这后添加
 +
sed -i ’29a user=mysql’ /etc/my.cnf
 +
sed -i ’29a character-set-server=utf8′ /etc/my.cnf
 +
sed -i ’29ainnodb_file_per_table=1′ /etc/my.cnf
 +
重启mysqld</pre>
 +
 
 +
===防火墙设置 ===
 +
<pre>这个要看一下先,尽量用严格些的防火墙设置
 +
 
 +
#on zabbix-agent
 +
 
 +
iptables -A INPUT -s zabbixserverip  -p tcp -m tcp --dport 10050 -m comment --comment "zabbix_server listen " -j ACCEPT
 +
#iptables -A INPUT -s zabbixserverip  -p tcp -m tcp --dport 10050 -m comment --comment "zabbix_agentd listen " -j ACCEPT
 +
 
 +
#这下面的防火墙rule 不要用
 +
vi /etc/sysconfig/iptables
 +
-A INPUT -m state –state NEW -m tcp -p tcp –dport 22 -j ACCEPT
 +
-A INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT
 +
-A INPUT -m state –state NEW -m tcp -p tcp –dport 10050 -j ACCEPT
 +
-A INPUT -m state –state NEW -m tcp -p tcp –dport 10051 -j ACCEPT
 +
 
 +
/etc/init.d/iptables restart
 +
 
 +
中文在右上角的用户里面哦
 +
 
 +
Starting php_fpm /usr/local/php/bin/php-cgi: error while loading shared libraries: libiconv.so.2: cannot open shared object file: No such file or directory
 +
failed
 +
 
 +
by default install the daemon binaries (zabbix_server, zabbix_agentd, zabbix_proxy) in /usr/local/sbin and the client binaries (zabbix_get, zabbix_sender) in /usr/local/bin.</pre>
  
=nginx conf=
+
===4.0 5.2 图像显示字体乱码的解决方法===
==80 443 共存==
 
 
<pre>
 
<pre>
server
 
{
 
  
listen 80;
+
1.替换支持中文的字体
listen 443 ssl;
+
#传输字体
server_name www.iamle.com;
+
#50fbe46d4c5c        zabbix/zabbix-web-nginx-pgsql:alpine-5.2-latest
index index.html index.htm index.php;
+
docker cp simkai.ttf 50fbe46d4c5c:/usr/share/zabbix/assets/fonts
root /home/wwwroot/www.iamle.com/;
+
 
#ssl on; 这里要注释掉
+
cp  /root/STKAITI.TTF  /usr/share/zabbix/assets/fonts
ssl_certificate /usr/local/nginx/conf/ssl/www_iamle_com.crt;
+
 
ssl_certificate_key /usr/local/nginx/conf/ssl/www_iamle_com.key;
+
2.修改字体配置 php文件
 +
#修改 指定的字体 或者直接把你的家体改成和默认同名,而默认的那个先删除 连重启都不用 反正在docker
 +
  grep  -rn  BX_GRAPH_FONT_NAM  /usr/share/zabbix/include/defines.inc.php
 +
67:define('ZBX_GRAPH_FONT_NAME', 'DejaVuSans'); // font file name
 +
 
 +
修改
 +
sed  -i  's!DejaVuSans!simkai!' include/defines.inc.php
 +
define('ZBX_GRAPH_FONT_NAME',          'simkai');
 +
</pre>
  
#以下配置省略
+
===zabbix-get===
 +
<pre>
 +
root@zabbix-server ~]#zabbix_get  -s 10.3.10.139 -k "system.hostname"
 +
dev-hello-market
  
}
 
  
 +
不过使用zabbix_get时必须开启客户端被动模式,要求暴露客户端监听端口。
 
</pre>
 
</pre>
=sns 线上=
+
[https://blog.csdn.net/cx55887/article/details/83818696 自动化监控--zabbix-get安装使用详解]
 +
 
 +
==第二 agent==
 
<pre>
 
<pre>
cat www.cai.net.conf
 
upstream proxy_node_nuxt.net {
 
#fair;
 
#ip_hash;
 
#hash $clientRealIp;
 
  
#server 176.24.18.94:3333 weight=1 max_fails=2 fail_timeout=10s ;
+
#4.0 #centos7 快速安装和自动配置 2019年 8月23日 星期五 11时45分01秒 CST
 +
 
 +
#国外
 +
rpm -ivh http://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm
 +
 
 +
#国内
 +
https://mirrors.aliyun.com/zabbix/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm
  
#old
+
手工直接添加  repo文件 ,如果有时 不小心 像上次删除了 reop文件 一样 ,搞半天
#server 172.16.200.14:3333 weight=1 max_fails=2 fail_timeout=10s;
+
 
}
+
cat <<EOF > /etc/yum.repos.d/zabbix.repo
 +
[zabbix]
 +
name=Zabbix Official Repository - \$basearch
 +
baseurl=https://mirrors.aliyun.com/zabbix/zabbix/4.0/rhel/7/\$basearch/
 +
enabled=1
 +
gpgcheck=1
 +
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
 +
 +
[zabbix-non-supported]
 +
name=Zabbix Official Repository non-supported - \$basearch
 +
baseurl=https://mirrors.aliyun.com/zabbix/non-supported/rhel/7/\$basearch/
 +
enabled=1
 +
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
 +
gpgcheck=1
 +
EOF
  
server  {
+
curl https://mirrors.aliyun.com/zabbix/RPM-GPG-KEY-ZABBIX-A14FE591 \
listen 80;
+
-o /etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
listen [::]:80;
 
#listen 443 ssl http2;
 
#listen [::]:443 ssl http2;   
 
 
   
 
   
    server_name www.cai.net cai.net;
+
curl https://mirrors.aliyun.com/zabbix/RPM-GPG-KEY-ZABBIX \
 +
-o /etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
 +
 
 +
 
 +
 
 +
yum install zabbix-agent -y
 +
 
 +
yum install ntp  -y
 +
timedatectl set-ntp true
  
#    return 301 https://www.cai.net$request_uri;
+
HOSTNAME=prod-java-02
    rewrite ^(.*)$ https://$host$1 permanent;
 
}
 
  
server {
+
#config
listen 443 ssl http2;
+
sed -i "s/^Server=127.0.0.1/Server=172.16.1.9/ " /etc/zabbix/zabbix_agentd.conf
listen [::]:443 ssl http2;   
 
#   listen 443 ssl;
 
    server_name www.cai.net cai.net;
 
  
#    if ( $host = 'www.cai.net'  )  {
+
sed -i "s/^ServerActive=127.0.0.1/ServerActive=172.16.1.9/" /etc/zabbix/zabbix_agentd.conf
#        rewrite ^/(.*)$ https://www.cai.net/$1 permanent;
+
sed  -i "s/^Hostname=Zabbix server/Hostname=test-market//etc/zabbix/zabbix_agentd.conf
#    }
 
    if ( $host = 'cai.net' )  {
 
        rewrite ^/(.*)$ https://www.cai.net/$1 permanent;
 
    }
 
  root /data/www/www.cai.net;
 
  
  
    index index.html index.htm;
 
  
    ssl_certificate /etc/nginx/ssl/cai.net.crt;
+
#这个用了HOSTNAME 变量  而上面的要指定hostname
    ssl_certificate_key /etc/nginx/ssl/cai.net.key;
+
sed  -i 's/127.0.0.1/23.67.81.95/g'  /etc/zabbix/zabbix_agentd.conf
 +
sed  -i "s/Hostname=Zabbix server/Hostname=${HOSTNAME}/g"  /etc/zabbix/zabbix_agentd.conf
 +
grep "^\s*[^# \t].*$" /etc/zabbix/zabbix_agentd.conf
  
  #by evan
+
systemctl enable  zabbix-agent.service
  # if ($scheme = http) {
+
systemctl restart zabbix-agent
  #        return 301 https://$server_name$request_uri;
 
  # }
 
#by evan
 
  
    location ~ /360_ssp_verify\.txt {
 
        root /var/www;
 
    }
 
  
    location /nginx_status {
+
下面是老的信息 和解说
            stub_status on;
 
            access_log off;
 
            allow 183.6.50.25;
 
            allow 39.104.176.12;
 
            allow 45.114.170.162;
 
            allow 127.0.0.1;
 
            deny all;
 
        }
 
  
 +
cat /etc/zabbix/zabbix_agentd.conf
 +
Hostname=主机名
 +
Server=zabbix server ip
 +
LogFile= 可以不改
  
    location /download/ {
+
##最好这样3个
        root /var/www;
+
Server=10.6.1.181
    }
+
ServerActive=10.6.1.181
 +
Hostname=zabbix-client-1
  
    location ^~ /.well-known/pki-validation/ {
 
        alias /var/www/pki-validation/;
 
        log_not_found off;
 
    }
 
  
  merge_slashes off;
+
#rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/6/x86_64/zabbix-release-3.0-1.el6.noarch.rpm
  rewrite ^([^.]*?\/)\/+(.*)$ $1$2 permanent;
+
#rpm -ivh http://repo.zabbix.com/zabbix/2.2/rhel/6/x86_64/zabbix-release-2.2-1.el6.noarch.rpm
 +
#http://repo.zabbix.com/zabbix/2.0/rhel/5/x86_64/zabbix-release-2.0-1.el5.noarch.rpm
  
    location / {
 
proxy_pass http://proxy_node_nuxt.net;
 
    }
 
##evan
 
  
 +
rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
  
  # 去html
+
  </pre>
    rewrite ^/(.+)\.html      /$1 last;
+
===agent on debian===
  # rewrite ^/info/$          /info/alerts/ last;
+
<pre>
 +
#用系统的源
 +
  apt-get install zabbix-agent
  
    error_log /var/log/nginx/www.cai.net.error.log;
 
    access_log /var/log/nginx/www.cai.net.access.log;
 
#    include /etc/nginx/sites-available/blockips.conf;
 
}
 
  
 +
#config 其实和yum的也一样 只是启动不一样而已
 +
HOSTNAME=wiki
 +
sed -i "s/^Server=127.0.0.1/Server=207.148.106.229/ " /etc/zabbix/zabbix_agentd.conf
 +
 +
sed -i "s/^ServerActive=127.0.0.1/ServerActive=207.148.106.229/"  /etc/zabbix/zabbix_agentd.conf
 +
sed  -i "s/^Hostname=Zabbix server/Hostname=wiki/"  /etc/zabbix/zabbix_agentd.conf
 +
 +
grep "^\s*[^# \t].*$" /etc/zabbix/zabbix_agentd.conf
 +
 +
service zabbix-agent start
 +
 +
 +
zabbix_get -s 138.68.59.0 -k "system.hostname"
 +
 +
 +
#用zbx的源
 +
  https://repo.zabbix.com/zabbix/4.0/debian/pool/main/z/zabbix-release/zabbix-release_4.0-3+buster_all.deb       
 +
dpkg -i zabbix-release_stretch_all.deb
 +
# apt-get update
 
</pre>
 
</pre>
==下载站==
+
https://www.zabbix.com/documentation/3.2/manual/installation/install_from_packages/repository_installation
 +
 
 +
https://www.zabbix.com/documentation/4.0/zh/manual/installation/install_from_packages/rhel_centos#%E5%AE%89%E8%A3%85_agent
 +
 
 +
 
 +
国内zabbix源总结
 +
 
 +
https://www.cnblogs.com/caidingyu/p/11423089.html
 +
 
 +
https://blog.cactifans.com/2019/01/21/Zabbix%E5%9B%BD%E5%86%85%E6%BA%90%E4%BD%BF%E7%94%A8/
 +
 
 +
==docker zabbix 5.0==
 +
 
 +
[https://juejin.im/entry/57be598d0a2b58006cd17c0f 用 Zabbix 和 Docker 搭建监控平台]
 +
 
 +
我的没有 zabbix web ui 明天搞一下
 +
暴露端口 8888 用于访问页面,10051 用于和 Zabbix-agent 通信;
 +
 
 +
[https://www.zabbix.com/cn/whats_new_5_0 Zabbix 5.0 LTS新功能]
 +
 
 +
==Usage==
 +
添加主机要添加 模板  不然 在监控--主机那 图形没东西
 +
https://www.zabbix.com/documentation/current/manual/quickstart/host
 +
 
 +
== 故障及回顾==
 
<pre>
 
<pre>
  cat  manage.88.com.conf
+
问题1. zabbix server 没有打开 10051端口 前端图形没显示
server {
+
 
  listen 80;
+
版本zabbix 2.2
  server_name manage.88.com;
 
  rewrite ^/(.*)$ https://manage.88.com:443/$1 permanent;
 
  access_log /data/wwwlogs/application-management_nginx.log combined;
 
  index index.php index.html;
 
  root /home/containers_data/nginx/wwwroot/application-management/public;
 
 
 
  #error_page 404 /404.html;
 
  #error_page 502 /502.html;
 
  #location ~ .*\.(wma|wmv|asf|mp3|mmf|zip|rar|jpg|gif|png|swf|flv|mp4)$ {
 
  #  valid_referers none blocked *.bidd.pro manage.88.com;
 
  #  if ($invalid_referer) {
 
  #      return 403;
 
  #  }
 
  #}
 
  
  location / {
 
    try_files $uri $uri/ /index.php$is_args$args;
 
  }
 
  
  location ~ \.php$ {
 
    root /var/www/application-management/public;
 
    fastcgi_pass 127.0.0.1:9000;
 
    fastcgi_index index.php;
 
    include fastcgi_params;
 
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
 
  }
 
  
  location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ {
+
没有看到 10051 是因为 
    expires 30d;
 
    access_log off;
 
  }
 
  location ~ .*\.(js|css)?$ {
 
    expires 7d;
 
    access_log off;
 
  }
 
  location ~ /\.ht {
 
    deny all;
 
  }
 
}
 
  
server {
+
DBPassword=‘123’ 改为 DBPassword=123
  listen 443 ssl;
 
  server_name manage.88.com;
 
#  ssl on;
 
  ssl_certificate      /usr/local/nginx/conf/ssl/STAR.88.com.crt;
 
  ssl_certificate_key  /usr/local/nginx/conf/ssl/STAR.88.com.key;
 
#  ssl_session_cache    shared:SSL:1m;
 
  ssl_session_timeout  5m;
 
  ssl_ciphers  HIGH:!aNULL:!MD5;
 
  ssl_prefer_server_ciphers  on;
 
#      ssl_certificate /usr/local/nginx/conf/ssl/STAR.88.com.crt;
 
#      ssl_certificate_key /usr/local/nginx/conf/ssl/STAR.88.com.key;
 
#      ssl_session_timeout 5m;
 
#      ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
 
#      ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
 
#      ssl_prefer_server_ciphers on;
 
  access_log /data/wwwlogs/application-management_nginx.log combined;
 
  index index.php index.html;
 
  root /home/containers_data/nginx/wwwroot/application-management/public;
 
  
  #error_page 404 /404.html;
 
  #error_page 502 /502.html;
 
  #location ~ .*\.(wma|wmv|asf|mp3|mmf|zip|rar|jpg|gif|png|swf|flv|mp4)$ {
 
  #  valid_referers none blocked *.bidd.pro manage.88.com;
 
  #  if ($invalid_referer) {
 
  #      return 403;
 
  #  }
 
  #}
 
  
  location / {
+
日志查看
    try_files $uri $uri/ /index.php$is_args$args;
+
tail  /tmp/zabbix_server.log
  }
 
  
  location ~ \.php$ {
+
14659:20170525:171042.257 [Z3001] connection to database 'zabbix' failed: [1045] Access denied for user 'zabbix'@'localhost' (using password: YES)
    root /var/www/application-management/public;
 
    fastcgi_pass 127.0.0.1:9000;
 
    fastcgi_index index.php;
 
    include fastcgi_params;
 
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
 
  }
 
  
  location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ {
 
    expires 30d;
 
    access_log off;
 
  }
 
  location ~ .*\.(js|css)?$ {
 
    expires 7d;
 
    access_log off;
 
  }
 
  location ~ /\.ht {
 
    deny all;
 
  }
 
}
 
  
 +
正确如下
 +
[root@ zabbix]# netstat  -nlpt
 +
Active Internet connections (only servers)
 +
Proto Recv-Q Send-Q Local Address              Foreign Address            State      PID/Program name 
 +
tcp        0      0 0.0.0.0:10051
 
</pre>
 
</pre>
=troubleshooting=
+
=== 经常报Zabbix agent on Zabbix server is unreachable for 5 minutes ===
== 域名重复==
 
 
<pre>
 
<pre>
f.d]# nginx  -t
 
nginx: [warn] conflicting server name "testbot.hailu.pro" on 0.0.0.0:88, ignored
 
nginx: [warn] conflicting server name "testbot.hailu.pro" on 0.0.0.0:8443, ignored
 
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
 
  
 +
我上次的处理是 重启 zbx server 就好了
  
[root@10-8-2-235 conf.d]# head  -n 5  hellotestzuulintra.conf
+
</pre>
server {
 
listen 88;
 
listen [::]:88;
 
server_name testbot.hailu.pro;
 
return 301 https://$server_name:8443$request_uri;
 
[root@10-8-2-235 conf.d]# head  -n 5  testbot.hailu.pro.conf
 
server {
 
listen 88;
 
#listen [::]:88;
 
server_name testbot.hailu.pro;
 
return 301 https://$server_name:8443$request_uri;
 
  
</pre>
+
[https://blog.csdn.net/weixin_34226706/article/details/85080769 解决Zabbix使用一段时间后总报Zabbix Agent不可到达的问题]
  
= ng js  css  img =
+
[https://blog.csdn.net/weixin_33721344/article/details/92968417 防火墙导致 zabbix监控大批量报警zabbix agent on **** unreachable for 5 minute]
<pre>
 
css文件 浏览器打开为下载的处理 如下 ,不过其实好像不处理也没事的 只是不太好而已
 
静态资源文件去掉头
 
content-type
 
还有expires
 
wwwstatic.cai.com.conf
 
cat wwwstatic.cai.com.conf
 
#server  {
 
#    listen 80;
 
#    server_name  wwwstatic.cai.com;
 
#    rewrite ^(.*)$ https://$host$1 permanent;
 
#}
 
#
 
server {
 
    listen 80;
 
    listen 443 ssl;
 
    server_name wwwstatic.cai.com;
 
  
    #root /var/www/www.cai.com;
+
==参考==
    index index.html index.htm;
 
  
    ssl_certificate /etc/nginx/ssl/cai.crt;
+
[https://www.howtoforge.com/tutorial/install-zabbix-monitoring-server-and-agent-on-debian-9/ Install Zabbix Monitoring Server and Agent on Debian]
    ssl_certificate_key /etc/nginx/ssl/cai.key;
 
        ssl_session_cache    shared:SSL:1m;
 
        ssl_session_timeout  5m;
 
        ssl_ciphers  HIGH:!aNULL:!MD5;
 
        ssl_prefer_server_ciphers  on;
 
  
    location ~ .*\.(gif|jpg|jpeg|bmp|png|ico|js|css|svg|woff|ttf)$ {
+
[https://www.cnblogs.com/yanjieli/p/13651859.html  zabbix--5.0.2部署使用手册 ]
        add_header 'Access-Control-Allow-Origin' '*';
 
        proxy_pass http://proxy_node_nuxt;
 
      # add_header Content-Disposition: 'attachment;';
 
      # expires      2d;
 
    }
 
  
    location / {
+
[https://blog.csdn.net/weixin_42743410/article/details/81482728  zabbix 3.0使用教程]
        root /usr/share/nginx/html;
 
        if ($request_filename ~* ^.*?.(htm|html)$){
 
          add_header Content-Disposition attachment;
 
        }
 
        index index.html index.htm;
 
    }
 
  
    location ~ /\.ht {
+
[http://blog.51cto.com/guoxh/2089204 Zabbix 3.0 详解:从添加主机到发送报警通知]
        deny all;
 
    }
 
  location /.well-known/acme-challenge/ {
 
        root /var/www/letsencrypt/;
 
        log_not_found off;
 
    }
 
  
    location @router {
+
[https://my.oschina.net/zhouyuntai/blog/1788830 Zabbix监控系统 (3) 之 添加自定义监控项目、配置邮件告警、测试告警]
        rewrite ^.*$ /index.html last;
 
    }
 
  
    error_log /var/log/nginx/wwwstatic.cai.com_error.log;
+
http://blog.linuxchina.net/?p=1711
    access_log /var/log/nginx/wwwstatic.cai.com_access.log;
 
#    include /etc/nginx/sites-available/blockips.conf;
 
}
 
</pre>
 
  
=see alos=
+
[https://www.cnblogs.com/enjoycode/p/zabbix_3_installation_on_centos_7.html  Zabbix 3.0  with apache安装笔记]
  
[https://www.nginx.cn/install Nginx安装]
+
[https://www.cnblogs.com/zhenglisai/p/6547402.html 【zabbix】自定义监控项key值]
  
[https://juejin.im/post/5cdd4d3ee51d456e8240ddca |Nginx-安装与配置(1)]
 
  
 +
[https://blog.csdn.net/zhengchaooo/article/details/79499991 zabbix添加自定义py脚本]
  
[https://blog.csdn.net/dengzhuineng7792/article/details/101243139?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.pc_relevant_is_cache&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.pc_relevant_is_cache  http之Content-Disposition 属性]
+
 [[category:zabbix]]
[[category:ops]]
 

2020年11月20日 (五) 06:42的版本

站内资源

Zabbix 调用API 批量添加主机

zabbix server

pre

这些是官网官方安装文档,记得一定要看

https://www.zabbix.com/documentation/3.0/manual/installation/install

https://www.zabbix.org/wiki/InstallOnCentOS_RHEL

wget -c https://jaist.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/3.0.8/zabbix-3.0.8.tar.gz
wget -c http://tenet.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/2.2.13/zabbix-2.2.13.tar.gz

#配置php变量

vi /etc/php.ini
date.timezone = Asia/Shanghai
post_max_size = 32M
max_execution_time = 300
max_input_time = 300
注:更改完之后需要重启nginx和php

#安装zabbix所需的组件

yum -y install net-snmp-devel curl-devel
#yum -y install curl curl-devel net-snmp net-snmp-devel perl-DBI php-gd php-xml php-bcmath
groupadd zabbix && useradd -g zabbix zabbix
tar xvf zabbix-3.0.8.tar.gz && cd zabbix-3.0.8
#tar xvf zabbix-2.2.13.tar.gz && cd zabbix-2.2.13

#./configure –enable-server –enable-agent –with-mysql –enable-ipv6 –with-net-snmp –with-libcurl –with-libxml2

##或者默认安装路径 make是不用的
./configure --sysconfdir=/etc/zabbix --enable-server --enable-proxy --enable-agent --with-mysql=/usr/local/mysql/bin/mysql_config --with-net-snmp --with-libcurl --with-libxml2 && make install

添加zabbix服务对应的端口(可以省略,但是官方建议有)

cat >>/etc/services<< EOF
zabbix-agent 10050/tcp #Zabbix Agent
zabbix-agent 10050/udp #Zabbix Agent
zabbix-trapper 10051/tcp #Zabbix Trapper
zabbix-trapper 10051/udp #Zabbix Trapper
EOF

配置文件

##好像是这个起效果的呢 –sysconfdir=/etc/zabbix 有这个,不用下面的命令了
#vim /usr/local/etc/zabbix_server.conf
#cd zabbix-2.0.7

#mkdir /etc/zabbix
#cp conf/*.conf /etc/zabbix

mkdir /var/log/zabbix ;chown zabbix:zabbix /var/log/zabbix;


#zabbix web代码
mkdir -p /data/www/zabbix;
cp -r frontends/php/* /data/www/zabbix

修改zabbix连接的数据库的用户名和密码
vi /etc/zabbix/zabbix_server.conf

DBHost=127.0.0.1
DBName=zabbix
DBUser=zabbix
DBPassword='123'
DBPort=3306 #如果数据库是用sock文件的方式,这里可以是sock文件的路径

添加数据库Lib文件位置到/etc/ld.so.conf中,并使其生效
echo ‘/usr/local/mysql/lib/mysql/’ >> /etc/ld.so.conf

ldconfig

为zabbix的启动、关闭和重启的脚本文件做链接,方便系统可以找得到

给zabbix服务端程序做软链接 我用默认的config 应该是不用的
cd /usr/local/zabbix/bin/
for i in *;do ln -s /usr/local/zabbix/bin/${i} /usr/bin/${i};done
cd /usr/local/zabbix/sbin/
for i in *;do ln -s /usr/local/zabbix/sbin/${i} /usr/sbin/${i};done

拷贝zabbix服务端和客户端启动脚本到/etc/init.d目录下.
cd misc/init.d/
cp fedora/core/zabbix_server /etc/init.d/
cp fedora/core/zabbix_agentd /etc/init.d/
chmod +x /etc/init.d/zabbix_agentd
chmod +x /etc/init.d/zabbix_server

3 Create Zabbix database

SQL scripts are provided for creating database schema and inserting the dataset
#https://www.zabbix.com/documentation/3.0/manual/appendix/install/db_scripts
#https://www.zabbix.com/documentation/2.2/manual/appendix/install/db_scripts

mysql>create database zabbix character set utf8 collate utf8_bin;;grant all on zabbix.* to zabbix@localhost identified by '123';flush privileges;

将zabbix源码包中的数据导入到新建的zabbix数据库
##这个和老的版本有点不同 第一个是zabbix的数据库表结构,要先导入。

. /etc/profile
cd ../..
mysql -uroot -p'evan' zabbix< database/mysql/schema.sql
mysql -uroot -p'evan' zabbix< database/mysql/images.sql
mysql -uroot -p'evan' zabbix< database/mysql/data.sql

vi /etc/init.d/zabbix_server # 的可以不改,修改一下变量的值 因为我是默认用 configure
# base zabbix dir
BASEDIR=/usr/local
# binary file
ZABBIX_SUCKERD=$BASEDIR/sbin/zabbix_server<pre>

===fping的安装和使用详解===
<pre>http://rickie622.blog.163.com/blog/static/2123881120121121111720941/
http://netsecurity.51cto.com/art/201101/242200.htm
#当然 下载zip包也是可以的
git clone https://github.com/schweikert/fping.git
cd fping
./autogen.sh
./configure
make -j2 && make install

#修改一下配置文件
vim /etc/zabbix_server.conf
#vim /usr/local/etc/zabbix_server.conf
FpingLocation=/usr/local/sbin/fping

启动zabbix,并且添加开机自启动

service zabbix_server start
service zabbix_agentd start #启动服务

chkconfig zabbix_server on
chkconfig zabbix_agentd on #开机自启动

在Nginx服务中添加zabbix虚拟主机
#vim /usr/local/nginx/conf/vhosts/monitor.conf

这些都不要,不然没有web安装向导的
#cd zabbix/conf
#cp zabbix.conf.php.example zabbix.conf.php ;
#chmod 777 zabbix.conf.php

iptables -I INPUT -p tcp –dport 80 -j ACCEPT

zabbix server is not running
Zabbix Server is not running: the information displayed may not be current
http://song49.blog.51cto.com/4480450/1200151

(4)设置zabbix服务IP和端口,name可以忽略

ps:
post_max_size = 16M
PHP option “max_execution_time” 30 300 Fail
PHP option “max_input_time” 60 300 Fail
PHP option “date.timezone” unknown Fai
date.timezone = Asia/Shanghai

PHP option “always_populate_raw_post_data” must be set to “-1”

port 10051

Zabbix frontend is ready! The default user name is Admin, password zabbix.

超级用户密码修改

2.2 用户名第一个字母要大写 也就是Admin
默认的用户名:admin 密码:zabbix

哪里改登录用户和密码呢
use zabbix;
select userid,alias,passwd from users; #查看

+--------+------------+----------------------------------+
| userid | alias      | passwd                           |
+--------+------------+----------------------------------+
|      1 | Admin      | 5fce1b3e34b520afeffb37ce08c7cd66 |


#如果为zabbix 3.0  直接这样就行了 
update users set passwd=MD5('12345') where userid=1;


#zabbix 2.x 
重新开个终端,生成一个MD5加密的密码,这里密码设置的是redhat

[root@localhost ~]# echo -n 12345678 |openssl md5 #-n就表示不输入回车符,不加-n,否则就不是这个结果了。
(stdin)= 25d55ad283aa400af464c76d713c07ad

接着上面的为admin用户设定一个密码

mysql> update users set passwd='25d55ad283aa400af464c76d713c07ad' where userid = '1';
#或者直接使用update users set passwd=md5(“12345678”) where userid=’1′;
Query OK, 1 row affected (0.01 sec)
Rows matched: 1 Changed: 1 Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

mysql> quit
Bye

zabbix登陆账户admin密码修改
http://pvbutler.blog.51cto.com/7662323/1734003

yum install ntp ntpdate -y
chkconfig ntpd on
/etc/init.d/ntpd start

*/30 * * * * /usr/sbin/ntpdate pool.ntp.org

在29行这后添加
sed -i ’29a user=mysql’ /etc/my.cnf
sed -i ’29a character-set-server=utf8′ /etc/my.cnf
sed -i ’29ainnodb_file_per_table=1′ /etc/my.cnf
重启mysqld

防火墙设置

这个要看一下先,尽量用严格些的防火墙设置

#on zabbix-agent

iptables -A INPUT -s zabbixserverip  -p tcp -m tcp --dport 10050 -m comment --comment "zabbix_server listen " -j ACCEPT 
#iptables -A INPUT -s zabbixserverip  -p tcp -m tcp --dport 10050 -m comment --comment "zabbix_agentd listen " -j ACCEPT 

#这下面的防火墙rule 不要用 
vi /etc/sysconfig/iptables
-A INPUT -m state –state NEW -m tcp -p tcp –dport 22 -j ACCEPT
-A INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT
-A INPUT -m state –state NEW -m tcp -p tcp –dport 10050 -j ACCEPT
-A INPUT -m state –state NEW -m tcp -p tcp –dport 10051 -j ACCEPT

/etc/init.d/iptables restart

中文在右上角的用户里面哦

Starting php_fpm /usr/local/php/bin/php-cgi: error while loading shared libraries: libiconv.so.2: cannot open shared object file: No such file or directory
failed

by default install the daemon binaries (zabbix_server, zabbix_agentd, zabbix_proxy) in /usr/local/sbin and the client binaries (zabbix_get, zabbix_sender) in /usr/local/bin.

4.0 5.2 图像显示字体乱码的解决方法


1.替换支持中文的字体
#传输字体
#50fbe46d4c5c        zabbix/zabbix-web-nginx-pgsql:alpine-5.2-latest
docker cp simkai.ttf 50fbe46d4c5c:/usr/share/zabbix/assets/fonts

 cp  /root/STKAITI.TTF  /usr/share/zabbix/assets/fonts
  
2.修改字体配置 php文件
 #修改 指定的字体 或者直接把你的家体改成和默认同名,而默认的那个先删除 连重启都不用 反正在docker
  grep  -rn  BX_GRAPH_FONT_NAM   /usr/share/zabbix/include/defines.inc.php
67:define('ZBX_GRAPH_FONT_NAME',		'DejaVuSans'); // font file name

修改
sed  -i  's!DejaVuSans!simkai!' include/defines.inc.php
define('ZBX_GRAPH_FONT_NAME',           'simkai');  

zabbix-get

root@zabbix-server ~]#zabbix_get  -s 10.3.10.139 -k "system.hostname"
dev-hello-market


不过使用zabbix_get时必须开启客户端被动模式,要求暴露客户端监听端口。

自动化监控--zabbix-get安装使用详解

第二 agent


#4.0 #centos7 快速安装和自动配置 2019年 8月23日 星期五 11时45分01秒 CST

#国外
rpm -ivh http://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm

#国内
https://mirrors.aliyun.com/zabbix/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm

手工直接添加  repo文件 ,如果有时 不小心 像上次删除了 reop文件 一样 ,搞半天 

cat <<EOF > /etc/yum.repos.d/zabbix.repo
[zabbix]
name=Zabbix Official Repository - \$basearch
baseurl=https://mirrors.aliyun.com/zabbix/zabbix/4.0/rhel/7/\$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
 
[zabbix-non-supported]
name=Zabbix Official Repository non-supported - \$basearch
baseurl=https://mirrors.aliyun.com/zabbix/non-supported/rhel/7/\$basearch/
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
gpgcheck=1
EOF

curl https://mirrors.aliyun.com/zabbix/RPM-GPG-KEY-ZABBIX-A14FE591 \
-o /etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
 
curl https://mirrors.aliyun.com/zabbix/RPM-GPG-KEY-ZABBIX \
-o /etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX



yum install zabbix-agent -y

yum install ntp  -y
timedatectl set-ntp true

HOSTNAME=prod-java-02

#config
sed -i "s/^Server=127.0.0.1/Server=172.16.1.9/ " /etc/zabbix/zabbix_agentd.conf

sed -i "s/^ServerActive=127.0.0.1/ServerActive=172.16.1.9/"  /etc/zabbix/zabbix_agentd.conf
sed  -i "s/^Hostname=Zabbix server/Hostname=test-market/"  /etc/zabbix/zabbix_agentd.conf



#这个用了HOSTNAME 变量  而上面的要指定hostname
sed  -i 's/127.0.0.1/23.67.81.95/g'  /etc/zabbix/zabbix_agentd.conf
sed  -i "s/Hostname=Zabbix server/Hostname=${HOSTNAME}/g"  /etc/zabbix/zabbix_agentd.conf
grep "^\s*[^# \t].*$" /etc/zabbix/zabbix_agentd.conf

systemctl  enable  zabbix-agent.service
systemctl restart zabbix-agent


下面是老的信息 和解说

cat /etc/zabbix/zabbix_agentd.conf
Hostname=主机名
Server=zabbix server ip
LogFile= 可以不改

##最好这样3个
Server=10.6.1.181
ServerActive=10.6.1.181
Hostname=zabbix-client-1


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


rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm

 

agent on debian

#用系统的源 
 apt-get install zabbix-agent


#config 其实和yum的也一样 只是启动不一样而已
HOSTNAME=wiki
sed -i "s/^Server=127.0.0.1/Server=207.148.106.229/ " /etc/zabbix/zabbix_agentd.conf

sed -i "s/^ServerActive=127.0.0.1/ServerActive=207.148.106.229/"  /etc/zabbix/zabbix_agentd.conf
sed  -i "s/^Hostname=Zabbix server/Hostname=wiki/"  /etc/zabbix/zabbix_agentd.conf

grep "^\s*[^# \t].*$" /etc/zabbix/zabbix_agentd.conf

service zabbix-agent start


 zabbix_get -s 138.68.59.0 -k "system.hostname"


#用zbx的源
  https://repo.zabbix.com/zabbix/4.0/debian/pool/main/z/zabbix-release/zabbix-release_4.0-3+buster_all.deb        
dpkg -i zabbix-release_stretch_all.deb
# apt-get update

https://www.zabbix.com/documentation/3.2/manual/installation/install_from_packages/repository_installation

https://www.zabbix.com/documentation/4.0/zh/manual/installation/install_from_packages/rhel_centos#%E5%AE%89%E8%A3%85_agent


国内zabbix源总结

https://www.cnblogs.com/caidingyu/p/11423089.html

https://blog.cactifans.com/2019/01/21/Zabbix%E5%9B%BD%E5%86%85%E6%BA%90%E4%BD%BF%E7%94%A8/

docker zabbix 5.0

用 Zabbix 和 Docker 搭建监控平台

我的没有 zabbix web ui 明天搞一下 暴露端口 8888 用于访问页面,10051 用于和 Zabbix-agent 通信;

Zabbix 5.0 LTS新功能

Usage

添加主机要添加 模板  不然 在监控--主机那 图形没东西 

https://www.zabbix.com/documentation/current/manual/quickstart/host

故障及回顾

问题1.  zabbix server 没有打开 10051端口 前端图形没显示 

版本zabbix 2.2 



没有看到 10051 是因为  

DBPassword=‘123’ 改为 DBPassword=123


日志查看 
 tail  /tmp/zabbix_server.log

14659:20170525:171042.257 [Z3001] connection to database 'zabbix' failed: [1045] Access denied for user 'zabbix'@'localhost' (using password: YES)


正确如下 
[root@ zabbix]# netstat  -nlpt 
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   
tcp        0      0 0.0.0.0:10051

经常报Zabbix agent on Zabbix server is unreachable for 5 minutes


我上次的处理是 重启 zbx server 就好了 

解决Zabbix使用一段时间后总报Zabbix Agent不可到达的问题

防火墙导致 zabbix监控大批量报警zabbix agent on **** unreachable for 5 minute

参考

Install Zabbix Monitoring Server and Agent on Debian

zabbix--5.0.2部署使用手册

zabbix 3.0使用教程

Zabbix 3.0 详解:从添加主机到发送报警通知

Zabbix监控系统 (3) 之 添加自定义监控项目、配置邮件告警、测试告警

http://blog.linuxchina.net/?p=1711

Zabbix 3.0 with apache安装笔记

【zabbix】自定义监控项key值


zabbix添加自定义py脚本