h5制作网站,wordpress手写字体,郑州网站建设专家,做网站需要数据储存么准备一个纯净环境10.0.0.99首先修改yum源#xff0c;修改为zabbix清华源#xff0c;清华源玉zabbix官方源都是同步的#xff0c;下载速度更快#xff01;zabbix官方Download Zabbixwww.zabbix.com点击下载#xff0c;下面有zabbix的历史版本以及官方安装文档可以查看到不…准备一个纯净环境10.0.0.99首先修改yum源修改为zabbix清华源清华源玉zabbix官方源都是同步的下载速度更快zabbix官方Download Zabbixwww.zabbix.com点击下载下面有zabbix的历史版本以及官方安装文档可以查看到不同版本的官方维护周期方便我们下载清华源Tsinghua Open Source Mirrormirrors.tuna.tsinghua.edu.cn选择版本在清华源选择的时候可以按照官方的路径去选择rpm -ivh rpm -ivh https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm配置zabbix的yum源[roothb-99 ~]# ll /etc/yum.repos.d/
total 40
-rw-r--r--. 1 root root 2523 Jun 16 2018 CentOS-Base.repo
-rw-r--r--. 1 root root 1309 Nov 23 2018 CentOS-CR.repo
-rw-r--r--. 1 root root 649 Nov 23 2018 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root 314 Nov 23 2018 CentOS-fasttrack.repo
-rw-r--r--. 1 root root 630 Nov 23 2018 CentOS-Media.repo
-rw-r--r--. 1 root root 1331 Nov 23 2018 CentOS-Sources.repo
-rw-r--r--. 1 root root 5701 Nov 23 2018 CentOS-Vault.repo
-rw-r--r-- 1 root root 664 May 11 2018 epel.repo
-rw-r--r-- 1 root root 451 Jul 11 18:35 zabbix.repo #这个屌炸天得清华源修改/etc/yum.repos.d/zabbix.repo文件
[zabbix]
nameZabbix Official Repository - $basearch
baseurlhttps://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/4.0/rhel/7/$basearch/
enabled1
gpgcheck0
gpgkeyfile:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591[zabbix-non-supported]
nameZabbix Official Repository non-supported - $basearch
baseurlhttps://mirrors.tuna.tsinghua.edu.cn/zabbix/non-supported/rhel/7/$basearch/
enabled1
gpgkeyfile:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
gpgcheck0下载zabbix
# yum install zabbix-server-mysql zabbix-web-mysql -y安装数据库mariadb[roothb-99 ~]# yum install mariadb-server.x86_64 -y
[roothb-99 ~]# systemctl start mariadb.service
[roothb-99 ~]# systemctl enable mariadb.service 优化数据库
[roothb-99 ~]# mysql_secure_installation
回车 n y y y yNOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDBSERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!In order to log into MariaDB to secure it, well need the current
password for the root user. If youve just installed MariaDB, and
you havent set the root password yet, the password will be blank,
so you should just press enter here.Enter current password for root (enter for none): # 输入当前root用户密码当前密码为空 ---- 回车即可
OK, successfully used password, moving on...Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.Set root password? [Y/n] n # 是否给root用户设置密码... skipping.By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.Remove anonymous users? [Y/n] y # 是否删除空用户... Success!Normally, root should only be allowed to connect from localhost. This
ensures that someone cannot guess at the root password from the network.Disallow root login remotely? [Y/n] y # 是否禁止root远程登陆... Success!By default, MariaDB comes with a database named test that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.Remove test database and access to it? [Y/n] y # 是否删除test测试库 - Dropping test database...... Success!- Removing privileges on test database...... Success!Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.Reload privilege tables now? [Y/n] y # 是否刷新数据库... Success!Cleaning up...All done! If youve completed all of the above steps, your MariaDB
installation should now be secure.
创建数据库授权mysql
create database zabbix character set utf8 collate utf8_bin; 修改字符集指定好符集以后不会乱码
grant all privileges on zabbix.* to zabbixlocalhost identified by zabbix;将zabbix初始数据导入库zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -pzabbix zabbix修改zabbix配置文件[root98 ~]# egrep ^DB /etc/zabbix/zabbix_server.conf
DBHostlocalhost
DBNamezabbix
DBUserzabbix
DBPasswordzabbixzabbix日志文件记录错误[rootzabbix-server ~]# ll /var/log/zabbix/zabbix_server.log
-rw-rw-r-- 1 zabbix zabbix 4223 Jul 8 10:52 /var/log/zabbix/zabbix_server.log启动服务检查进程[root98 ~]# systemctl start zabbix-server.service
[root98 ~]# 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.
[root98 ~]# systemctl is-active zabbix-server.service
active
[root98 ~]# netstat -luntp|grep 10051 #检查端口开启服务才是真正得开启
tcp 0 0 0.0.0.0:10051 0.0.0.0:* LISTEN 9719/zabbix_server
tcp6 0 0 :::10051 :::* LISTEN 9719/zabbix_server 修改时区[root98 ~]# grep Asia/Shanghai /etc/httpd/conf.d/zabbix.confphp_value date.timezone Asia/Shanghai启动httpd[rootzabbix-server ~]# systemctl start httpd.service
[rootzabbix-server ~]# systemctl enable httpd.serviceweb
配置zabbix网站http://10.0.0.98/zabbix/setup.php用户名Admin 密码zabbix压力测试用于测试高并发数量利于监控ab -n 200000 -c 300 http://10.0.0.98/zabbix/zabbix.php
-n 数量
-c 次数 zabbix客户端部署安装客户端软件yum install zabbix-agent -y
[rootzabbix-server ~]# egrep ^Server /etc/zabbix/zabbix_agentd.conf
Server127.0.0.1 #改成服务端IP即可
systemctl start zabbix-agent.service
systemctl enable zabbix-agent.service修改配置文件/etc/zabbix/zabbix_agentd.conf UserParametertcp.estab,netstat -antp|grep -c ESTABLISHEDweb界面配置配置---主机---创建主机---*号的必填---点击主机名----配置模板----重启服务端创建监控项---配置触发器查看yum下载的历史命令 201 yum history 202 yum history info 4203 yum history info 5错误案例# 更改用户权限或者命令权限4755服务端收集信息慢导致超时解绝方法[rootweb01 ~]# grep # Timeout /etc/zabbix/zabbix_agentd.conf
# Timeout3 #设置超时时间zabbix_get命令执行时间
[rootweb01 ~]# 常见的linux监控命令free #查看内存
df #查看磁盘大小
top #查看内存磁盘负载等
uptime #当前时间运行时间用户数量负载
who #查看登陆用户数量及其负载
iostat #查看磁盘的读写效率及其压力
[rootweb01 ~]# top
top - 20:21:37 up 4:43, 4 users, load average: 0.00, 0.06, 0.06
当前系统时间 系统运行时间 系统登陆用户 负载信息
Tasks: 134 total, 1 running, 133 sleeping, 0 stopped, 0 zombie
总进程数量 运行的数量 休眠的数量 停止的进程 僵尸进程
%Cpu(s): 2.0 us, 1.7 sy, 0.0 ni, 96.3 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
us #用户进程占用cpu资源百分比
sy #内核态进程占用的cpu资源百分比
ni #用户进程空间内改变过优先级的进程cpu百分比
改变进程优先级的命令renice -10 -p pid
进程优先级排序 -1 ....20 数字越小执行越优先
wa #等待输入输出io)进程占用的百分比
hi #硬中断
si #软中端
st #虚拟机占用内存的百分比真实的服务器可见
KiB Mem : 997956 total, 624784 free, 173148 used, 200024 buff/cache
内存信息
KiB Swap: 1048572 total, 1048572 free, 0 used. 629432 avail Mem
swap分区信息PID USER PR NI VIRT RES SHR S %CPU %MEM TIME COMMAND 775 root 20 0 298708 6104 4776 S 0.3 0.6 0:26.33 vmtoolsd 1277 root 20 0 590168 15012 4904 S 0.3 1.5 1:04.17 glusterd
PID #进程号
PR #进程优先级
NI #优先级的值负数表示优先级很高正数表示优先级比较低
VIRT #虚拟内存
虚拟内存物理内存swap
1、进程需要的虚拟内存大小包括进程使用的库、代码、数据等
2、假如进程申请100m的内存但实际只使用了10m那么它会增长100m而不是实际的使用量
RES #常驻内存
1、进程当前使用的内存大小但不包括swap out
2、包含其他进程的共享
3、如果申请100m的内存实际使用10m它只增长10m与VIRT相反
4、关于库占用内存的情况它只统计加载的库文件所占内存大小
SHR #共享内存
1、除了自身进程的共享内存也包括其他进程的共享内存
2、虽然进程只使用了几个共享库的函数但它包含了整个共享库的大小
3、计算某个进程所占的物理内存大小公式RES – SHR
4、swap out后它将会降下来常见的Linux系统监控命令 - SSgeek - 博客园www.cnblogs.com