zabbix+apache+mysql安装部署
Zabbix6.0的安装与IPMI的简单使用

Zabbix6.0的安装与IPMI的简单使⽤zabbix简介1.zabbix的安装与使⽤建议使⽤CentOS8进⾏部署, 不建议使⽤CentOS7, rpm包直接部署的话,CentOS8⽐较容易⼀些⽀持mysql数据库.建议先期部署mysql数据库.如果使⽤ipmi需要安装ipmitool 如果使⽤tar包安装需要安装devel包本次使⽤yum 直接在线安装不进⾏编译,提⾼部署速度2.安装根据zabbix官⽹的最新材料进⾏处理.# 建议直接使⽤centos8 centos7 没验证过最新的版本rpm -Uvh https:///zabbix/6.0/rhel/8/x86_64/zabbix-release-6.0-1.el8.noarch.rpm# 安装相关内容rpm包:dnf install zabbix-server-mysql zabbix-web-mysql zabbix-apache-conf zabbix-sql-scripts zabbix-selinux-policy zabbix-agent -y# 升级⼀下相关部分软件,不然zabbix-server 启动时会报错yum update net-snmp -y2.安装数据库部分创建空的数据库mysql -uroot -p# 输⼊密码登录数据库# 注意我这边为了⽅便管理将 `%` 也添加进来了create database zabbix character set utf8mb4 collate utf8mb4_bin;create user zabbix@localhost identified by 'password';grant all privileges on zabbix.* to zabbix@localhost;quit;create user zabbix@'%' identified by 'password';grant all privileges on zabbix.* to zabbix@'%';quit;#初始化数据库实例zcat /usr/share/doc/zabbix-sql-scripts/mysql/server.sql.gz | mysql -uzabbix -p zabbix#注意需要输⼊密码vim /etc/zabbix/zabbix_server.confDBPassword=password2.安装启动服务# 注意如果开启了 IPMI需要修改如下参数:sed -i '/# StartIPMIPollers=0/aStartIPMIPollers=5' /etc/zabbix/zabbix_server.conf# 启动服务systemctl restart zabbix-server zabbix-agent httpd php-fpmsystemctl enable zabbix-server zabbix-agent httpd php-fpm2.安装界⾯初始化输⼊ http://ip/zabbix 进⾏初始化操作数据库密码如果在本地可以直接输⼊ 127.0.0.1 以及相关密码进⾏.安装速度较为迅速默认密码:admin:Zabbix注意安装完⽴即修改密码.3.简单连接IPMI的使⽤.简介本⼈对 zabbix的监控不太熟悉因为我们这边服务器的跨度⼜⽐较⼤, 所以这⾥简单描述⼀下⾃⼰的使⽤部分zabbix 6.0的界⾯与之前⽹络上很多介绍不太⼀样.3. 简单连接IMPI的使⽤3.1. 定义主机群组打开zabbix-配置-主机群组功能添加主机群组注意, 因为服务器⽐较繁多, 可能不同年代的服务器需要设置不同的群组进⾏处理3. 简单连接IMPI的使⽤3.2. 定义模板注意模板尽量使⽤英⽂数字, 不要使⽤中⽂,容易出现误判.虽然zabbix有很多ipmi的模板但是不符合,我们⼀些⽐较⽼旧型号的机器.添加⼀个新的模板注意不要选择模板, 可以选择对应的主机集群.3.3. 定义主机在配置-主机-中点击创建主机进⼊New host 的界⾯输⼊主机名称, 选择群组.Interface选择使⽤ IPMI的IP地址等内容.进⼊IPMI页, 注意选择输⼊⽤户名密码. 注意需要是正确的⽤户信息需要注意的是 IPMI输⼊的不是业务IP地址,必须是IPMI的管理⼝的地址.不然可能会不通.3.3.1 维护主机监控项⽬进⼊主机维护列表点击监控项进⼊监控项⽬维护界⾯点击创建监控项⽬进⼊监控项⽬需要填写的事项为:1. 填写名称2. 选择类型为IPMI客户端3. 键值,这⾥有⼀个具体要求. ⽐如CPU温度 IPMI定义的内容为ipmitool sensor |grep CPUCPU0_Temp | 68.000 | degrees C | ok | na | na | na | 102.000 | 104.000 | na 注意: 键值为 ipmi_cpu0_temp 为 ipmi开头的⼩写第⼀列内容注意: IPMI传感器名字要⼤⼩写正确起来. CPU0_Temp注意: 可以进⾏测试验证参数是否正确.3.3.2 创建图形便于分析在配置-主机-列表中点击图形配置新增图形注意需要增加⼀下监控项⽬. 保存即可.4. 监测仪表盘处理编辑仪表盘增加⼀个仪表盘的内容.使⽤click and drag to disired size选择主机样式以及监控的模式注意监控模式基本上是选择监控项⽬即可.。
zabbix环境部署详细步骤(小白可入)

