zabbix服务器端没监控10051端口,怎么解决
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了zabbix服务器端没监控10051端口,怎么解决相关的知识,希望对你有一定的参考价值。
参考技术A Zabbix Server需要运行在CentOS、RedHat Linux、Debain等Linux系统上,这里以RHEL AS5作为部署环境。root用户安装必须的包,建议配置好yum,通过yum安装下列包,解决包的依赖关系。其他需要用到的包:yumel下载最新的Zabbix安装包
1、启动mysql数据库:
#mysqladmin –测试能否正常登陆数据库–proot
create database zabbix character set utf8;
# cat ./create/data/data.sql |mysql -uroot -proot zabbix
# ./--enable-proxy --prefix=/usr/local/zabbix
2、配置文件及web前端文件修改
zabbix-agent 10050/tcp # Zabbix Agent
zabbix-trapper 10051/udp # Zabbix Trapper
# chown -R zabbix:zabbix /etc/zabbix
# vi /etc/zabbix/zabbix_server.conf
3、添加web前端php文件cd frontends/
# #
修改php相关参数vi /etc/php.ini 找到如下几项,改成下面的值,前面有;号的要删掉
post_max_size = 32M
4、重启apache
按提示一步步next,其中Step 3
5、配置完成后,出现登陆界面,默认的用户为:admin,密码为:zabbix
#/usr/local/zabbix/sbin/zabbix_server
# 修改配置目录,将如下两个文件中的 ,# vi /etc/init.d/zabbix_server_ctl
# # <span courier="" new';="" font-size:="" 9pt;="" mso-spacerun:="" 'yes'"="" style="padding: 0px; margin: 0px;">echo '/etc/init.d/zabbix_
##启动Server和Agentd(可以通过start stop restart来操作) zabbix_agentd_ctl start zabbix_
#ps
vi /etc/ld.so.conf
至此Zabbix Server的安装已完成。
监控服务zabbix部署
Zabbix是什么?
‘zabbix‘是基于web界面的提供分布式系统监视以及网络监视功能的企业级的开源解决方案。
‘zabbix能监视各种网络参数,保证服务器系统的安全运营;并提供灵活的通知机制让系统管理员快速定位并解决问题‘
Zabbix组成
1.zabbix server
通过SNMP、zabbix agent 、ping,
端口监视等方法提供对远程服务器/网络状态的监视,数据收集等功能
运行在linuxUbuntuSolarisHP-UXAIXFree BSDOpen BSDOS X等平台。
‘与zabbix agent 配合,可以轮询zabbix agent 主动接收监视数据(agent方式),
也可以被动接收zabbix agent 发送的数据(trapping方式)。
支持SNMP(v1,v2)‘
2.zabbix agent
安装在被监视的目标服务器上,主要完成对硬件信息或与操作系统有关的内存,CPU等信息的收集。
zabbix特点
安装与配置简单,学习成本低
免费开源
自动发现服务器与网络设备
支持多语言(包括中文)
分布式监视以及web集中管理功能
email等通知功能
用户安全认证和柔软的授权方式
zabbix配置文件
服务器配置文件(/usr/local/etc/zabbix_server.conf)
客户端配置文件(/usr/local/etc/zabbix_agentd.conf)
zabbix代理配置文件(/usr/local/etc/zabbix_proxy.conf)
zabbix服务端安装
‘安装依赖包‘
[[email protected] ~]# yum -y install net-snmp-devel libevent-devel
‘下载zabbix‘
[[email protected] src]# cd /usr/src/
[[email protected] src]# wget https://nchc.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/3.4.12/zabbix-3.4.12.tar.gz
‘解压‘
[[email protected] src]# tar xf zabbix-3.4.12.tar.gz
‘创建zabbix用户和组‘
[[email protected] src]# groupadd -r zabbix
[[email protected] src]# useradd -r -g zabbix -M -s /sbin/nologin zabbix
‘配置zabbix数据库‘
[[email protected] src]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 3
Server version: 5.7.22 MySQL Community Server (GPL)
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type ‘help;‘ or ‘h‘ for help. Type ‘c‘ to clear the current input statement.
mysql>
mysql> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.08 sec) ‘创建zabbix并支持中文‘
mysql> show databases; (查看存在哪些数据库)
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
| zabbix |
+--------------------+
5 rows in set (0.11 sec)
mysql> grant all privileges on zabbix.* to [email protected] identified by ‘zabbix123!‘; ‘授权zabbix用户在数据库本机上登录访问所有数据库‘
Query OK, 0 rows affected, 2 warnings (0.11 sec)
mysql> grant all privileges on zabbix.* to [email protected] identified by ‘zabbix123!‘;
Query OK, 0 rows affected, 1 warning (0.04 sec)
‘注意:mysql服务进程启动时会读取mysql库中的所有授权表至内存中:
1.grant 或revoke等执行权限操作会保存与表中,mysql的服务进程会自动重读授权表,并更新至内存中
2.对于不能够或不能及时重读授权表的命令,可手动让mysql的服务进程重读授权表‘
mysql> flush privileges;
Query OK, 0 rows affected (0.16 sec)
mysql> exit
Bye
[[email protected] ~]# cd /usr/src/zabbix-3.4.12/database/mysql/
[[email protected] mysql]# ls
data.sql images.sql schema.sql
[[email protected] mysql]# mysql -uzabbix -pzabbix123! zabbix <schema.sql
mysql: [Warning] Using a password on the command line interface can be insecure.
[[email protected] mysql]# mysql -uzabbix -pzabbix123! zabbix < images.sql
mysql: [Warning] Using a password on the command line interface can be insecure.
[[email protected] mysql]# mysql -uzabbix -pzabbix123! zabbix < data.sql
mysql: [Warning] Using a password on the command line interface can be insecure.
‘编译安装zabbix‘
[email protected] mysql]# cd /usr/src/zabbix-3.4.12/
[[email protected] zabbix-3.4.12]# ./configure --enable-server > --enable-agent > --with-mysql > --with-net-snmp > --with-libcurl > --with-libxml2
[[email protected] zabbix-3.4.12]# make install
zabbix服务端配置
[[email protected] ~]# ls /usr/local/etc/
zabbix_agentd.conf zabbix_server.conf
zabbix_agentd.conf.d zabbix_server.conf.d
[[email protected] ~]# vim /usr/local/etc/zabbix_server.conf
‘搜索/DBPassword‘
### Option: DBPassword
# Database password. Ignored for SQLite.
# Comment this line if no password is used.
#
# Mandatory: no
# Default:
# DBPassword=
DBPassword=zabbix123! ‘设置zabbix数据库连接密码‘
‘启动zabbix_server和zabbix_agentd‘
[[email protected] ~]# zabbix_server
[[email protected] ~]# zabbix_agentd
[[email protected] ~]# ss -antl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 *:22 *:*
LISTEN 0 100 127.0.0.1:25 *:*
LISTEN 0 128 *:10050 *:*
LISTEN 0 128 *:10051 *:*
LISTEN 0 128 127.0.0.1:9000 *:*
LISTEN 0 128 :::80 :::*
LISTEN 0 128 :::22 :::*
LISTEN 0 100 ::1:25 :::*
LISTEN 0 80 :::3306 :::*
zabbix服务端web界面安装与配置
‘修改/etc/php.ini的配置并重启php-fpm‘
[[email protected] ~]# sed -ri ‘s/(post_max_size =).*/1 16M/g‘ /etc/php.ini
[[email protected] ~]# sed -ri ‘s/(max_execution_time =).*/1 300/g‘ /etc/php.ini
[[email protected] ~]# sed -ri ‘s/(max_input_time =).*/1 300/g‘ /etc/php.ini
[[email protected] ~]# sed -i ‘/;date.timezone/a date.timezone = Asia/Shanghai‘ /etc/php.ini
[[email protected] ~]# service php-fpm restart
Gracefully shutting down php-fpm . done
Starting php-fpm done
[[email protected] ~]# cd /usr/src/zabbix-3.4.12/
[[email protected] zabbix-3.4.12]# ls
aclocal.m4 configure Makefile.am
AUTHORS configure.ac Makefile.in
bin COPYING man
build database misc
ChangeLog depcomp missing
compile frontends NEWS
conf include README
config.guess INSTALL sass
config.log install-sh src
config.status m4 upgrades
config.sub Makefile
[[email protected] zabbix-3.4.12]# mkdir /usr/local/apache/htdocs/zabbix
[[email protected] zabbix-3.4.12]# cp -a frontends/php/* /usr/local/apache/htdocs/zabbix/
[[email protected] zabbix-3.4.12]# chown -R apache.apache /usr/local/apache/htdocs/
‘配置apache虚拟主机,在/etc/httpd24/httpd.conf的配置文件的末尾添加如下内容:‘
<VirtualHost *:80>
DocumentRoot "/usr/local/apache/htdocs/zabbix"
ServerName www.yaoxiaorong.com
ProxyRequests off
ProxyPassMatch ^/(.*.php)$ fcgi://127.0.0.1:9000/usr/local/apache/htdocs/zabbix/$1
<Directory "/usr/local/apache/htdocs/zabbix">
Options none
AllowOverride none
Require all granted
</Directory>
</VirtualHost>
‘设置zabbix/conf目录的权限,让zabbix有权限生成配置文件zabbix.conf.php‘
[[email protected] ~]# chmod 777 /usr/local/apache/htdocs/zabbix/conf
[[email protected] ~]# ll -d /usr/local/apache/htdocs/zabbix/conf
drwxrwxrwx. 2 apache apache 81 Jul 30 19:41 /usr/local/apache/htdocs/zabbix/conf
‘重启apache‘
[[email protected] ~]# apachectl -t
Syntax OK
[[email protected] ~]# apachectl stop
[[email protected] ~]# apachectl start
[[email protected] ~]# ss -antl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 *:80 *:*
LISTEN 0 128 *:22 *:*
LISTEN 0 100 127.0.0.1:25 *:*
LISTEN 0 128 *:10050 *:*
LISTEN 0 128 *:10051 *:*
LISTEN 0 128 127.0.0.1:9000 *:*
LISTEN 0 128 :::22 :::*
LISTEN 0 100 ::1:25 :::*
LISTEN 0 80 :::3306 :::*
安装zabbix web界面
‘修改/etc/hosts文件,添加域名与IP的映射(windows在
C:WindowsSystem32driversetc下的hosts文件)
在浏览器上访问域名,本文设置的域名为www.yaoxiaorong.com,你也可以修改成你自己想命名的域名
恢复zabbix/conf目录的权限为755‘
在浏览器上访问域名进行安装:
如图一:
然后一直下一步下一步,直到出现如下的内容,然后输入密码
直到出现这个步骤,输入用户名和密码(用户是admin,密码是zabbix)
最后成功的界面
以上是关于zabbix服务器端没监控10051端口,怎么解决的主要内容,如果未能解决你的问题,请参考以下文章