安装部署6.0版本

获取仓库

https://www.zabbix.com/cn/download?zabbix=6.0&os_distribution=centos&os_version=7&components=agent&db=&ws=

选择之后,往下看

安装仓库

安装服务端

安装仓库:

[root@mcw03 ~]# rpm -Uvh https://repo.zabbix.com/zabbix/6.0/rhel/7/x86_64/zabbix-release-6.0-4.el7.noarch.rpm
Retrieving https://repo.zabbix.com/zabbix/6.0/rhel/7/x86_64/zabbix-release-6.0-4.el7.noarch.rpm
warning: /var/tmp/rpm-tmp.H9PWLw: Header V4 RSA/SHA512 Signature, key ID a14fe591: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:zabbix-release-6.0-4.el7 ################################# [100%]
[root@mcw03 ~]# yum clean all
Loaded plugins: fastestmirror
Cleaning repos: base epel extras glusterfs salt-3004-repo updates zabbix zabbix-agent2-plugins zabbix-non-supported
Cleaning up everything
Maybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed repos
Cleaning up list of fastest mirrors
[root@mcw03 ~]#

查看相关包

[root@mcw03 ~]# yum list all|grep zabbix|grep ser
zabbix40-server.noarch 4.0.39-1.el7 epel
zabbix40-server-mysql.x86_64 4.0.39-1.el7 epel
zabbix40-server-pgsql.x86_64 4.0.39-1.el7 epel
zabbix50-server.noarch 5.0.36-1.el7 epel
zabbix50-server-mysql.x86_64 5.0.36-1.el7 epel
zabbix50-server-pgsql.x86_64 5.0.36-1.el7 epel
zabbix6.0-server.noarch 6.0.25-1.el7 epel
zabbix6.0-server-mysql.x86_64 6.0.25-1.el7 epel
zabbix6.0-server-pgsql.x86_64 6.0.25-1.el7 epel
[root@mcw03 ~]#
[root@mcw03 ~]# yum list all|grep zabbix|grep web
zabbix40-web.noarch 4.0.39-1.el7 epel
zabbix40-web-mysql.noarch 4.0.39-1.el7 epel
zabbix40-web-pgsql.noarch 4.0.39-1.el7 epel
zabbix6.0-web.noarch 6.0.25-1.el7 epel
zabbix6.0-web-mysql.noarch 6.0.25-1.el7 epel
zabbix6.0-web-pgsql.noarch 6.0.25-1.el7 epel
[root@mcw03 ~]#

执行,需要安装的包,不装这个,zabbix6.0-server.noarch,后面那个才是对的zabbix-release

[root@mcw03 ~]# yum install zabbix6.0-server.noarch zabbix6.0-server-mysql zabbix6.0-web-mysql zabbix-agent zabbix-get  -y

安装zabbix-get的时候,好像重复了

Transaction check error:
file /usr/bin/zabbix_get from install of zabbix-get-6.0.25-release1.el7.x86_64 conflicts with file from package zabbix6.0-6.0.25-1.el7.x86_64 Error Summary
------------- [root@mcw03 ~]# zabbix_get
usage:
zabbix_get -s host-name-or-IP [-p port-number] [-I IP-address] [-t timeout]
-k item-key
zabbix_get -s host-name-or-IP [-p port-number] [-I IP-address] [-t timeout]
--tls-connect cert --tls-ca-file CA-file
[--tls-crl-file CRL-file] [--tls-agent-cert-issuer cert-issuer]
[--tls-agent-cert-subject cert-subject]
--tls-cert-file cert-file --tls-key-file key-file
[--tls-cipher13 cipher-string] [--tls-cipher cipher-string]
-k item-key
zabbix_get -s host-name-or-IP [-p port-number] [-I IP-address] [-t timeout]
--tls-connect psk --tls-psk-identity PSK-identity
--tls-psk-file PSK-file [--tls-cipher13 cipher-string]
[--tls-cipher cipher-string] -k item-key
zabbix_get -h
zabbix_get -V
[root@mcw03 ~]#

后面初始化数据库的时候,没有看到sql文件,所以重新按照这个来操作 下

https://repo.zabbix.com/zabbix/6.0/rhel/7/x86_64/

不用用上面的,直接yum安装也行,装这个。我们也可以上面方式获取rpm链接 ,然后rpm -iv http://..,.rpm包安装

[root@mcw03 doc]# yum list all|grep zabbix|grep zabbix-release
zabbix-release.noarch 6.0-4.el7 installed
[root@mcw03 doc]#

不过好像已经装上了啊

[root@mcw03 doc]# yum install zabbix-release -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
Package zabbix-release-6.0-4.el7.noarch already installed and latest version
Nothing to do
[root@mcw03 doc]#

安装MySQL

[root@mcw03 ~]# yum install -y mariadb-server

启动

systemctl restart mariadb
systemctl enable mariadb

配置文件

[root@mcw03 ~]# cat /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd [mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid #
# include all files from the config directory
#
!includedir /etc/my.cnf.d [root@mcw03 ~]# ls /etc/my.cnf.d/
client.cnf mysql-clients.cnf server.cnf
[root@mcw03 ~]#

也可以设置字符集,设置每个表文件单独存储,设置是MySQL用户

查看目前的数据库用户