Zabbix部署流程目录1、计划安排 (2)2、环境准备 (2)3、软件安装(lamp) (2)4、配置文件修改 (3)5、web初始化及登陆 (4)6、监控项模板配置 (5)7、网络自动发现主机 (8)8、添加监控项的触发器及对应的动作 (11)9、在zabbix-server端配置简单的邮件postfix服务 (16)10、用户与报警媒介关联 (18)1、计划安排2、环境准备Zabbix-server端(10.21.X.X):操作系统:centos7.1 硬件:4c/8G 80G 安装图形化Mysql数据库端(10.21.20.202):操作系统:centos7.1 硬件:4c/8G 120G3、软件安装(lamp)(1)Zabbix-Server组件:yum –y install net-snmp* gcc下载zabbix-3.2.7.tar.gz包并进行编译安装(./configure –prefix=/usr/local/zabbix --enable –server --enable-agent --with-mysql --with-net-snmp)---- make (注编译时若出现报错,按照报错解决依赖包问题)(2)web 组件(注意php的软件版本一定要保持一致5.4)yum -y install httpd php php-mysqlyum -y localinstall zabbix-web-3.2.0 zabbix-web-mysql-3.2.0 php-mbstring php-bcmath(3)数据库端yum -y install mariadb-server或者编译安装mysql4、配置文件修改(1)数据库systemctl start mariadbmysql -e "create database zabbix default charset utf8"(创建时注意添加default charset utf8,否则有可能出现中文乱码问题)mysql zabbix < schema.sqlmysql zabbix < images.sqlmysql zabbix < data.sql授权:给zabbix-server端的ip授权Grant all on zabbix.* to zabbix@’10.21.20.201’ identified by ‘zabbixpass’;Flush privileges;(2)zabbix-server端(注:如果监控项较多配置文件中的CacheSize 等参数也做相应的修改,优化性能)Vim /usr/local/zabbix/etc/zabbix_server.confDBHOST=数据库所在的ipDBName=zabbixDBUser=zabbixDBPassword=zabbixDBPort=3306启动服务。
Apache2.2.17+PHP5.2.5+MySQL5安装说明(含图片)

Apache2.2.17+PHP5.2.5+MySQL 5安装说明第一部分Php+Apache+Mysql准备Apache:需要 httpd-2.2.17-win32-x86-no_ssl. msi官方下载地址:/dist/httpd/binaries/win32/Php:需要php-5.3.5-Win32-VC6-x86.zip官方下载地址: /download/Mysql需要 Mysql 5.0.exe官方下载地址:/downloads/mysql/5.1.html第二部分Apache的安装与配置2.1安装下载地址:/dist/httpd/binaries/win32/安装httpd-2.2.17-win32-x86-no_ssl.msi其中,同一版本有两种类型:no_ssl和openssl,openssl多了个ssl安全认证模式,它的协议是HTTPS而不是HTTP,这就是带有SSL的服务器与一般网页服务器的区别了。
一般情况下,我们下载no_ssl版本的就ok了。
下载好apache安装文件后,点击安装,在连续3次next后,将进入server information配置界面,要求输入network domain、server domain和网站管理员的邮箱地址,普通用户可以随便按照格式填一下就行了。
再次按Next后,出现选择安装路径的界面,默认的路径比较长,pharmar把安装路径修改为:"C:\Program Files\Apache\",继续安装,直到完成。
点击【Next】确认同意软件安装使用许可条例,选择“I accept the terms in the license agreemen,点“Next”继续点击【Next】继续三条信息均可任意填写,无效的也行。
下面有两个选择,图片上选择的是为系统所有用户安装,使用默认的80端口,并作为系统服务自动启动;另外一个是仅为当前用户安装,使用端口8080,手动启动。
Zabbix安装配置手册- -

