《网络运维管理》/实验十五: Abb ix监控系统的实现 任务4:配置 Zabbix 任务描述 完成 Zabbix运行所需的配置,使得 Zabbix正确运行。 步骤1:启动snmpdhttpd与mariadb 命令如下 #systemctlstartsnmphttpdmariadb #systemctlenablesnmphttpdmariadb 步骤2:创建初始数据库 (1)设置 mariadb数据库的root用户密码 所用命令 mysqladmin -uroot password ' mairadb@root 数据库root密码由学生自行设置,注意密码保存,以免后期无法登录数据库。 (2)使用root用户登录数据库 所用命令 #f mysql -uroot -pmairadb@root (3)创建数据库zabbⅸx并设置数据库使用的字符集 所用命令 MariaDB [(none)]> CREAtE DATABASE zabbix CHARACTER SET utf8 COLLATE utf8 bin; (4)创建 zabbix用户 所用命令 MariaDB (none ) l> CREATE USER zabbixOlocalhost IDENTIFIED BY'mariadbazabbix:1 (5)将 zabbix数据库的权限赋予 zabbix用户 所用命令 MariaDB [(none)]> GRAnT all PRIVILEGES ON zabbix. To zabbix @localhost; (6)退出 mariadb 所用命令 MariaDB [(none)]> quit 步骤3:向 zabbix数据库中导入初始架构和数据 所用命令 zcat /usr/share/ doc/zabbix-server-mysql/create sql. gz I mysql -uzabbix -pmariadb za bbix 河南中医药大学信息技术学院|网络与信息系统科研工作室 第11页
《网络运维管理》 / 实验十五:Zabbix 监控系统的实现 河南中医药大学信息技术学院 | 网络与信息系统科研工作室 第 11 页 任务 4:配置 Zabbix 任务描述: 完成 Zabbix 运行所需的配置,使得 Zabbix 正确运行。 步骤 1:启动 snmpd、httpd 与 mariadb 命令如下: # systemctl start snmp httpd mariadb # systemctl enable snmp httpd mariadb 步骤 2:创建初始数据库 (1)设置 mariadb 数据库的 root 用户密码 所用命令 # mysqladmin –uroot password ‘mairadb@root’ 注意: 数据库 root 密码由学生自行设置,注意密码保存,以免后期无法登录数据库。 (2)使用 root 用户登录数据库 所用命令 # mysql –uroot –pmairadb@root (3)创建数据库 zabbix 并设置数据库使用的字符集 所用命令 MariaDB [(none)]> CREATE DATABASE zabbix CHARACTER SET utf8 COLLATE utf8_bin; (4)创建 zabbix 用户 所用命令 MariaDB [(none)]> CREATE USER zabbix@localhost IDENTIFIED BY ‘mariadb@zabbix’; (5)将 zabbix 数据库的权限赋予 zabbix 用户 所用命令 MariaDB [(none)]> GRANT all PRIVILEGES ON zabbix.* TO zabbix@localhost; (6)退出 mariadb 所用命令 MariaDB [(none)]> quit 步骤 3:向 zabbix 数据库中导入初始架构和数据 所用命令 # zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql –uzabbix –pmariadb zabbix
《网络运维管理》/实验十五: Abb ix监控系统的实现 步骤4:认识 Zabbix中的各种配置文件 (1)配置文件类型 zabbIXserver 配置文件: zabbix server. conf 2) zabbix-proxy配置文件: zabbix_ proxy. conf 3) zabbix-agentd配置文件: zabbix_ agentd. conf 只有按装了 zabbix- server软件包,才会有 zabbix server conf配置文件。同理,我们只安装 了 zabbix- server和 zabbix- agentd软件包,所以只有 zabbix server conf和 zabbix agentd. conf配 置文件。 (2)配置详解 This is a configuration file for Zabbix server daemon #ftogetmoreinformationaboutZabbix,visithttp://www.zabbix.com ############ GENERAL PARAMETERS################# ## Option: Listen Port Listen port for trapper. #f Mandatory: no # Range:1024-32767 #默认侦听的端口取值范围 #f Default #f Listen Port=10051 #默认侦听的端口,默认即可 ## Option: SourceIP Source IP address for outgoing connections #f Mandatory: no #f Default. #f Source: #使用哪个出口IP与外面通信,默认即可 ###f option: LogType Specifies where log messages are written to ##### ystem - syslog file specified with Log File parameter console- standard output #f Mandatory: no #f Logtype=file #设置记录日志的类型,默认记录至文件 ## Option: LogFile Log file name for Log Type file parameter. Mandatory: yes, if Log Type is set to file, otherwise no 河南中医药大学信息技术学院|网络与信息系统科研工作室 第12页
《网络运维管理》 / 实验十五:Zabbix 监控系统的实现 河南中医药大学信息技术学院 | 网络与信息系统科研工作室 第 12 页 步骤 4:认识 Zabbix 中的各种配置文件 (1)配置文件类型 1)zabbix-server 配置文件:zabbix_server.conf 2)zabbix-proxy 配置文件:zabbix_proxy.conf 3)zabbix-agentd 配置文件:zabbix_agentd.conf 只有按装了 zabbix-server 软件包,才会有 zabbix_server.conf 配置文件。同理,我们只安装 了 zabbix-server 和 zabbix-agentd 软件包,所以只有 zabbix_server.conf 和 zabbix_agentd.conf 配 置文件。 (2)配置详解 zabbix_server.conf # This is a configuration file for Zabbix server daemon # To get more information about Zabbix, visit http://www.zabbix.com ############ GENERAL PARAMETERS ################# ### Option: ListenPort # Listen port for trapper. # # Mandatory: no # Range: 1024-32767 #默认侦听的端口取值范围 # Default: # ListenPort=10051 #默认侦听的端口,默认即可 ### Option: SourceIP # Source IP address for outgoing connections. # # Mandatory: no # Default: # SourceIP= #使用哪个出口 IP 与外面通信,默认即可 ### Option: LogType # Specifies where log messages are written to: # system - syslog # file - file specified with LogFile parameter # console - standard output # # Mandatory: no # Default: # LogType=file #设置记录日志的类型,默认记录至文件 ### Option: LogFile # Log file name for LogType 'file' parameter. # # Mandatory: yes, if LogType is set to file, otherwise no
《网络运维管理》/实验十五: Abb ix监控系统的实现 #f Default #f LogFile= #指定 zabbix日志文件存放路径 Log File=/var/log/zabbix/zabbix_ server log ## Option: LogFile size Maximum size of log file in MB 0-disable automatic log rotation # Range:0-1024 #f Default # Log Size=1#指定日志文件大小及轮询相关,单位为MB,0表示禁用日志自动轮询,如果日志 达到了限制,并且 rotation失败,老日志文件将会被清空掉,重新生成一个新日志 LogFileSize=0 ## Option: DebugLeve 0- basic information about starting and stopping of Zabbix processes 1- critical information 2-error information ###### 4- for debugging(produces lots of information) 5-extended debugging(produces even more information) Range: 0-5 #f Default. # DebugLevel=3#指定 debug调试信息级别,默认即可 ###f Option: Pid File f Name of pid file Mandatory: no #f Default # Pid File=/tmp/ zabbix_ server. pid#定义PID文件及路径 Pid File=/var/run/zabbix/ zabbix_ server. pid ## Option: SocketDir IPC socket directory. Directory to store IPC sockets used by internal Zabbix services. #f Mandatory: no #f Default 河南中医药大学信息技术学院|网络与信息系统科研工作室 第13页
《网络运维管理》 / 实验十五:Zabbix 监控系统的实现 河南中医药大学信息技术学院 | 网络与信息系统科研工作室 第 13 页 # Default: # LogFile= #指定 zabbix 日志文件存放路径 LogFile=/var/log/zabbix/zabbix_server.log ### Option: LogFileSize # Maximum size of log file in MB. # 0 - disable automatic log rotation. # # Mandatory: no # Range: 0-1024 # Default: # LogFileSize=1 #指定日志文件大小及轮询相关,单位为 MB ,0 表示禁用日志自动轮询,如果日志 达到了限制,并且 rotation 失败,老日志文件将会被清空掉,重新生成一个新日志。 LogFileSize=0 ### Option: DebugLevel # Specifies debug level: # 0 - basic information about starting and stopping of Zabbix processes # 1 - critical information # 2 - error information # 3 - warnings # 4 - for debugging (produces lots of information) # 5 - extended debugging (produces even more information) # # Mandatory: no # Range: 0-5 # Default: # DebugLevel=3 #指定 debug 调试信息级别,默认即可 ### Option: PidFile # Name of PID file. # # Mandatory: no # Default: # PidFile=/tmp/zabbix_server.pid #定义 PID 文件及路径 PidFile=/var/run/zabbix/zabbix_server.pid ### Option: SocketDir # IPC socket directory. # Directory to store IPC sockets used by internal Zabbix services. # # Mandatory: no # Default:
《网络运维管理》/实验十五: Abb ix监控系统的实现 SocketDir=/tmp SocketDir=/var/run/zabbix ## option: DBHost Database host name If set to localhost, socket is used for My SQL. ##### If set to empty string, socket is used for PostgresQl # DBHost= localhost#指定链接的数据库(默认为 localhost, zabbix与数据库安装在一台机器 上,直接使用 localhost,这是通过 socket链接mysq1数据库的IP地址) DBHost=localhost ## Option: DBName Database name #f Mandatory: yes #f DBName= #链接数据库的名称 DBName=zabbix ## Option: DBSchema Schema name Used for PostgreSQL. #f Mandatory: no #f SChemas #指定链接其他类型数据库 ## Option: DBUser Database user #f Mandatory: no #f DbUser= #默认使用哪个用户链接数据库 DBUser=zabbix ## Option: DBPassword Database password Comment this line if no password is used #f Mandatory:no 河南中医药大学信息技术学院|网络与信息系统科研工作室 第14页
《网络运维管理》 / 实验十五:Zabbix 监控系统的实现 河南中医药大学信息技术学院 | 网络与信息系统科研工作室 第 14 页 # SocketDir=/tmp SocketDir=/var/run/zabbix ### Option: DBHost # Database host name. # If set to localhost, socket is used for MySQL. # If set to empty string, socket is used for PostgreSQL. # # Mandatory: no # Default: # DBHost=localhost #指定链接的数据库(默认为 localhost,zabbix 与数据库安装在一台机器 上,直接使用 localhost,这是通过 socket 链接 mysql 数据库的 IP 地址) DBHost=localhost ### Option: DBName # Database name. # # Mandatory: yes # Default: # DBName= #链接数据库的名称 DBName=zabbix ### Option: DBSchema # Schema name. Used for PostgreSQL. # # Mandatory: no # Default: # DBSchema= #指定链接其他类型数据库 ### Option: DBUser # Database user. # # Mandatory: no # Default: # DBUser= #默认使用哪个用户链接数据库 DBUser=zabbix ### Option: DBPassword # Database password. # Comment this line if no password is used. # # Mandatory: no