[root@mcw03 ~]# mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 6
Server version: 5.5.68-MariaDB MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.00 sec) MariaDB [(none)]>
MariaDB [(none)]> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A Database changed
MariaDB [mysql]> show tables;
+---------------------------+
| Tables_in_mysql |
+---------------------------+
| columns_priv |
| db |
| event |
| func |
| general_log |
| help_category |
| help_keyword |
| help_relation |
| help_topic |
| host |
| ndb_binlog_index |
| plugin |
| proc |
| procs_priv |
| proxies_priv |
| servers |
| slow_log |
| tables_priv |
| time_zone |
| time_zone_leap_second |
| time_zone_name |
| time_zone_transition |
| time_zone_transition_type |
| user |
+---------------------------+
24 rows in set (0.00 sec) MariaDB [mysql]> desc user;
+------------------------+-----------------------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------------------+-----------------------------------+------+-----+---------+-------+
| Host | char(60) | NO | PRI | | |
| User | char(16) | NO | PRI | | |
| Password | char(41) | NO | | | |
| Select_priv | enum('N','Y') | NO | | N | |
| Insert_priv | enum('N','Y') | NO | | N | |
| Update_priv | enum('N','Y') | NO | | N | |
| Delete_priv | enum('N','Y') | NO | | N | |
| Create_priv | enum('N','Y') | NO | | N | |
| Drop_priv | enum('N','Y') | NO | | N | |
| Reload_priv | enum('N','Y') | NO | | N | |
| Shutdown_priv | enum('N','Y') | NO | | N | |
| Process_priv | enum('N','Y') | NO | | N | |
| File_priv | enum('N','Y') | NO | | N | |
| Grant_priv | enum('N','Y') | NO | | N | |
| References_priv | enum('N','Y') | NO | | N | |
| Index_priv | enum('N','Y') | NO | | N | |
| Alter_priv | enum('N','Y') | NO | | N | |
| Show_db_priv | enum('N','Y') | NO | | N | |
| Super_priv | enum('N','Y') | NO | | N | |
| Create_tmp_table_priv | enum('N','Y') | NO | | N | |
| Lock_tables_priv | enum('N','Y') | NO | | N | |
| Execute_priv | enum('N','Y') | NO | | N | |
| Repl_slave_priv | enum('N','Y') | NO | | N | |
| Repl_client_priv | enum('N','Y') | NO | | N | |
| Create_view_priv | enum('N','Y') | NO | | N | |
| Show_view_priv | enum('N','Y') | NO | | N | |
| Create_routine_priv | enum('N','Y') | NO | | N | |
| Alter_routine_priv | enum('N','Y') | NO | | N | |
| Create_user_priv | enum('N','Y') | NO | | N | |
| Event_priv | enum('N','Y') | NO | | N | |
| Trigger_priv | enum('N','Y') | NO | | N | |
| Create_tablespace_priv | enum('N','Y') | NO | | N | |
| ssl_type | enum('','ANY','X509','SPECIFIED') | NO | | | |
| ssl_cipher | blob | NO | | NULL | |
| x509_issuer | blob | NO | | NULL | |
| x509_subject | blob | NO | | NULL | |
| max_questions | int(11) unsigned | NO | | 0 | |
| max_updates | int(11) unsigned | NO | | 0 | |
| max_connections | int(11) unsigned | NO | | 0 | |
| max_user_connections | int(11) | NO | | 0 | |
| plugin | char(64) | NO | | | |
| authentication_string | text | NO | | NULL | |
+------------------------+-----------------------------------+------+-----+---------+-------+
42 rows in set (0.02 sec) MariaDB [mysql]> select User,Host from user;
+---------------+-----------+
| User | Host |
+---------------+-----------+
| root | 127.0.0.1 |
| root | ::1 |
| | localhost |
| mysql_monitor | localhost |
| root | localhost |
| | mcw03 |
| root | mcw03 |
+---------------+-----------+
7 rows in set (0.00 sec) MariaDB [mysql]>

1、创建zabbix数据库

[root@mcw03 ~]# mysqladmin -uroot password 123456
[root@mcw03 ~]# mysql -uroot -p123456
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 8
Server version: 5.5.68-MariaDB MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> create database zabbix character set utf8;
Query OK, 1 row affected (0.02 sec) MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@'localhost' identified by 'zabbix';
Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@'127.0.0.1' identified by 'zabbix';
Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> \q
Bye
[root@mcw03 ~]#

2、导入zabbix库的数据文件

找了半天,在这里

[root@mcw03 ~]# ls /usr/share/zabbix-mysql
data.sql double.sql history_pk_prepare.sql images.sql schema.sql
[root@mcw03 ~]#
data.sql  模板 images.sql 图片  schema.sql 表结构

如果是gz压缩,需要解压 gunzip create.sql.gz

zabbix用户进入

[root@mcw03 ~]# mysql -uzabbix -pzabbix -h127.0.0.1
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 9
Server version: 5.5.68-MariaDB MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> show database;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'database' at line 1
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| test |
| zabbix |
+--------------------+
3 rows in set (0.00 sec) MariaDB [(none)]> use zabbix;
Database changed
MariaDB [zabbix]> source /usr/share/zabbix-mysql/schema.sql
MariaDB [zabbix]> source /usr/share/zabbix-mysql/image.sql
MariaDB [zabbix]> source /usr/share/zabbix-mysql/data.sql

初始化后的数据表

MariaDB [zabbix]> show tables;
+----------------------------+
| Tables_in_zabbix |
+----------------------------+
| acknowledges |
| actions |
| alerts |
| auditlog |
| autoreg_host |
| conditions |
| config |
| config_autoreg_tls |
| corr_condition |
| corr_condition_group |
| corr_condition_tag |
| corr_condition_tagpair |
| corr_condition_tagvalue |
| corr_operation |
| correlation |
| dashboard |
| dashboard_page |
| dashboard_user |
| dashboard_usrgrp |
| dbversion |
| dchecks |
| dhosts |
| drules |
| dservices |
| escalations |
| event_recovery |
| event_suppress |
| event_tag |
| events |
| expressions |
| functions |
| globalmacro |
| globalvars |
| graph_discovery |
| graph_theme |
| graphs |
| graphs_items |
| group_discovery |
| group_prototype |
| ha_node |
| history |
| history_log |
| history_str |
| history_text |
| history_uint |
| host_discovery |
| host_inventory |
| host_tag |
| hostmacro |
| hosts |
| hosts_groups |
| hosts_templates |
| housekeeper |
| hstgrp |
| httpstep |
| httpstep_field |
| httpstepitem |
| httptest |
| httptest_field |
| httptest_tag |
| httptestitem |
| icon_map |
| icon_mapping |
| ids |
| images |
| interface |
| interface_discovery |
| interface_snmp |
| item_condition |
| item_discovery |
| item_parameter |
| item_preproc |
| item_rtdata |
| item_tag |
| items |
| lld_macro_path |
| lld_override |
| lld_override_condition |
| lld_override_opdiscover |
| lld_override_operation |
| lld_override_ophistory |
| lld_override_opinventory |
| lld_override_opperiod |
| lld_override_opseverity |
| lld_override_opstatus |
| lld_override_optag |
| lld_override_optemplate |
| lld_override_optrends |
| maintenance_tag |
| maintenances |
| maintenances_groups |
| maintenances_hosts |
| maintenances_windows |
| media |
| media_type |
| media_type_message |
| media_type_param |
| module |
| opcommand |
| opcommand_grp |
| opcommand_hst |
| opconditions |
| operations |
| opgroup |
| opinventory |
| opmessage |
| opmessage_grp |
| opmessage_usr |
| optemplate |
| problem |
| problem_tag |
| profiles |
| proxy_autoreg_host |
| proxy_dhistory |
| proxy_history |
| regexps |
| report |
| report_param |
| report_user |
| report_usrgrp |
| rights |
| role |
| role_rule |
| script_param |
| scripts |
| service_alarms |
| service_problem |
| service_problem_tag |
| service_status_rule |
| service_tag |
| services |
| services_links |
| sessions |
| sla |
| sla_excluded_downtime |
| sla_schedule |
| sla_service_tag |
| sysmap_element_trigger |
| sysmap_element_url |
| sysmap_shape |
| sysmap_url |
| sysmap_user |
| sysmap_usrgrp |
| sysmaps |
| sysmaps_element_tag |
| sysmaps_elements |
| sysmaps_link_triggers |
| sysmaps_links |
| tag_filter |
| task |
| task_acknowledge |
| task_check_now |
| task_close_problem |
| task_data |
| task_remote_command |
| task_remote_command_result |
| task_result |
| timeperiods |
| token |
| trends |
| trends_uint |
| trigger_depends |
| trigger_discovery |
| trigger_queue |
| trigger_tag |
| triggers |
| users |
| users_groups |
| usrgrp |
| valuemap |
| valuemap_mapping |
| widget |
| widget_field |
+----------------------------+
173 rows in set (0.01 sec) MariaDB [zabbix]>