Zabbix 手册目录Ⅰ Zabbix简介 (1)一、Zabbix介绍 (1)二、Zabbix系统架构 (4)1.Zabbix架构: (4)2.Zabbix架构说明: (5)Ⅱ Zabbix安装 (8)一、Zabbix安装 (8)1、安装基础包 (8)2、启动httpd、mysql (9)3、配置防火墙 (9)4、配置PHP参数 (9)5、修改httpd 的FQDN 错误 (10)6、下载zabbix-3.0.3tar.gz (10)7、添加zabbix 用户和组 (11)8、安装zabbix-server (11)9、创建zabbix 数据库以及相关表 (11)10、配置软连接和启动文件信息 (12)11、修改/etc/init.d 目录下的zabbix_server 和zabbix_agentd 启动文件(配置server和agent) (12)12、通过web 站点配置zabbix (14)二、Zabbix 监控机配置 (19)1. 登录 (19)2. 添加主机(Hosts) (20)3. 创建模板 (26)4.添加告警动作(Actions) (28)5.添加告警方式(Medias) (29)6.添加用户(Users) (30)Ⅲ Zabbix配置 (32)一、Client端配置 (32)二、zabbix_server.conf 配置文件详解 (33)三、zabbix_agentd.conf 配置文件详解 (41)ⅠZabbix简介一、Zabbix介绍Zabbix是一个分布式监控系统,支持多种采集方式和采集客户端,有专用的Agent(代理),也支持SNMP、IPMI、JMX、Telnet、SSH等多种协议,它将采集到的数据存放到数据库,然后对其进行分析整理,达到条件触发告警.其灵活的扩展性和丰富的功能是其他监控系统所不能比的。
相对来说,它的总体功能做得非常优秀,其界面如图1-1、图1-2。
zabbix监控mysql的方法

