Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

51.zabbix monitoring tool

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

Zabbix3.2 monitoring tool

Zabbix is an enterprise-level open source tool for distributed system monitoring and network monitoring based on the WEB interface.

Zabbix can monitor various network parameters, ensure the safe operation of the server system, and provide a flexible notification mechanism for administrators to quickly locate / solve various problems.

Zabbix consists of three parts: Zabbix_Server server, Zabbix_Agent client and Zabbix_proxy proxy.

Zabbix_Server: monitoring the status of remote servers / networks can be provided through methods such as SNMP,Zabbix_Agent,Ping,SNMP.

Zabbix_Agent: it is used to collect client server data and give it to Zabbix_Server for processing.

Zabbix_Proxy: cache synchronization server monitoring data.

The main functions of Zabbix: CPU load, memory usage, disk usage, network condition, port monitoring, log monitoring.

Monitoring architecture of Zabbix:

Zabbix deployment steps:

Environmental requirements: it must be supported by LNMP/LAMP environment and above version of PHP5.4.

# systemctl stop firewalld # turn off firewalld Firewall

# systemctl disable firewalld.service # disable self-startup of firewalld service

# sed-I-e's | SELINUX=enforcing | SELINUX=disabled |'/ etc/selinux/config # disable SELINUX

# sed-I-e's | SELINUXTYPE=targeted | # SELINUXTYPE=targeted |'/ etc/selinux/config

# setenforce 0

Source code compilation method:

V install related dependent components

# yum-y install php php-gd php-mysql php-bcmath php-mbstring php-xml curl curl-devel gcc gcc-c++ net-snmp net-snmp-devel perl-DBI httpd mariadb* # YUM deploy LAMP environment

V unpack the installation package

# tar xzvf zabbix-3.2.1.tar.gz

# cd zabbix-3.2.1

V compile and install Zabbix

Install Server and Agent, and support putting data into the MYSQL database:

#. / configure-prefix=/usr/local/zabbix-enable-server-enable-agent-with-mysql-enable-ipv6-with-net-snmp-with-libcurl

Install only Server and support putting data into the MYSQL database:

#. / configure-prefix=/usr/local/zabbix-enable-server-with-mysql-with-net-snmp-with-libcurl

Install only the Proxy agent and support putting data into the MYSQL database:

#. / configure-prefix=/usr/local/zabbix-enable-proxy-with-net-snmp-with-mysql-with-ssh3

Install only the Agent client:

#. / configure-enable-agent

# make & & make install

Note:-- with-libcurl: monitor WEB page response time and download speed.

V authorize Zabbix database users

# systemctl start mariadb # start MYSQL

# mysqladmin-u root password 123 # set database ROOT user password

# mysql-u root-p123 # Log in to database

Mysql > create database zabbix character set UTF8; # create the zabbix database and specify the encoding as UTF8

Mysql > grant all on zabbix.* to 'zabbix'@'localhost' identified by' 123' with grant option

Mysql > flush privileges; # authorizing zabbix users and Refresh Authorization

Mysql > exit

V import the SQL file that comes with Zabbix into the database

# mysql-u zabbix-p123 zabbix