配置zabbix_server.conf

1、默认参数

[root@mcw03 ~]# egrep -v "(^#|^$)" /etc/zabbix_server.conf
LogFile=/var/log/zabbixsrv/zabbix_server.log
LogFileSize=0
PidFile=/run/zabbixsrv/zabbix_server.pid
DBName=zabbix
DBUser=zabbix
DBSocket=/var/lib/mysql/mysql.sock
Timeout=4
AlertScriptsPath=/var/lib/zabbixsrv/alertscripts
ExternalScripts=/var/lib/zabbixsrv/externalscripts
LogSlowQueries=3000
TmpDir=/var/lib/zabbixsrv/tmp
StatsAllowedIP=127.0.0.1
[root@mcw03 ~]#

2、修改后参数,我这里不全部修改了

[root@mcw03 ~]# vim /etc/zabbix_server.conf
[root@mcw03 ~]# egrep -v "(^#|^$)" /etc/zabbix_server.conf
LogFile=/var/log/zabbixsrv/zabbix_server.log
LogFileSize=0
PidFile=/run/zabbixsrv/zabbix_server.pid
DBHost=127.0.0.1
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
DBSocket=/var/lib/mysql/mysql.sock
StartPollers=100
StartIPMIPollers=10
StartPollersUnreachable=0
StartTrappers=10
StartPingers=10
Timeout=4
AlertScriptsPath=/etc/zabbix/alertscripts
ExternalScripts=/etc/zabbix/externalscripts
LogSlowQueries=3000
TmpDir=/var/lib/zabbixsrv/tmp
StatsAllowedIP=127.0.0.1
[root@mcw03 ~]#
[root@mcw03 ~]# mkdir -p /etc/zabbix/alertscripts /etc/zabbix/externalscripts
[root@mcw03 ~]#

3、启动zabbix

启动报错

less /var/log/messages

Jan 21 09:54:04 mcw03 systemd: Started Zabbix Server with MySQL DB.
Jan 21 09:54:04 mcw03 systemd: Starting Zabbix Server with MySQL DB...
Jan 21 09:54:04 mcw03 zabbix_server: zabbix_server [12758]: ERROR: "StartPollersUnreachable" configuration parameter must not be 0 if regular or Java pollers are started
Jan 21 09:54:04 mcw03 systemd: zabbix-server-mysql.service: main process exited, code=exited, status=1/FAILURE
Jan 21 09:54:04 mcw03 systemd: Unit zabbix-server-mysql.service entered failed state.
Jan 21 09:54:04 mcw03 systemd: zabbix-server-mysql.service failed.

StartPollersUnreachable=10

开启报另外一个错

[root@mcw03 ~]# cat /var/log/zabbixsrv/zabbix_server.log
14708:20240121:101632.986 Starting Zabbix Server. Zabbix 6.0.25 (revision 1706b11e866).
14708:20240121:101632.986 ****** Enabled features ******
14708:20240121:101632.986 SNMP monitoring: YES
14708:20240121:101632.986 IPMI monitoring: YES
14708:20240121:101632.986 Web monitoring: YES
14708:20240121:101632.986 VMware monitoring: YES
14708:20240121:101632.986 SMTP authentication: YES
14708:20240121:101632.986 ODBC: YES
14708:20240121:101632.986 SSH support: YES
14708:20240121:101632.986 IPv6 support: YES
14708:20240121:101632.986 TLS support: YES
14708:20240121:101632.986 ******************************
14708:20240121:101632.986 using configuration file: /etc/zabbix_server.conf
14708:20240121:101633.246 Zabbix supports only "utf8_bin,utf8mb3_bin,utf8mb4_bin" collation(s). Database "zabbix" has default collation "utf8_general_ci"
14708:20240121:101633.269 character set name or collation name that is not supported by Zabbix found in 480 column(s) of database "zabbix"
14708:20240121:101633.269 only character set(s) "utf8,utf8mb3,utf8mb4" and corresponding collation(s) "utf8_bin,utf8mb3_bin,utf8mb4_bin" should be used in database
14708:20240121:101633.270 Unsupported DB! MariaDB version 50568 is older than minimum required 100200
14708:20240121:101633.270
14708:20240121:101633.270 Unable to start Zabbix server due to unsupported MariaDB database version (5.05.68).
14708:20240121:101633.270 Must be at least (10.05.00).
14708:20240121:101633.270 Use of supported database version is highly recommended.
14708:20240121:101633.270
[root@mcw03 ~]#

安装部署4.0版本

https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/

[root@mcw04 ~]# rz -E
rz waiting to receive.
[root@mcw04 ~]# ls
\ anaconda-ks.cfg filebeat-6.5.2-x86_64.rpm jdk-8u191-linux-x64.tar.gz nohup.out usr
1.py apache-tomcat-8.5.88 hadoop-2.8.5.tar.gz mcw.txt original-ks.cfg zabbix-release-4.0-1.el7.noarch.rpm
a apache-tomcat-8.5.88.tar.gz ip_forward~ node_exporter-0.16.0.linux-amd64.tar.gz python3yizhuang.tar.gz
[root@mcw04 ~]# rpm -ivh zabbix-release-4.0-1.el7.noarch.rpm
warning: zabbix-release-4.0-1.el7.noarch.rpm: Header V4 RSA/SHA512 Signature, key ID a14fe591: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:zabbix-release-4.0-1.el7 ################################# [100%]
[root@mcw04 ~]# rpm -ql zabbix-release
/etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
/etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
/etc/yum.repos.d/zabbix.repo
/usr/share/doc/zabbix-release-4.0
/usr/share/doc/zabbix-release-4.0/GPL
[root@mcw04 ~]# cat /etc/yum.repos.d/zabbix.repo
[zabbix]
name=Zabbix Official Repository - $basearch
baseurl=http://repo.zabbix.com/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=http://repo.zabbix.com/non-supported/rhel/7/$basearch/
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
gpgcheck=1
[root@mcw04 ~]#

yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent zabbix-get -y