zabbix监控mysql的⽅法zabbix部署完之后zabbix-agent操作1.监控mysql,⾸先要先安装mysql[root@localhost ~]# yum -y install mariadb mariadb-server2.编写mysql监控项的脚本在zabbix-agent先授权个⽤户不然测试时没有权限[root@localhost ~]# mysqlWelcome to the MariaDB monitor. Commands end with ; or \g.Your MariaDB connection id is 33Server version: 5.5.65-MariaDB MariaDB ServerCopyright (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)]> grant all on *.* to 'check'@'localhost' identified by '123';Query OK, 0 rows affected (0.00 sec)mysql监控的内容主要有主从的状态 (得先配置主从在下⾯)流量检测发送,接受常规操作增删改查某个库、某个表的⼤⼩tps(每秒查询处理的事务数)qps(每秒能处理多少次请求数)[root@localhost ~]# mkdir /etc/zabbix/scipts[root@localhost ~]# cd /etc/zabbix/scipts/[root@localhost scipts]# vim mysql.sh#!/bin/bashmysql="mysql -ucheck -p123"case $1 in# mysql主从状态slave_status)$mysql -e "show slave status\G" |grep "Yes" |wc -l;;# mysql流量接受Bytes_received)mysqladmin extended-status |grep "Bytes_received" |awk '{print $4}';;# mysql流量发送Bytes_sent)mysqladmin extended-status |grep "Bytes_sent" |awk '{print $4}';;# mysql常规操作增Com_insert)mysqladmin extended-status |grep -w "Com_insert" |awk '{print $4}';;# mysql常规操作删Com_delete)mysqladmin extended-status |grep -w "Com_delete" |awk '{print $4}';;# mysql常规操作改Com_update)mysqladmin extended-status |grep -w "Com_update" |awk '{print $4}';;# mysql常规操作查Com_select)mysqladmin extended-status |grep -w "Com_select" |awk '{print $4}';;# mysql tpstps)mysqladmin status |awk '{print $6/$2}';;# mysql qps=(rollback+commit)/uptimeqps)rollback=$(mysqladmin extended-status |grep -w "Com_rollback" |awk '{print $4}')commit=$(mysqladmin extended-status |grep -w "Com_commit" |awk '{print $4}')uptime=$(mysqladmin status |awk '{print $2}')count=$[$rollback+$commit]echo "$count $uptime" > /tmp/a.txtcat /tmp/a.txt |awk '{print $1/$2}';;# 库⼤⼩我们这⾥拿mysql库举例db)$mysql -e "select sum(data_length) from information_schema.tables where table_schema='mysql'" |sed -n '2p';;# 表⼤⼩我们这⾥拿mysql下⾯的user表举例tb)$mysql -e "select sum(data_length) from information_schema.tables where table_schema='mysql' and table_name='user'" |sed -n '2p';;esac3.⾃定义键值key 重启zabbix-agent[root@localhost scipts]# cd /etc/zabbix/zabbix_agentd.d/[root@localhost zabbix_agentd.d]# vim mysql.confUserParameter=mysql[*],/etc/zabbix/scipts/mysql.sh $1[root@localhost zabbix_agentd.d]# systemctl restart zabbix-agent4.在zabbix-server测试先安装zabbix-get[root@localhost ~]# yum -y install zabbix-get[root@localhost ~]# zabbix_get -s 192.168.27.137 -k mysql[slave_status]2[root@localhost ~]# zabbix_get -s 192.168.27.137 -k mysql[Bytes_received]850970[root@localhost ~]# zabbix_get -s 192.168.27.137 -k mysql[Bytes_sent]224906[root@localhost ~]# zabbix_get -s 192.168.27.137 -k mysql[Com_insert]3001[root@localhost ~]# zabbix_get -s 192.168.27.137 -k mysql[Com_delete]135[root@localhost ~]# zabbix_get -s 192.168.27.137 -k mysql[Com_update]128[root@localhost ~]# zabbix_get -s 192.168.27.137 -k mysql[Com_select]19[root@localhost ~]# zabbix_get -s 192.168.27.137 -k mysql[qps]0.864842[root@localhost ~]# zabbix_get -s 192.168.27.137 -k mysql[tps]1.92936[root@localhost ~]# zabbix_get -s 192.168.27.137 -k mysql[db]555118[root@localhost ~]# zabbix_get -s 192.168.27.137 -k mysql[tb]420报错处理[root@localhost ~]# zabbix_get -s 192.168.27.137 -k mysql[slave_status]sh: /etc/zabbix/scipts/mysql.sh: 权限不够脚本执⾏权限不够去zabbix-agent 加权限[root@localhost zabbix_agentd.d]# chmod +x /etc/zabbix/scipts/mysql.sh[root@localhost ~]# zabbix_get -s 192.168.27.137 -k mysql[slave_status]ERROR 1227 (42000) at line 1: Access denied; you need (at least one of) the SUPER,REPLICATION CLIENT privilege(s) for this operation 是因为⽤户没有权限查看去zabbix-agent 授权个⽤户在脚本⾥⾯加上[root@localhost ~]# mysqlWelcome to the MariaDB monitor. Commands end with ; or \g.Your MariaDB connection id is 33Server version: 5.5.65-MariaDB MariaDB ServerCopyright (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)]> grant all on *.* to 'check'@'localhost' identified by '123';Query OK, 0 rows affected (0.00 sec)[root@localhost scipts]# vim mysql.sh#!/bin/bashmysql="mysql -ucheck -p123"case $1 in# mysql主从状态slave_status)$mysql -e "show slave status\G" |grep "Yes" |wc -l;;zabbix页⾯上添加监控项和图形查看mysql流量数据查看mysql qps tps查看mysql主从状态查看mysql常规操作查看mysql库表⼤⼩mysql主从配置⼀.zabbix-server端[root@localhost ~]# vim /etc/f[root@localhost ~]# systemctl restart mariadb[root@localhost ~]# mysqlWelcome to the MariaDB monitor. Commands end with ; or \g.Your MariaDB connection id is 7Server version: 5.5.65-MariaDB MariaDB ServerCopyright (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 master status;+------------------+----------+--------------+------------------+| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |+------------------+----------+--------------+------------------+| mysql-bin.000001 | 175170 | | |+------------------+----------+--------------+------------------+1 row in set (0.00 sec)MariaDB [(none)]> grant all on *.* to 'tom'@'%' identified by '123'; Query OK, 0 rows affected (0.00 sec)MariaDB [(none)]> flush privileges;Query OK, 0 rows affected (0.00 sec)⼆.zabbix-agent端[root@localhost ~]# vim /etc/f[root@localhost ~]# systemctl restart mariadb[root@localhost ~]# mysqlWelcome to the MariaDB monitor. Commands end with ; or \g.Your MariaDB connection id is 2Server version: 5.5.65-MariaDB MariaDB ServerCopyright (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)]> change master to-> master_host='192.168.27.136',-> master_user='tom',-> master_password='123',-> master_log_file='mysql-bin.000001',-> master_log_pos=175170;Query OK, 0 rows affected (0.01 sec)MariaDB [(none)]> start slave;Query OK, 0 rows affected (0.00 sec)MariaDB [(none)]> show slave status \G;*************************** 1. row ***************************Slave_IO_State: Waiting for master to send eventMaster_Host: 192.168.27.136Master_User: tomMaster_Port: 3306Connect_Retry: 60Master_Log_File: mysql-bin.000001Read_Master_Log_Pos: 175170Relay_Log_File: mysql-relay.000004Relay_Log_Pos: 529Relay_Master_Log_File: mysql-bin.000001Slave_IO_Running: YesSlave_SQL_Running: NoReplicate_Do_DB:Replicate_Ignore_DB:Replicate_Do_Table:Replicate_Ignore_Table:Replicate_Wild_Do_Table:Replicate_Wild_Ignore_Table:Last_Errno: 1146Last_Error: Error 'Table 'zabbix.history_uint' doesn't exist' on query. Default database: 'zabbix'. Query: 'insert into history_uint (itemid,clock,ns,value) values (23287,1602301747,810415730,1)'Skip_Counter: 0Exec_Master_Log_Pos: 173424Relay_Log_Space: 2565Until_Condition: NoneUntil_Log_File:Until_Log_Pos: 0Master_SSL_Allowed: NoMaster_SSL_CA_File:Master_SSL_CA_Path:Master_SSL_Cert:Master_SSL_Cipher:Master_SSL_Key:Seconds_Behind_Master: NULLMaster_SSL_Verify_Server_Cert: NoLast_IO_Errno: 0Last_IO_Error:Last_SQL_Errno: 1146Last_SQL_Error: Error 'Table 'zabbix.history_uint' doesn't exist' on query. Default database: 'zabbix'. Query: 'insert into history_uint (itemid,clock,ns,value) values (23287,1602301747,810415730,1)' Replicate_Ignore_Server_Ids:Master_Server_Id: 11 row in set (0.00 sec)ERROR: No query specified报错处理[root@localhost ~]# vim /etc/f[root@localhost ~]# systemctl restart mariadb[root@localhost ~]# mysqlWelcome to the MariaDB monitor. Commands end with ; or \g.Your MariaDB connection id is 4Server version: 5.5.65-MariaDB MariaDB ServerCopyright (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 slave status \G;*************************** 1. row ***************************Slave_IO_State: Waiting for master to send eventMaster_Host: 192.168.27.136Master_User: tomMaster_Port: 3306Connect_Retry: 60Master_Log_File: mysql-bin.000001Read_Master_Log_Pos: 199126Relay_Log_File: mysql-relay.000006Relay_Log_Pos: 3950Relay_Master_Log_File: mysql-bin.000001Slave_IO_Running: YesSlave_SQL_Running: YesReplicate_Do_DB:Replicate_Ignore_DB:Replicate_Do_Table:Replicate_Ignore_Table:Replicate_Wild_Do_Table:Replicate_Wild_Ignore_Table:Last_Errno: 0Last_Error:Skip_Counter: 0Exec_Master_Log_Pos: 199126Relay_Log_Space: 4240Until_Condition: NoneUntil_Log_File:Until_Log_Pos: 0Master_SSL_Allowed: NoMaster_SSL_CA_File:Master_SSL_CA_Path:Master_SSL_Cert:Master_SSL_Cipher:Master_SSL_Key:Seconds_Behind_Master: 0Master_SSL_Verify_Server_Cert: NoLast_IO_Errno: 0Last_IO_Error:Last_SQL_Errno: 0Last_SQL_Error:Replicate_Ignore_Server_Ids:Master_Server_Id: 11 row in set (0.00 sec)到此这篇关于zabbix 监控mysql的⽅法的⽂章就介绍到这了,更多相关zabbix 监控mysql内容请搜索以前的⽂章或继续浏览下⾯的相关⽂章希望⼤家以后多多⽀持!。
Zabbix ODBC 监控 Oracle 和 MySQL

