zabbix是一个基于WEB界面的提供分布式系统监视以及网络监视功能的企业级的开源解决方案。
zabbix server可以通过SNMP,zabbix agent,ping,端口监视等方法提供对远程服务器/网络状态的监视,数据收集等功能,它可以运行在Linux,Solaris,HP-UX,AIX,Free BSD,Open BSD,OS X等平台上。
定期的对被监控主机进行检查、信息收集等操作,当被监控主机出现异常时,能够及时报警、通知管理员,并且需要记录这些异常,以便我们分析这些数据,查漏补缺。
对主机可监控项包括:
CPU:CPU负载,CPU使用率
Memory:内存使用率,可交换内存/虚拟内存使用率
Network:网络传输、网络故障、丢包
Disk:磁盘使用率,磁盘I/O
Service:进程监控、界面服务、TCP端口连接,响应时间、DNS监控、NTP监控
Log:日志监控,文本日志,事件日志
File:文件监控
Other:性能计数器(仅限于Windows系统)
对于我来说,针对于web日志这块的功能还是挺失望的,
不能收集日志进行分析。
获得Zabbix的方法有四种:
-
为您的平台安装和配置Zabbix服务器
一个。安装Zabbix存储库
# rpm -Uvh https://repo.zabbix.com/zabbix/4.2/rhel/7/x86_64/zabbix-release-4.2-2.el7.noarch.rpm
# yum clean all -
安装Zabbix服务器,前端,代理
# yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent
-
创建初始数据库
# mysql -uroot -p
password
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'password';
mysql> quit; -
导入初始架构和数据。系统将提示您输入新创建的密码。
# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
-
为Zabbix服务器配置数据库
编辑文件/etc/zabbix/zabbix_server.conf
DBPassword=password
- 即 为Zabbix前端配置PHP
编辑文件/etc/httpd/conf.d/zabbix.conf,取消注释并为您设置正确的时区。# php_value date.timezone Europe/Riga
F。
Asia/Shanghai – 上海
7.启动Zabbix服务器和代理进程
启动Zabbix服务器和代理程序进程并使其在系统引导时启动:
# systemctl restart zabbix-server zabbix-agent httpd
# systemctl enable zabbix-server zabbix-agent httpd
现在您的Zabbix服务器已启动并运行!
8.配置Zabbix前端
连接到新安装的Zabbix前端:http:// server_ip_or_name /
zabbix按照Zabbix文档中描述的步骤操作: 安装前端
Installing frontend
Step 1
In your browser, open Zabbix URL: http://<server_ip_or_name>/zabbix
You should see the first screen of the frontend installation wizard.
Step 2
Make sure that all software prerequisites are met.
Pre-requisite | Minimum value | Description |
---|---|---|
PHP version | 5.4.0 | |
PHP memory_limit option | 128MB | In php.ini: memory_limit = 128M |
PHP post_max_size option | 16MB | In php.ini: post_max_size = 16M |
PHP upload_max_filesize option | 2MB | In php.ini: upload_max_filesize = 2M |
PHP max_execution_time option | 300 seconds (values 0 and -1 are allowed) | In php.ini: max_execution_time = 300 |
PHP max_input_time option | 300 seconds (values 0 and -1 are allowed) | In php.ini: max_input_time = 300 |
PHP session.auto_start option | must be disabled | In php.ini: session.auto_start = 0 |
Database support | One of: MySQL, Oracle, PostgreSQL, IBM DB2 | One of the following modules must be installed: mysql, oci8, pgsql, ibm_db2 |
bcmath | php-bcmath | |
mbstring | php-mbstring | |
PHP mbstring.func_overload option | must be disabled | In php.ini: mbstring.func_overload = 0 |
PHP always_populate_raw_post_data option | must be disabled | Required only for PHP versions 5.6.0 or newer. In php.ini: always_populate_raw_post_data = -1 |
sockets | php-net-socket. Required for user script support. | |
gd | 2.0.28 | php-gd. PHP GD extension must support PNG images (--with-png-dir), JPEG (--with-jpeg-dir) images and FreeType 2 (--with-freetype-dir). |
libxml | 2.6.15 | php-xml or php5-dom |
xmlwriter | php-xmlwriter | |
xmlreader | php-xmlreader | |
ctype | php-ctype | |
session | php-session | |
gettext | php-gettext Since Zabbix 2.2.1, the PHP gettext extension is not a mandatory requirement for installing Zabbix. If gettext is not installed, the frontend will work as usual, however, the translations will not be available. |
Optional pre-requisites may also be present in the list. A failed optional prerequisite is displayed in orange and has a Warning status. With a failed optional pre-requisite, the setup may continue.
If there is a need to change the Apache user or user group, permissions to the session folder must be verified. Otherwise Zabbix setup may be unable to continue.
Step 3
Enter details for connecting to the database. Zabbix database must already be created.
Step 4
Enter Zabbix server details.
Entering a name for Zabbix server is optional, however, if submitted, it will be displayed in the menu bar and page titles.
Step 5
Review a summary of settings.
Step 6
Download the configuration file and place it under conf/ in the webserver HTML documents subdirectory where you copied Zabbix PHP files to.
Providing the webserver user has write access to conf/ directory the configuration file would be saved automatically and it would be possible to proceed to the next step right away.
Step 7
Finish the installation.
Step 8
Zabbix frontend is ready! The default user name is Admin, password zabbix.
Proceed to getting started with Zabbix.
3 Installing Java gateway
It is required to install Java gateway only if you want to monitor JMX applications. Java gateway is lightweight and does not require a database.
To install from sources, first download and extract the source archive.
To compile Java gateway, run the ./configure
script with --enable-java
option. It is advisable that you specify the --prefix
option to request installation path other than the default /usr/local, because installing Java gateway will create a whole directory tree, not just a single executable.
$ ./configure --enable-java --prefix=$PREFIX
To compile and package Java gateway into a JAR file, run make
. Note that for this step you will need javac
and jar
executables in your path.
$ make
Now you have a zabbix-java-gateway-$VERSION.jar file in src/zabbix_java/bin. If you are comfortable with running Java gateway from src/zabbix_java in the distribution directory, then you can proceed to instructions for configuring and running Java gateway. Otherwise, make sure you have enough privileges and run make install
.
$ make install
Proceed to setup for more details on configuring and running Java gateway.
See also
要使用MySQL支持安装Zabbix代理:
<span style="color:#000000">#yum install zabbix-proxy-mysql</span>
要在 MySQL支持下安装Zabbix前端(适用于RHEL 7,在RHEL 6上弃用):
<span style="color:#000000">#yum install zabbix-web-mysql</span>
使用'pgsql'替换命令中的'mysql'以使用PostgreSQL,或使用'sqlite3'替换使用SQLite3(仅限代理)。
监控linux:
rpm -i https://repo.zabbix.com/zabbix/4.2/rhel/7/x86_64/zabbix-release-4.2-2.el7.noarch.rpm
yum install -y zabbix-agent zabbix-get
配置zabbix-agent$ vim /etc/zabbix/zabbix_agentd.conf # 修改agent配置文件
Server=192.168.2.205 # zabbix服务端内网IP
ServerActive=192.168.2.205 # zabbix服务端内网IP,Active表示agent主动推送
Hostname=Jump Server # zabbix客户端主机名称,需要和web端添加的名称一致
Include=/etc/zabbix/zabbix_agentd.d/*.conf
配置iptables$ vim /etc/sysconfig/iptables # 添加允许访问10050端口的策略
-A INPUT -s 192.168.2.205 -p tcp -m multiport --dports 10050 -j ACCEPT$ systemctl restart iptables.service # 重启iptables
Web端添加Linux主机
配置-主机-创建主机,按下图配置好后点击“更新”
监控win:
选择windows对应的版本下载
https://www.zabbix.com/cn/download_agents
例如:
https://www.zabbix.com/downloads/4.2.5/zabbix_agents-4.2.5-win-amd64.zip
解压zip,会看到bin和conf两个目录,进入到conf目录下,修改zabbix_agentd.win.conf配置文件。
LogFile=D:\zabbix_agents\log\zabbix_agentd.log
Server=192.168.2.205
ListenPort=10050
ServerActive=192.168.2.205
Hostname=Xuad Server
以管理员方式运行CMD,执行安装程序
bin\zabbix_agentd.exe -c conf\zabbix_agentd.win.conf -i #加载配置文件
bin\win64\zabbix_agentd.exe -c conf\zabbix_agentd.win.conf -s #添加windows自启动服务
#确认10050端口已监听
#卸载zabbix-agent服务
先停止服务,然后以管理员方式运行CMD,执行下面的命令
sc delete "Zabbix Agent"
防火墙开放10050端口
以管理员方式运行CMD,执行下面命令,添加开放10050端口策略。netsh advfirewall firewall add rule name="Zabbix_Agent_tcp" dir=in protocol=tcp localport=10050 remoteip=192.168.2.205 action=allow
注:remoteip=192.168.2.205表示只允许192.168.2.205访问10050端口,此为zabbix-server的IP。
web端添加windows主机
参考:
CentOS 7安装部署zabbix3.4
https://blog.51cto.com/andyxu/2120362
Download and install Zabbix
https://www.zabbix.com/download?zabbix=4.2&os_distribution=centos&os_version=7&db=mysql
Zabbix Documentation 4.2 Getting Zabbix
https://www.zabbix.com/documentation/4.2/manual/installation/getting_zabbix
Red Hat Enterprise Linux/CentOS
https://www.zabbix.com/documentation/4.2/manual/installation/install_from_packages/rhel_centos
从MSI安装Windows代理
https://www.zabbix.com/documentation/4.2/manual/installation/install_from_packages/win_msi
zabbix从放弃到入门(1):zabbix概念
http://www.zsythink.net/archives/447/
Zabbix功能概述及架构介绍(理论篇)
https://blog.51cto.com/afterdawn/1922502
历数 Zabbix 优缺点,第一手的应用感受
http://www.sohu.com/a/147038486_151779