yum -y install mariadb-server

[root@mcw04 ~]# vim /etc/my.cnf
[root@mcw04 ~]# cat /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd
user=mysql
character-set-server=utf8
innodb_file_per_table=1 [mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid #
# include all files from the config directory
#
!includedir /etc/my.cnf.d [root@mcw04 ~]#

注意,建库语句,要用这个字符集,web页面才不会报错,下面可以看到这个报错的产生

create database zabbix charset utf8 collate utf8_bin;
[root@mcw04 ~]# id mysql
uid=27(mysql) gid=27(mysql) groups=27(mysql)
[root@mcw04 ~]#
[root@mcw04 ~]#
[root@mcw04 ~]# systemctl start mariadb
[root@mcw04 ~]# systemctl enable mariadb
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
[root@mcw04 ~]# ps -ef|grep mysql
mysql 95948 1 0 10:53 ? 00:00:00 /bin/sh /usr/bin/mysqld_safe --basedir=/usr
mysql 96149 95948 1 10:53 ? 00:00:00 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mariadb/mariadb.log --pid-file=/var/run/mariadb/mariadb.pid --socket=/var/lib/mysql/mysql.sock
root 96203 1654 0 10:53 pts/0 00:00:00 grep --color=auto mysql
[root@mcw04 ~]# ss -lntup|grep 3306
tcp LISTEN 0 50 *:3306 *:* users:(("mysqld",pid=96149,fd=14))
[root@mcw04 ~]# mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.68-MariaDB MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> \q
Bye
[root@mcw04 ~]# mysqladmin -uroot password 123456
[root@mcw04 ~]# mysql -uroot -p123456
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 4
Server version: 5.5.68-MariaDB MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> create database zabbix character set utf8;
Query OK, 1 row affected (0.00 sec) MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@'localhost' identified by 'zabbix';
Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@'127.0.0.1' identified by 'zabbix';
Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> \q
Bye
[root@mcw04 ~]#
[root@mcw04 ~]# cd /usr/share/doc/zabbix-server-mysql-4.0.50/
[root@mcw04 zabbix-server-mysql-4.0.50]# ls
AUTHORS ChangeLog COPYING create.sql.gz NEWS README
[root@mcw04 zabbix-server-mysql-4.0.50]# gunzip create.sql.gz
[root@mcw04 zabbix-server-mysql-4.0.50]# ls
AUTHORS ChangeLog COPYING create.sql NEWS README
[root@mcw04 zabbix-server-mysql-4.0.50]# mysql -uzabbix -pzabbix -h127.0.0.1
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 6
Server version: 5.5.68-MariaDB MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> use zabbix;
Database changed
MariaDB [zabbix]> source /usr/share/doc/zabbix-server-mysql-4.0.50/create.sql
[root@mcw04 zabbix-server-mysql-4.0.50]# egrep -v '(^#|^$)' /etc/zabbix/zabbix_server.conf
LogFile=/var/log/zabbix/zabbix_server.log
LogFileSize=0
PidFile=/var/run/zabbix/zabbix_server.pid
SocketDir=/var/run/zabbix
DBName=zabbix
DBUser=zabbix
SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
Timeout=4
AlertScriptsPath=/usr/lib/zabbix/alertscripts
ExternalScripts=/usr/lib/zabbix/externalscripts
LogSlowQueries=3000
[root@mcw04 zabbix-server-mysql-4.0.50]# vim /etc/zabbix/zabbix_server.conf
[root@mcw04 zabbix-server-mysql-4.0.50]# egrep -v '(^#|^$)' /etc/zabbix/zabbix_server.conf
LogFile=/var/log/zabbix/zabbix_server.log
LogFileSize=0
PidFile=/var/run/zabbix/zabbix_server.pid
SocketDir=/var/run/zabbix
DBHost=127.0.0.1
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
Timeout=4
AlertScriptsPath=/etc/zabbix/alertscripts
ExternalScripts=/etc/zabbix/externalscripts
LogSlowQueries=3000
[root@mcw04 zabbix-server-mysql-4.0.50]# mkdir -p /etc/zabbix/alertscripts /etc/zabbix/externalscripts
[root@mcw04 zabbix-server-mysql-4.0.50]# systemctl start zabbix-server
[root@mcw04 zabbix-server-mysql-4.0.50]# systemctl start httpd
[root@mcw04 zabbix-server-mysql-4.0.50]# ps -ef|grep zabbix
zabbix 96356 1 1 11:06 ? 00:00:00 /usr/sbin/zabbix_server -c /etc/zabbix/zabbix_server.conf
zabbix 96361 96356 0 11:06 ? 00:00:00 /usr/sbin/zabbix_server: configuration syncer [synced configuration in 0.029947 sec, idle 60 sec]
zabbix 96364 96356 0 11:06 ? 00:00:00 /usr/sbin/zabbix_server: alert manager #1 [sent 0, failed 0 alerts, idle 5.009634 sec during 5.009745 sec]
zabbix 96365 96356 0 11:06 ? 00:00:00 /usr/sbin/zabbix_server: alerter #1 started
zabbix 96366 96356 0 11:06 ? 00:00:00 /usr/sbin/zabbix_server: alerter #2 started
zabbix 96368 96356 0 11:06 ? 00:00:00 /usr/sbin/zabbix_server: alerter #3 started
zabbix 96369 96356 0 11:06 ? 00:00:00 /usr/sbin/zabbix_server: preprocessing manager #1 [queued 0, processed 1 values, idle 5.002011 sec during 5.002043 sec]
zabbix 96370 96356 0 11:06 ? 00:00:00 /usr/sbin/zabbix_server: preprocessing worker #1 started
zabbix 96371 96356 0 11:06 ? 00:00:00 /usr/sbin/zabbix_server: preprocessing worker #2 started
zabbix 96372 96356 0 11:06 ? 00:00:00 /usr/sbin/zabbix_server: preprocessing worker #3 started
zabbix 96373 96356 0 11:06 ? 00:00:00 /usr/sbin/zabbix_server: housekeeper [startup idle for 30 minutes]
zabbix 96374 96356 0 11:06 ? 00:00:00 /usr/sbin/zabbix_server: timer #1 [updated 0 hosts, suppressed 0 events in 0.084677 sec, idle 46 sec]
zabbix 96375 96356 0 11:06 ? 00:00:00 /usr/sbin/zabbix_server: http poller #1 [got 0 values in 0.000468 sec, idle 5 sec]
zabbix 96376 96356 0 11:06 ? 00:00:00 /usr/sbin/zabbix_server: discoverer #1 [processed 0 rules in 0.001749 sec, idle 60 sec]
zabbix 96380 96356 0 11:06 ? 00:00:00 /usr/sbin/zabbix_server: history syncer #1 [processed 0 values, 0 triggers in 0.000047 sec, idle 1 sec]
zabbix 96382 96356 0 11:06 ? 00:00:00 /usr/sbin/zabbix_server: history syncer #2 [processed 0 values, 0 triggers in 0.000011 sec, idle 1 sec]
zabbix 96383 96356 0 11:06 ? 00:00:00 /usr/sbin/zabbix_server: history syncer #3 [processed 0 values, 0 triggers in 0.000053 sec, idle 1 sec]
zabbix 96384 96356 0 11:06 ? 00:00:00 /usr/sbin/zabbix_server: history syncer #4 [processed 0 values, 0 triggers in 0.000027 sec, idle 1 sec]
zabbix 96385 96356 0 11:06 ? 00:00:00 /usr/sbin/zabbix_server: escalator #1 [processed 0 escalations in 0.000681 sec, idle 3 sec]
zabbix 96389 96356 0 11:06 ? 00:00:00 /usr/sbin/zabbix_server: proxy poller #1 [exchanged data with 0 proxies in 0.000015 sec, idle 5 sec]
zabbix 96390 96356 0 11:06 ? 00:00:00 /usr/sbin/zabbix_server: self-monitoring [processed data in 0.000005 sec, idle 1 sec]
zabbix 96393 96356 0 11:06 ? 00:00:00 /usr/sbin/zabbix_server: task manager [processed 0 task(s) in 0.000530 sec, idle 5 sec]
zabbix 96394 96356 0 11:06 ? 00:00:00 /usr/sbin/zabbix_server: poller #1 [got 0 values in 0.000009 sec, idle 2 sec]
zabbix 96395 96356 0 11:06 ? 00:00:00 /usr/sbin/zabbix_server: poller #2 [got 0 values in 0.000016 sec, idle 2 sec]
zabbix 96398 96356 0 11:06 ? 00:00:00 /usr/sbin/zabbix_server: poller #3 [got 0 values in 0.000093 sec, idle 2 sec]
zabbix 96399 96356 0 11:06 ? 00:00:00 /usr/sbin/zabbix_server: poller #4 [got 0 values in 0.000008 sec, idle 2 sec]
zabbix 96403 96356 0 11:06 ? 00:00:00 /usr/sbin/zabbix_server: poller #5 [got 0 values in 0.000042 sec, idle 2 sec]
zabbix 96405 96356 0 11:06 ? 00:00:00 /usr/sbin/zabbix_server: unreachable poller #1 [got 1 values in 0.002254 sec, idle 5 sec]
zabbix 96406 96356 0 11:06 ? 00:00:00 /usr/sbin/zabbix_server: trapper #1 [processed data in 0.000000 sec, waiting for connection]
zabbix 96409 96356 0 11:06 ? 00:00:00 /usr/sbin/zabbix_server: trapper #2 [processed data in 0.000000 sec, waiting for connection]
zabbix 96410 96356 0 11:06 ? 00:00:00 /usr/sbin/zabbix_server: trapper #3 [processed data in 0.000000 sec, waiting for connection]
zabbix 96411 96356 0 11:06 ? 00:00:00 /usr/sbin/zabbix_server: trapper #4 [processed data in 0.000000 sec, waiting for connection]
zabbix 96412 96356 0 11:06 ? 00:00:00 /usr/sbin/zabbix_server: trapper #5 [processed data in 0.000000 sec, waiting for connection]
zabbix 96417 96356 0 11:06 ? 00:00:00 /usr/sbin/zabbix_server: icmp pinger #1 [got 0 values in 0.000024 sec, idle 5 sec]
[root@mcw04 zabbix-server-mysql-4.0.50]# tail /var/log/zabbix/zabbix_server.log
96412:20240121:110613.616 server #32 started [trapper #5]
96417:20240121:110613.651 server #33 started [icmp pinger #1]
96394:20240121:110614.513 Zabbix agent item "system.cpu.intr" on host "Zabbix server" failed: first network error, wait for 15 seconds
96405:20240121:110629.585 Zabbix agent item "system.cpu.load[percpu,avg15]" on host "Zabbix server" failed: another network error, wait for 15 seconds
96380:20240121:110642.376 item "Zabbix server:zabbix[process,ipmi poller,avg,busy]" became not supported: No "ipmi poller" processes started.
96380:20240121:110643.379 item "Zabbix server:zabbix[process,java poller,avg,busy]" became not supported: No "java poller" processes started.
96405:20240121:110644.599 Zabbix agent item "system.localtime" on host "Zabbix server" failed: another network error, wait for 15 seconds
96380:20240121:110648.386 item "Zabbix server:zabbix[process,ipmi manager,avg,busy]" became not supported: No "ipmi manager" processes started.
96380:20240121:110648.386 item "Zabbix server:zabbix[process,snmp trapper,avg,busy]" became not supported: No "snmp trapper" processes started.
96380:20240121:110649.389 item "Zabbix server:zabbix[process,vmware collector,avg,busy]" became not supported: No "vmware collector" processes started.
[root@mcw04 zabbix-server-mysql-4.0.50]# systemctl enable zabbix-server.service
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-server.service to /usr/lib/systemd/system/zabbix-server.service.
[root@mcw04 zabbix-server-mysql-4.0.50]# systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
[root@mcw04 zabbix-server-mysql-4.0.50]#

服务端配置文件截图参考

配置完之后systemctl restart httpd

页面安装

http://10.0.0.14/zabbix/

有个参数配置检查失败,无法继续下一步,需要改下配置重启httpd

  • Time zone for PHP is not set (configuration parameter "date.timezone").

查看默认配置

[root@mcw04 zabbix-server-mysql-4.0.50]# vim /etc/php.ini
[root@mcw04 zabbix-server-mysql-4.0.50]# egrep -v "^;|^$" /etc/php.ini
[PHP]
engine = On
short_open_tag = Off
asp_tags = Off
precision = 14
output_buffering = 4096
zlib.output_compression = Off
implicit_flush = Off
unserialize_callback_func =
serialize_precision = 17
disable_functions =
disable_classes =
zend.enable_gc = On
expose_php = On
max_execution_time = 30
max_input_time = 60
memory_limit = 128M
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
display_errors = Off
display_startup_errors = Off
log_errors = On
log_errors_max_len = 1024
ignore_repeated_errors = Off
ignore_repeated_source = Off
report_memleaks = On
track_errors = Off
html_errors = On
variables_order = "GPCS"
request_order = "GP"
register_argc_argv = Off
auto_globals_jit = On
post_max_size = 8M
auto_prepend_file =
auto_append_file =
default_mimetype = "text/html"
doc_root =
user_dir =
enable_dl = Off
file_uploads = On
upload_max_filesize = 2M
max_file_uploads = 20
allow_url_fopen = On
allow_url_include = Off
default_socket_timeout = 60
[CLI Server]
cli_server.color = On
[Date]
[filter]
[iconv]
[intl]
[sqlite]
[sqlite3]
[Pcre]
[Pdo]
[Pdo_mysql]
pdo_mysql.cache_size = 2000
pdo_mysql.default_socket=
[Phar]
[mail function]
SMTP = localhost
smtp_port = 25
sendmail_path = /usr/sbin/sendmail -t -i
mail.add_x_header = On
[SQL]
sql.safe_mode = Off
[ODBC]
odbc.allow_persistent = On
odbc.check_persistent = On
odbc.max_persistent = -1
odbc.max_links = -1
odbc.defaultlrl = 4096
odbc.defaultbinmode = 1
[Interbase]
ibase.allow_persistent = 1
ibase.max_persistent = -1
ibase.max_links = -1
ibase.timestampformat = "%Y-%m-%d %H:%M:%S"
ibase.dateformat = "%Y-%m-%d"
ibase.timeformat = "%H:%M:%S"
[MySQL]
mysql.allow_local_infile = On
mysql.allow_persistent = On
mysql.cache_size = 2000
mysql.max_persistent = -1
mysql.max_links = -1
mysql.default_port =
mysql.default_socket =
mysql.default_host =
mysql.default_user =
mysql.default_password =
mysql.connect_timeout = 60
mysql.trace_mode = Off
[MySQLi]
mysqli.max_persistent = -1
mysqli.allow_persistent = On
mysqli.max_links = -1
mysqli.cache_size = 2000
mysqli.default_port = 3306
mysqli.default_socket =
mysqli.default_host =
mysqli.default_user =
mysqli.default_pw =
mysqli.reconnect = Off
[mysqlnd]
mysqlnd.collect_statistics = On
mysqlnd.collect_memory_statistics = Off
[OCI8]
[PostgreSQL]
pgsql.allow_persistent = On
pgsql.auto_reset_persistent = Off
pgsql.max_persistent = -1
pgsql.max_links = -1
pgsql.ignore_notice = 0
pgsql.log_notice = 0
[Sybase-CT]
sybct.allow_persistent = On
sybct.max_persistent = -1
sybct.max_links = -1
sybct.min_server_severity = 10
sybct.min_client_severity = 10
[bcmath]
bcmath.scale = 0
[browscap]
[Session]
session.save_handler = files
session.use_cookies = 1
session.use_only_cookies = 1
session.name = PHPSESSID
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.cookie_httponly =
session.serialize_handler = php
session.gc_probability = 1
session.gc_divisor = 1000
session.gc_maxlifetime = 1440
session.bug_compat_42 = Off
session.bug_compat_warn = Off
session.referer_check =
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 0
session.hash_function = 0
session.hash_bits_per_character = 5
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"
[MSSQL]
mssql.allow_persistent = On
mssql.max_persistent = -1
mssql.max_links = -1
mssql.min_error_severity = 10
mssql.min_message_severity = 10
mssql.compatability_mode = Off
mssql.secure_connection = Off
[Assertion]
[mbstring]
[gd]
[exif]
[Tidy]
tidy.clean_output = Off
[soap]
soap.wsdl_cache_enabled=1
soap.wsdl_cache_dir="/tmp"
soap.wsdl_cache_ttl=86400
soap.wsdl_cache_limit = 5
[sysvshm]
[ldap]
ldap.max_links = -1
[mcrypt]
[dba]
[root@mcw04 zabbix-server-mysql-4.0.50]#

修改参数后,重启httpd

[root@mcw04 zabbix-server-mysql-4.0.50]# grep "date.timezone" /etc/php.ini
; http://php.net/date.timezone
;date.timezone =
date.timezone = Asia/Shanghai
[root@mcw04 zabbix-server-mysql-4.0.50]#
[root@mcw04 zabbix-server-mysql-4.0.50]# systemctl restart httpd
[root@mcw04 zabbix-server-mysql-4.0.50]#

然后就好了,配置检查通过

报错了

Unsupported charset or collation for tables: acknowledges, actions, alerts, application_discovery, application_prototype, applications, auditlog, auditlog_details, autoreg_host, conditions, config, corr_condition_tag, corr_condition_tagpair, corr_condition_tagvalue, correlation, dashboard, dchecks, drules, dservices, event_tag, events, expressions, functions, globalmacro, graph_theme, graphs, graphs_items, group_discovery, group_prototype, history_log, history_str, history_text, host_discovery, host_inventory, hostmacro, hosts, housekeeper, hstgrp, httpstep, httpstep_field, httptest, httptest_field, icon_map, icon_mapping, ids, images, interface, item_condition, item_discovery, item_preproc, items, maintenance_tag, maintenances, mappings, media, media_type, opcommand, opconditions, operations, opmessage, problem, problem_tag, profiles, proxy_autoreg_host, proxy_dhistory, proxy_history, regexps, screens, screens_items, scripts, services, services_times, sessions, slides, slideshows, sysmap_element_url, sysmap_shape, sysmap_url, sysmaps, sysmaps_elements, sysmaps_link_triggers, sysmaps_links, tag_filter, task_remote_command, task_remote_command_result, trigger_tag, triggers, users, usrgrp, valuemaps, widget, widget_field.

删除重新创建

[root@mcw04 zabbix-server-mysql-4.0.50]# mysql -uroot -p123456
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 40
Server version: 5.5.68-MariaDB MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> drop database zabbix;
Query OK, 144 rows affected (0.11 sec) MariaDB [(none)]> create database zabbix charset utf8 collate utf8_bin;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> use zabbix
Database changed

MariaDB [(none)]> source /usr/share/doc/zabbix-server-mysql-4.0.50/create.sql

再次点击下一步

再次点击,已经通过了

上面提示,配置文件生成,也就是前面的页面配置,会写入生成一个配置文件,服务会用这个配置文件

[root@mcw04 zabbix-server-mysql-4.0.50]# ls /etc/zabbix/web/zabbix.conf.php
/etc/zabbix/web/zabbix.conf.php
[root@mcw04 zabbix-server-mysql-4.0.50]# ls /etc/zabbix/
alertscripts externalscripts web zabbix_agentd.conf zabbix_agentd.d zabbix_server.conf
[root@mcw04 zabbix-server-mysql-4.0.50]# ls /etc/zabbix/web/
maintenance.inc.php zabbix.conf.php
[root@mcw04 zabbix-server-mysql-4.0.50]# ls /etc/zabbix/web/zabbix.conf.php
/etc/zabbix/web/zabbix.conf.php
[root@mcw04 zabbix-server-mysql-4.0.50]# cat /etc/zabbix/web/zabbix.conf.php
<?php
// Zabbix GUI configuration file.
global $DB; $DB['TYPE'] = 'MYSQL';
$DB['SERVER'] = '127.0.0.1';
$DB['PORT'] = '3306';
$DB['DATABASE'] = 'zabbix';
$DB['USER'] = 'zabbix';
$DB['PASSWORD'] = 'zabbix'; // Schema name. Used for IBM DB2 and PostgreSQL.
$DB['SCHEMA'] = ''; $ZBX_SERVER = '127.0.0.1';
$ZBX_SERVER_PORT = '10051';
$ZBX_SERVER_NAME = 'zbx4'; $IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;
[root@mcw04 zabbix-server-mysql-4.0.50]#

点完成之后,就进入登录页面了

默认账号Admin,密码zabbix

输入后登录到页面

查看数据库的配置

[root@mcw04 zabbix-server-mysql-4.0.50]# egrep "DB.*=.*"  /etc/zabbix/zabbix_server.conf
# DBHost=localhost
DBHost=127.0.0.1
# DBName=
DBName=zabbix
# DBSchema=
# DBUser=
DBUser=zabbix
# DBPassword=
DBPassword=zabbix
# DBSocket=
# DBPort=
# StartDBSyncers=4
[root@mcw04 zabbix-server-mysql-4.0.50]#

查看php中的配置

[root@mcw04 zabbix-server-mysql-4.0.50]# cat /etc/zabbix/web/zabbix.conf.php
<?php
// Zabbix GUI configuration file.
global $DB; $DB['TYPE'] = 'MYSQL';
$DB['SERVER'] = '127.0.0.1';
$DB['PORT'] = '3306';
$DB['DATABASE'] = 'zabbix';
$DB['USER'] = 'zabbix';
$DB['PASSWORD'] = 'zabbix'; // Schema name. Used for IBM DB2 and PostgreSQL.
$DB['SCHEMA'] = ''; $ZBX_SERVER = '127.0.0.1';
$ZBX_SERVER_PORT = '10051';
$ZBX_SERVER_NAME = 'zbx4'; $IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;
[root@mcw04 zabbix-server-mysql-4.0.50]#

查看上面配置的模板文件

[root@mcw04 zabbix-server-mysql-4.0.50]# cat /usr/share/zabbix/conf/zabbix.conf.php.example
<?php
// Zabbix GUI configuration file.
global $DB, $HISTORY; $DB['TYPE'] = 'MYSQL';
$DB['SERVER'] = 'localhost';
$DB['PORT'] = '0';
$DB['DATABASE'] = 'zabbix';
$DB['USER'] = 'zabbix';
$DB['PASSWORD'] = '';
// Schema name. Used for IBM DB2 and PostgreSQL.
$DB['SCHEMA'] = ''; $ZBX_SERVER = 'localhost';
$ZBX_SERVER_PORT = '10051';
$ZBX_SERVER_NAME = ''; $IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG; // Uncomment this block only if you are using Elasticsearch.
// Elasticsearch url (can be string if same url is used for all types).
//$HISTORY['url'] = [
// 'uint' => 'http://localhost:9200',
// 'text' => 'http://localhost:9200'
//];
// Value types stored in Elasticsearch.
//$HISTORY['types'] = ['uint', 'text'];
[root@mcw04 zabbix-server-mysql-4.0.50]#

zabbix页面操作

改中文显示

开启生硬告警声音提示,前端消息声音提示

禁用guests组,防止非授权登录用户访问

刚刚装好的,已经把自身监控起来了。

相关故障处理

zabbix_server程序的参数

安装zabbix-agent

安装

安装yum源

https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm

[root@mcw01 ~]# rpm -ivh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm
Retrieving https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm
warning: /var/tmp/rpm-tmp.pJXy5a: Header V4 RSA/SHA512 Signature, key ID a14fe591: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:zabbix-release-4.0-1.el7 ################################# [100%]
[root@mcw01 ~]# ls /etc/yum.repos.d/
CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repo epel.repo mysql-community.repo salt.repo
CentOS-CR.repo CentOS-fasttrack.repo CentOS-Sources.repo docker-ce.repo glusterfs.repo mysql-community-source.repo zabbix.repo
[root@mcw01 ~]# cat /etc/yum.repos.d/zabbix.repo
[zabbix]
name=Zabbix Official Repository - $basearch
baseurl=http://repo.zabbix.com/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=http://repo.zabbix.com/non-supported/rhel/7/$basearch/
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
gpgcheck=1
[root@mcw01 ~]#

安装包

[root@mcw01 ~]# yum install -y zabbix zabbix-agent

防火墙设置

配置zabbix_agentd.conf

修改配置

[root@mcw01 ~]# egrep -v "(^#|^$)" /etc/zabbix/zabbix_agentd.conf
PidFile=/var/run/zabbix/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log
LogFileSize=0
Server=127.0.0.1
ServerActive=127.0.0.1
Hostname=Zabbix server
Include=/etc/zabbix/zabbix_agentd.d/*.conf
[root@mcw01 ~]# vim /etc/zabbix/zabbix_agentd.conf
[root@mcw01 ~]# vim /etc/zabbix/zabbix_agentd.conf
[root@mcw01 ~]# egrep -v "(^#|^$)" /etc/zabbix/zabbix_agentd.conf
PidFile=/var/run/zabbix/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log
LogFileSize=0
Server=127.0.0.1,10.0.0.14
ServerActive=127.0.0.1,10.0.0.14
Hostname=mcw01
Include=/etc/zabbix/zabbix_agentd.d/*.conf
[root@mcw01 ~]#

启动服务

[root@mcw01 ~]# systemctl enable zabbix-agent
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-agent.service to /usr/lib/systemd/system/zabbix-agent.service.
[root@mcw01 ~]# systemctl start zabbix-agent
[root@mcw01 ~]#

报错了。

[root@mcw01 ~]# tail /var/log/zabbix/zabbix_agentd.log
40875:20240121:154532.064 using configuration file: /etc/zabbix/zabbix_agentd.conf
40875:20240121:154532.085 agent #0 started [main process]
40881:20240121:154532.086 agent #6 started [active checks #2]
40880:20240121:154532.086 agent #5 started [active checks #1]
40879:20240121:154532.087 agent #4 started [listener #3]
40878:20240121:154532.088 agent #3 started [listener #2]
40877:20240121:154532.089 agent #2 started [listener #1]
40880:20240121:154532.091 active check configuration update from [127.0.0.1:10051] started to fail (cannot connect to [[127.0.0.1]:10051]: [111] Connection refused)
40876:20240121:154532.092 agent #1 started [collector]
40881:20240121:154532.094 no active checks on server [10.0.0.14:10051]: host [mcw01] not found
[root@mcw01 ~]#

修改配置,还是不行

[root@mcw01 ~]# vim /etc/zabbix/zabbix_agentd.conf
[root@mcw01 ~]# egrep -v "(^#|^$)" /etc/zabbix/zabbix_agentd.conf
PidFile=/var/run/zabbix/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log
LogFileSize=0
Server=10.0.0.14
ServerActive=10.0.0.14
Hostname=mcw01
Include=/etc/zabbix/zabbix_agentd.d/*.conf
[root@mcw01 ~]#
[root@mcw01 ~]# systemctl restart zabbix-agent
[root@mcw01 ~]# tail /var/log/zabbix/zabbix_agentd.log
41221:20240121:154826.062 TLS support: YES
41221:20240121:154826.062 **************************
41221:20240121:154826.062 using configuration file: /etc/zabbix/zabbix_agentd.conf
41221:20240121:154826.062 agent #0 started [main process]
41225:20240121:154826.064 agent #4 started [listener #3]
41226:20240121:154826.066 agent #5 started [active checks #1]
41224:20240121:154826.068 agent #3 started [listener #2]
41223:20240121:154826.071 agent #2 started [listener #1]
41222:20240121:154826.073 agent #1 started [collector]
41226:20240121:154826.079 no active checks on server [10.0.0.14:10051]: host [mcw01] not found
[root@mcw01 ~]#

页面上面还是没有

这里是手动创建主机

添加成功

可用性是灰色的,添加个模板

过一阵子,变绿了

zabbix使用的更多相关文章

  1. 使用Zabbix监控Oracle数据库

    Orabbix介绍 监控Oracle数据库我们需要安装第三方提供的Zabbix插件,我们先测试比较有名的Orabbix,http://www.smartmarmot.com/product/orabb ...

  2. 基于Oracle安装Zabbix

    软件版本 Oracle Enterprise Linux 7.1 64bit Oracle Enterprise Edition 12.1.0.2 64bit Zabbix 3.2.1 准备工作 上传 ...

  3. Zabbix基本配置及监控主机

    监控主机一版需要在被监控的主机上安装Zabbix Agent 监控主机 安装zabbix-agent 首先需要在被监控的主机上安装agent,可以下载预编译好的RPM进行安装,下载地址:http:// ...

  4. Zabbix 漏洞分析

    之前看到Zabbix 出现SQL注入漏洞,自己来尝试分析. PS:我没找到3.0.3版本的 Zabbix ,暂用的是zabbix 2.2.0版本,如果有问题,请大牛指点. 0x00 Zabbix简介 ...

  5. CentOS下Zabbix安装部署及汉化

    搭建环境:Centos6.5_x86_64,Zabbix2.4.5,epel 源 服务端: 1.安装开发软件包yum -y groupinstall "Development Tools&q ...

  6. 通过Zabbix API实现对主机的增加(无主机资产的添加和带主机资产的添加)、删除、获取主机id、获取模板id、获取组id

    config.yaml存储zabbix的信息(主要包括zabbix server的url .请求头部.登陆的用户名密码) Zabbix_Config: zabbix_url: http://192.1 ...

  7. 如何在Zabbix上安装MySQL监控插件PMP

    PMP,全称是Percona Monitoring Plugins,是Percona公司为MySQL监控写的插件.支持Nagios,Cacti.从PMP 1.1开始,支持Zabbix. 下面,看看如何 ...

  8. 如何部署Zabbix服务端

    部署环境 RHEL 6.7 Zabbix-server 2.2.14 安装zabbix官方源 # wget http://repo.zabbix.com/zabbix/2.2/rhel/6/x86_6 ...

  9. zabbix完整安装

    一.nginx安装 1.必要软件准备: 为了支持rewrite功能,我们需要安装pcre: yum install pcre-* 需要ssl的支持,如果不需要ssl支持,请跳过这一步: yum ins ...

  10. zabbix 中监控windows 的typepref中的值

    监控项:typepref -qx在zabbix中实现: 1.测试zabbix-get 获取数据: /usr/local/zabbix/bin/zabbix_get -s 192.168.1.3 -p1 ...

随机推荐

  1. 快捷转换/互转 Markdown 文档和 TypeScript/TypeDoc 注释

    背景 作为文档工具人,经常需要把代码里面的注释转换成语义化的 Markdown 文档,有时也需要进行反向操作.以前是写正则表达式全局匹配,时间长了这种方式也变得繁琐乏味.所以写了脚本来互转,增加一些便 ...

  2. 【开源三方库】Aki:一行代码极简体验JS&C++跨语言交互

      开源项目 OpenHarmony 是每个人的 OpenHarmony 一.简介 OpenAtom OpenHarmony(以下简称"OpenHarmony")的前端开发语言是A ...

  3. openGauss 列存表PSort索引

    openGauss 列存表 PSort 索引 概述 PSort(Partial sort) Index 是在列存表的列上建的聚簇索引.CUDesc 上有每个 CU 的 min 和 max 值,但如果业 ...

  4. Counter 1000

    From a 1000 Hz clock, derive a 1 Hz signal, called OneHertz, that could be used to drive an Enable s ...

  5. Linux Ubuntu安装配置教程

    Ubuntu是一个基于Linux的开源操作系统,它遵循GNU通用公共许可证,用户可以自由使用.复制.分发和修改.它提供直观易用的桌面环境,适合新手和有经验用户.Ubuntu有强大的软件中心,支持多硬件 ...

  6. docker 应用篇————mysql容器[十二]

    前言 简单介绍一下mysql容器. 正文 这里简单介绍一下mysql的容器. hub.docker.io给了我们一个启动的示例. docker run --name some-mysql -e MYS ...

  7. 重新整理数据结构与算法(c#)—— 算法套路动态规划算法[二十六]

    前言 动态规划算法的核心思想是:将大问题划分为小问题进行解决,从而一步步获取最优解的处理算法. 这样一听和分治算法有点相似啊. 是的,分治算法也是将大问题分为小问题,但是他们毕竟不同,不同之处在什么地 ...

  8. labelme转coco数据集

    原始labelme数据目录结构如下: |-- images | |--- 1.jpg | |--- 1.json | |--- 2.jpg | |--- 2.json | |--- ....... | ...

  9. 力扣1069(MySQL)-产品分析Ⅱ(简单)

    题目: 编写一个 SQL 查询,按产品 id product_id 来统计每个产品的销售总量. 查询结果格式如下面例子所示:  解题思路: 没有用到product表,直接在sales表中使用聚合函数: ...

  10. ESXI 6.5 零基础从安装到批量生成/管理虚拟机简易教程

    制造U盘安装盘 1 先提前下载好,ESXI 6.5 ISO文件. 2 下载制作U盘安装工具,RUFUS. Rufus非常小巧的绿色EXE文件,默认配置选中ISO文件就可以,点击开始,就自动制作,非常方 ...