Bash# 配置odbcinst.ini 主要是配置安装的ODBC 数据库驱动,如MySQL,oracle, [MySQL] # 驱动名称,在数据库⽂件中需要 Description = ODBC for MySQL Driver = /usr/lib/libmyodbc5.so Setup = /usr/lib/libodbcmyS.so Driver64 = /usr/lib64/libmyodbc5.so Setup64 = /usr/lib64/libodbcmyS.so FileUsage = 112345678配置MySQL ODBC 连接b.修改odbc.ini ⽂件,每次新增加⼀个MySQL 数据库,需要在odbc.ini ⽂件中新增这⼀段内容。
PowerShell# odbc.ini 主要是配置数据源连接信息 [zabbix ] # 数据源名称,在这个⽂件中保持唯⼀ Description = MySQL test database # 数据源描述,⾃定义即可 Driver = MySQL # 对应驱动⽂件odbcinst.ini 中定义的名称 Server = 127.0.0.1 # 数据库服务器地址 User = zabbix # 数据库账号 Password = password # 数据库密码 Port = 3306 # 数据库端⼝ Database = zabbix # 数据库名称123456789数据库连接测试,返回 Connected 标明连接成功PowerShell[root @demo zabbix ]# isql zabbix -v +---------------------------------------+ | Connected! | | | | sql -statement | | help [tablename ] | | quit | | | +---------------------------------------+ SQL> quit12345678910 配置 Oracle ODBC 连接3.安装Oracle 驱动a.在Zabbix Server 上安装,只需要安装⼀次,后续新增数据库不需要再安装CSS# 下载驱动,百度搜索“Oracle Instant Client Downloads ”,在官⽹下载如下两个rpm 包:oracle-instantclient19.13-odbc-19.13.0.0.0-1.x86_64.rpm oracle-instantclient19.13-basic-19.13.0.0.0-1.x86_64.rpm # 安装驱动yum localinstall oracle-instantclient19.13-basic-19.13.0.0.0-1.x86_64.rpm oracle-instantclient19.13-odbc-19.13.0.0.0-1.x86_64.rpm12345在Zabbix Server 上配置,只需要配置⼀次,后续新增数据库不需要再修改修改驱动配置⽂件:/etc/odbcinst.ini :Makefile[root@bsmzabbix tmp]# more /etc/odbcinst.ini # Example driver definitions [Oracle12]Description = Oracle ODBC driver for Oracle 12Driver = /usr/lib/oracle/19.13/client64/lib/libsqora.so.19.1Setup =FileUsage =CPTimeout =CPReuse =123456789配置Oracle ODBC 连接b.在Zabbix Server 上配置,每次新增加⼀个 Oracle 数据库,需要在odbc.ini ⽂件中定义这⼀段内容 修改odbc.ini ⽂件:Makefile[root@bsmzabbix tmp]# more /etc/odbc.ini [ORATEST] # ODBC 数据源名称,整个⽂件中保持唯⼀ Driver = Oracle12 # 驱动名称,对应odbcinst.ini 中定义的名称 Trace = yes TraceFile = /tmp/odbc_oracle.log Database = drpdb # 数据库名称 UserID = system # 数据库⽤⼾名 Password = kboradb2013 # 数据库密码 Port = 1521 # 数据库端⼝ ServerName = 10.10.33.11:1521/drpdb # 数据库连接12345678910 连接测试,如果返回 Connected 表明连接测试成功。
ZBBIX监控交换机路由器详细过程