< database/mysql/schema.sql #按顺序导入 # mysql -u zabbix -p123 zabbix < database/mysql/p_w_picpaths.sql # mysql -u zabbix -p123 zabbix < database/mysql/data.sql v 将Zabbix自带的PHP页面放入Nginx网页根目录 # cp -r frontends/php /var/www/html/zabbix # chmod 777 /var/www/html/zabbix/conf v 将Zabbix添加到服务 # cp -r misc/init.d/fedora/core/* /etc/init.d/ # sed -i -e 's|BASEDIR=/usr/local|BASEDIR=/usr/local/zabbix|' /etc/init.d/zabbix_server # sed -i -e 's|BASEDIR=/usr/local|BASEDIR=/usr/local/zabbix|' /etc/init.d/zabbix_agentd v 修改Zabbix_server配置文件 # sed -i -e 's|# DBPassword=|DBPassword=123|' /usr/local/zabbix/etc/zabbix_server.conf # sed -i -e 's|# DBSocket=/tmp/mysql.sock|DBSocket=/var/lib/mysql/mysql.sock|' /usr/local/zabbix/etc/zabbix_server.conf Zabbix_server配置文件解析 LogFile=/tmp/zabbix_server.log 日志所在位置 LogFileSize=1 日志大小 PidFile=/tmp/zabbix_server.pid PID进程文件所在位置 DBHost 数据库主机地址 DBName 数据库名 DBUser 数据库连接用户名 DBPassword 数据库连接用户密码 DBSocket 数据库缓存文件位置 DBPort 数据库端口 StartPollers Zabbix_server进程数 StartIPMIPollers IPMI线程数(IPMI平台管理接口) StartPollersUnreachable 该线程用来单独监控无法连接的主机 StartTrapper 检测主机的线程数 StartPingers PING主机方式启动的线程数 StartDiscoverers 发现主机的线程数 StartDBSyncers 将数据同步到数据库的线程数 Timeout Zabbix_server的检测超时时间 v 修改PHP配置 # sed -i -e 's|post_max_size = 8M|post_max_size = 16M|' /etc/php.ini # sed -i -e 's|max_execution_time = 30|max_execution_time = 300|' /etc/php.ini # sed -i -e 's|max_input_time = 60|max_input_time = 300|' /etc/php.ini # sed -i -e 's|;date.timezone =|date.timezone = PRC|' /etc/php.ini post_max_size 上传最大文件大小 date.timezone 时区设置(PRC代表中国) max_execution_time 运行超时时间(秒) request_terminate_timeout 需求结束超时时间(秒) max_input_time 接受数据时间限制(秒) v 创建运行用户 # useradd zabbix v 启动服务 # service start zabbix_server # systemctl start zabbix_agentd # systemctl start httpd # netstat -lnupt |grep 80 # ps aux |grep zabbix v 通过网页验证访问 Http://localhost/zabbix 被监控主机配置 v 环境需求:关闭防火墙,SELinux # systemctl stop firewalld # setenforce 0 # iptables -F # yum -y install gcc gcc-c++ v 解压zabbix包 # tar xzvf zabbix-3.2.1.tar.gz # cd zabbix-3.2.1 v 编译安装 # ./configure --prefix=/usr/local/zabbix --enable-agent # make && make install v 创建运行用户 # useradd zabbix # echo 123 | passwd zabbix --stdin v 添加到服务 # cp -r misc/init.d/fedora/core/* /etc/init.d/ # sed -i -e 's|BASEDIR=/usr/local|BASEDIR=/usr/local/zabbix|' /etc/init.d/zabbix_agentd v 修改Zabbix_agentd配置文件 # sed -i -e 's|Server=127.0.0.1|Server=1.1.1.19|' /usr/local/zabbix/etc/zabbix_agentd.conf # sed -i -e 's|ServerActive=127.0.0.1|ServerActive=1.1.1.19|' /usr/local/zabbix/etc/zabbix_agentd.conf # sed -i -e 's|# Hostname=|Hostname=1.1.1.20|' /usr/local/zabbix/etc/zabbix_agentd.conf Zabbix_agentd配置文件解析 UnsafeUserParameters 启动自定义KEY EnableRemoteCommands 开启远程命令 ListenPort 监听端口 StartAgents Agent线程数 Server 被动模式指定服务端地址 ServerActive 主动模式指定服务器地址 Hostname 主机名 v 启动服务 # service zabbix_agentd restart # netstat -lnupt |grep 10050 YUM安装方式: 环境需求:需要连接网络,关闭防火墙,SELinux # systemctl stop firewalld #关闭防火墙 # setenforce 0 v 安装Zabbix的YUM库 # rpm -ivh zabbix-release-3.2-1.el7.noarch.rpm # yum makecache #重新生成缓存 v 安装相关依赖组件 # yum -y install php php-gd php-mysql php-bcmath php-mbstring php-xml curl curl-devel net-snmp net-snmp-devel perl-DBI httpd mariadb* #YUM部署LAMP环境 v 安装Zabbix_server # yum -y install zabbix-server-mysql zabbix-web-mysql v 授权MYSQL数据库 # systemctl start mariadb #启动数据库 # mysqladmin -u root password 123 # mysql -u root -p123 >

Create database zabbix character set UTF8

> grant all on zabbix.* to 'zabbix'@'localhost' identified by' 123' with grant option

> flush privileges

> exit

V Import Zabbix database file

# mysql-u zabbix-p123 zabbix

< schema.sql # mysql -u zabbix -p123 zabbix < p_w_picpaths.sql # mysql -u zabbix -p123 zabbix < data.sql v 修改配置文件 # sed -i -e 's|# DBPassword=|DBPassword=123|' /etc/zabbix/zabbix_server.conf # sed -i -e 's|# DBSocket=/tmp/mysql.sock|DBSocket=/var/lib/mysql/mysql.sock|' /usr/local/zabbix/etc/zabbix_server.conf # sed -i -e 's|;date.timezone =|date.timezone = PRC|' /etc/php.ini v 启动服务 # zabbix_server # systemctl start httpd v 通过网页验证访问 Http://localhost/zabbix 被监控端安装配置 v 环境需求:关闭防火墙,SELinux # systemctl stop firewalld # setenforce 0 v 安装Zabbix_agentd服务 # rpm -ivh zabbix-release-3.2-1.el7.noarch.rpm # yum makecache # yum -y install zabbix-agent v 修改Zabbix_agentd配置文件 # sed -i -e 's|Server=127.0.0.1|Server=1.1.1.19|' /usr/local/zabbix/etc/zabbix_agentd.conf # sed -i -e 's|ServerActive=127.0.0.1|ServerActive=1.1.1.19|' /usr/local/zabbix/etc/zabbix_agentd.conf # sed -i -e 's|# Hostname=|Hostname=1.1.1.20|' /usr/local/zabbix/etc/zabbix_agentd.conf v 启动Zabbix_agentd服务 # zabbix_agentd # netstat -lnupt |grep zabbix WEB配置图片导航:

Installation troubleshooting

Failure 1: MYSQL database version is too high; solution: reinstall suitable MYSQL database

Note: Current database version: current version Required mandatory version: mandatory version number

Fault 2: user authorization problem; solution: re-authorize Zabbix database users

Fault 3: database problem solution: re-import the corresponding database of Zabbix

Fault 4: the solution to the problem of too many server processes: set the parameters related to the configuration file to control the process

Note: Too many processes on Zabbix server: there are too many processes in the Zabbix server

Failure 5: low number of threads when Zabbix_server starts resulting in polling load workaround: StartPollers is set to 5 or 10

Fault 6: Zabbix_server is running but prompt is not running solution: turn off SELinux

Failure 7: database password error solution: modify the configuration file zabbix.conf.php

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report