这里为了方便使用 yum 安装方式一键安装,如果你会其它的安装方式也可以自 己动手安装 [root@localhost ~]# yum install gcc mysql-server mysql-devel libcurl-devel net-snmp-devel php php-gd php-xml php-mysql php-mbstring php-bcmath httpd libssh2-devel 安装的时候会要你选择,输入 y 即可。
五:导入数据库
注:按顺序导入即可 [root@localhost zabbix-2.0.3]# mysql -uzabbix -p'zabbix' zabbix < 【 你 的 zabbix 解压路径】/database/mysql/schema.sql [root@localhost zabbix-2.0.3]# mysql -uzabbix -p'zabbix' zabbix < 【 zabbix 解压路径】/database/mysql/images.sql [root@localhost zabbix-2.0.3]# mysql -uzabbix -p' zabbix ' zabbix < 【你的 zabbix 解压路径】/database/mysql/data.sql
注:找到对应的行修改就行,没有这行的添加进去 Server=192.168.1.127 //zabbix_server 上的 ListenIP ListenPort=10050 ListenIP=192.168.1.127(客户端 ip,因为是同一台机器,所以和服务器是一 样的) StartAgents=5 Hostname=zabbix [root@localhost zabbix-2.0.3]# cp -r 【 zabbix 解 压 路 径 】 /frontends/php /var/www/html/zabbix [root@localhost zabbix-2.0.3]# cp 【 zabbix 解 压 路 径 】
zabbix-源码包安装

服务器IP:192.168.30.199A.关闭SELINUX#vi /etc/selinux/configSELINUX=enforcing #注释掉SELINUXTYPE=targeted #注释掉SELINUX=disabled #增加:wq #保存退出#setenforce 0#使配置立即生效B.关闭iptables#chkconfig iptables off#service iptables stopC.卸载系统自带的mysql和http服务#rpm -e --nodeps mysql httpd1.安装lnmp环境#yum install gcc gcc-c++ make mysql-server mysql-devel libcurl-devel net-snmp-devel php php-ldap php-gd php-xml php-mysql php-bcmath httpd fping php-mbstring说明:/etc/httpd/conf/httpd.conf #apache配置文件路劲/usr/sbin/apachectl #apache的运行路劲/var/www/html #web目录/usr/bin/mysql #mysql的运行路径/var/lib/mysql #mysql数据库文件的存放路径/usr/lib/mysql #mysql的安装路径/etc/php.ini #PHP配置文件路劲#rpm -ql httpd mysql php #查看安装文件都在哪#service httpd start #开启http服务#service mysqld start#开启mysql服务#chkconfig httpd on #添加开机自动启动#chkconfig mysqld on #添加开机自动启动修改MySQL 配置文件,增加如下#vi /etc/fcharacter-set-server=utf8 #设置字符集为utf8innodb_file_per_table=1 #让innodb的每个表文件单独存储2.安装Zabbix1)添加zabbix用户和组#useradd zabbix -s /sbin/nologin #创建用户zabbix,不允许登陆系统2)安装zabbixcd /opt/zabbix-2.4.5#./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-net-snmp --with-libcurl --enable-proxy --with-mysql=/usr/bin/mysql_config#make && make install说明:--enable-server 启用zabbix-server服务--enable-agent 启用zabbix-agent客户端--with-net-snmp 支持SNMP服务--with-libcurl 支持web界面管理--enable-proxy 启用zabbix-proxy代理服务3)创建zabbix数据库,创建zabbix账号#mysql -u root -p #进入mysql控制台,密码为空create database zabbix character set utf8; #创建数据库zabbix,并且数据库编码使用utf8grant all on zabbix.* to 'zabbix'@'localhost' identified by '123456' with grant option;#创建新账号zabbix,密码为:123456。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
centos7 zabbix+apache+mysql安装部署1、安装所需的软件包yum install -y gcc php php-gd php-devel php-mysql php-bcmath php-ctytpe php-xml php -xmlreader php-xlmwriter php-session php-net-socket php-mbstring php-gettext httpd net-snmp curl curl-devel net-snmp net-snmp-devel perl-DBI mysql*2 、创建用户groupadd -g 201 zabbixuseradd -g zabbix -u 201 -m zabbix3、登录数据库,创建zabbix数据库,并授权zabbix用户从192.168.10.197主机登录mysql,使用的密码为123456为了加强安全性,MySQL5.7为root用户随机生成了一个密码,在error log中,关于error log的位置,如果安装的是RPM包,则默认是/var/log/mysqld.log。
只有启动过一次mysql才可以查看临时密码[root@linux-node2 ~]# mysql -uroot -pmysql>mysqladmin -u root -p oldpass password "Admin@123" ########修改密码#####mysql> use mysql;mysql>create database zabbix character set utf8;mysql>grant all privileges on zabbix.* to zabbix@'localhost' identified by '123456'; mysql> flush privileges;4、下载安装zabbixwget /unix/misc/zabbix-2.0.3.tar.gz# tar -zxvf zabbix-2.0.3.tar.gz#cd zabbix-2.203导入数据库表#cd zabbix-2.0.3/database/mysql#mysql -uroot -pmysqlzabbix<mysql.sql#mysql -uroot -pmysqlzabbix<images.sql#mysql -uroot -pmysqlzabbix<schema.sql5、启动zabbix server服务修改配置文件:vi /etc/zabbix/zabbix_server.confDBHost=localhostDBName=zabbixDBUser=zabbixDBPassword=1234566、将zabbix的页面文件copy到指定目录,cp zabbix-2.2.2/conf/zabbix_serve /etc/init.d/zabbix_servercp zabbix-2.2.2/conf/zabbix_serve /etc/init.d/zabbix_agentdmkdir /var/www/html/zabbixcp -a ./frontends/php/* /var/www/html/zabbixchown -R apache:apache /var/www/html/zabbix7、配置php文件,适应zabbix安装所需的参数。
vim /etc/php.inidate.timezone = Asia/Shanghaimax_execution_time = 300max_input_time = 300post_max_size = 32Mmemory_limit = 128Mmbstring.func_overload = 2always_populate_raw_post_data = -18、配置apache文件,定义安装访问zabbix的虚拟主机vim /etc/httpd/conf/httpd.confServerName127.0.0.1 :80DocumentRoot "/var/www/html"Listen 0.0.0.0:80 ####Apache默认是ipv6的,如果不修改将不能访问80端口####9、配置zabbix server端的文件,定义数据库的IP、用户名、密码vim /usr/local/zabbix/etc/zabbix_server.confDBHost=127.0.0.1DBName= zabbixDBUser=zabbixDBPassword=123456StartPollers=30 #开启多线程数,一般不要超过30个StartTrappers=20 #trapper线程数StartPingers=10 #fping线程数StartDiscoverers=120MaxHousekeeperDelete=5000CacheSize=1024M #用来保存监控数据的缓存数,根据监控主机的数量适当调整StartDBSyncers=8 #数据库同步时间HistoryCacheSize=1024MTrendCacheSize=128M #总趋势缓存大小HistoryTextCacheSize=512MAlertScriptsPath=/etc/zabbix/alertscriptsLogSlowQueries=100010、启动Apache 并设置开机启动systemctl start httpdsystemctl stop httpd 关闭systemctl enable httpd.service ####设置开机自动启动####11、mysql数据库启动systemctl start mariadbsystemctl stop mariadbsystemctl enable mariadb12、启动zabbix/etc/init.d/zabbix_server restart###########确保防火墙关闭############centos7关闭防火墙命令systemctl stop firewalld.servicesystemctl disable firewalld.service ####开机不启动#####13、使用浏览器打开:http://ip 先确保Apache服务正常14、打开zabbixhttp://ip/zabbix/setup.php15、php扩展未安装无法通过phpmbstring offphpbcmath off则需要如下操作wget /.help/CentOS6-Base-163.repo ##由于系统光盘的yum源缺少文件,所以无法安装,需要从网络上下载#####下载后将CentOS6-Base-163.repo替换原有的CentOS-Base.repo文件(或者复制如下内容到CentOS-Base.repo文件)[base]name=CentOS-$releasever - Base - baseurl=/centos/$releasever/os/$basearch/#mirrorlist=/?release=$releasever&arch=$basearch &repo=osgpgcheck=1gpgkey=/centos/RPM-GPG-KEY-CentOS-6#released updates[updates]name=CentOS-$releasever - Updates - baseurl=/centos/$releasever/updates/$basearch/#mirrorlist=/?release=$releasever&arch=$basearch &repo=updatesgpgcheck=1gpgkey=/centos/RPM-GPG-KEY-CentOS-6#additional packages that may be useful[extras]name=CentOS-$releasever - Extras - baseurl=/centos/$releasever/extras/$basearch/#mirrorlist=/?release=$releasever&arch=$basearch &repo=extrasgpgcheck=1gpgkey=/centos/RPM-GPG-KEY-CentOS-6#additional packages that extend functionality of existing packages [centosplus]name=CentOS-$releasever - Plus - baseurl=/centos/$releasever/centosplus/$basearch/ #mirrorlist=/?release=$releasever&arch=$basearch &repo=centosplusgpgcheck=1enabled=0gpgkey=/centos/RPM-GPG-KEY-CentOS-6#contrib - packages by Centos Users[contrib]name=CentOS-$releasever - Contrib - baseurl=/centos/$releasever/contrib/$basearch/#mirrorlist=/?release=$releasever&arch=$basearch &repo=contribgpgcheck=1enabled=0gpgkey=/centos/RPM-GPG-KEY-CentOS-6############清除缓存clean yum all然后进行安装yum install php-bcmathyum install php-mbstring安装成功后需要重启http、zabbix服务然后再端机retry按钮就通过了,16、提示无法访问数据库,或者是目录下缺少文件zabbix.conf.php会提示下载一个然后复制到相应的目录下即可然后就可以登录了zabbix默认的用户密码:admin/zabbix。