设为首页 收藏本站
查看: 441|回复: 0

[经验分享] Zabbix Monitor MySQL Manual

[复制链接]

尚未签到

发表于 2018-9-27 10:53:57 | 显示全部楼层 |阅读模式
  Notes:
  Red font color means get monitor values by Linux Command Line
  Blue font color means Zabbix Agent Standard Items Key
  Green font color means user-defined configuration in zabbix_agentd.userparams.conf and user-defined items key
1.       OS Level Monitor:
1.1.            System load
  Item description:
  The load average represents the average system load over a period of time; it can help to find out the capacity of CPU
  Linux Command:
  # uptime
  01:25:05 up 51 days,  1:23,  3 users,  load average: 3.00, 3.05, 3.02
  Zabbix Item Key:
  system.cpu.load[,avg1]
  Suggested Zabbix Trigger:
  {system.cpu.load[,avg1].min(300)}>10
1.2.            CPU utilization
  Item description:
  Show the percentage of total CPU utilization,For multiprocessor systems, the CPU values are global averages among all processors, it can help to find out system load problems
  
  Linux Command:
  #iostat–x 60
  avg-cpu:  %user   %nice %system %iowait  %steal   %idle
  0.15    0.01    1.61    0.23    0.00   98.01
  Calculation:
  CPU utilization=%user+%nice+%system=0.15+0.01+1.61=1.77
  Zabbix Item Key:
  last["system.cpu.util[,user,avg1]","system.cpu.util[,nice,avg1]","system.cpu.util[,system,avg1]"]
  Formula in Zabbix:
  last("system.cpu.util[,user,avg1]")+last("system.cpu.util[,nice,avg1]")+last("system.cpu.util[,system,avg1]")
  Suggested Zabbix Trigger:
  {last["system.cpu.util[,user,avg1]","system.cpu.util[,nice,avg1]","system.cpu.util[,system,avg1]"].min(300)}>10
l  Sys-io
  Item description:
  Show the percentage of CPU utilization that occurred while executing at the system level (kernel).
  
  Linux Command:
  #iostat –x 60
  avg-cpu:  %user   %nice %system %iowait  %steal   %idle
  0.15    0.01    1.61    0.23    0.00   98.01
  Zabbix Item Key:
  system.cpu.util[,system,avg1]
  Suggested Zabbix Trigger:
  {system.cpu.util[,system,avg1].min(300)}>10
l  User-io
  Item description:
  Show the percentage of CPU utilization that occurred while executing at the user level (application).
  
  Linux Command:
  #iostat –x 60
  avg-cpu:  %user   %nice %system %iowait  %steal   %idle
  0.15    0.01    1.61    0.23    0.00   98.01
  Zabbix Item Key:
  system.cpu.util[,user,avg1]
  Suggested Zabbix Trigger:
  {system.cpu.util[,user,avg1].min(300)}>10
1.3.            Swap utilization
  Item description:
  Display the total amount of free swap memory used in the system; it can help to find out memory usage problems
  
  Linux Command:
  #free
  total       used      free     shared    buffers     cached
  Mem:        252376     193632    58744     0      87840      52488
  -/+ buffers/cache: 53304     199072
  Swap:        522104     0 522104
  Zabbix Item Key:
  system.swap.size[,used]
  Suggested Zabbix Trigger:
  {system.swap.size[,used].last(0)}>1000000
1.4.            System buffer cache>
  Item description:
  The buffer cache helps programs to get to their data blocks faster by keeping recently used file blocks in memory, it can help MySQL tuning
  
  Linux Command:
  #free
  total       used      free     shared    buffers     cached
  Mem:        252376     193632    58744     0      87840      52488
  -/+ buffers/cache: 53304     199072
  Swap:        522104     0     522104
  Zabbix Item Key:
  vm.memory.size[buffers]
  Suggested Zabbix Trigger:
  not necessary
1.5.            MySQL instance memory occupation
  Item description:
  Show the MySQL instance physical memory usage, it can help MySQL tuning
  
  Linux Command:
  # cat /proc/$(pgrep -u mysql mysqld)/status |grep VmRSS
  VmRSS:     11744 Kb
  User-defined configuration:
  UserParameter=mysql.mem.use,cat /proc/$(pgrep -u mysql mysqld)/status |grep VmRSS |awk '{print $2}'
  Zabbix Item Key:
  mysql.mem.use
  Suggested Zabbix Trigger(It depends on Business Scenarios):
  {mysql.mem.use.min(300)}>3000000
  
1.6.            NIC traffic monitoring
  Item description:
  Show the NIC traffic receive and transmit, it can help to find out the abnormal traffic throughput between MySQL and application servers
  
  Linux Command:
  # ifconfig
  Zabbix Item Key:
  RX:
  net.if.in[eth3,bytes]   net.if.in[eth0,bytes]
  TX:
  net.if.out[eth3,bytes]  net.if.out[eth0,bytes]
  Suggested Zabbix Trigger(It depends on Business Scenarios):
  {net.if.in[eth0,bytes].min(300)}>10000000
  {net.if.out[eth0,bytes].min(300)}>10000000
  {net.if.in[eth3,bytes].min(300)}>10000000
  {net.if.out[eth3,bytes].min(300)}>10000000
1.7.            TCP buffer>
  Item description:
  Show the count of bytes in TCP receive queue and send queue, it can help to observe the TCP socket performance
l  Receive Queue
  Linux Command:
  #netstat -ant|grep ESTABLISHED|awk '{sum += $2} END {print sum}'
  0
  User-defined configuration:
  UserParameter=TCP.Recv.Queue,netstat -ant|grep ESTABLISHED|awk '{sum += $2} END {print sum}'
  Zabbix Item Key:
  TCP.Recv.Queue
  Suggested Zabbix Trigger:
  not necessary
l  Send Queue
  Linux Command:
  #netstat -ant|grep ESTABLISHED|awk '{sum += $3} END {print sum}'
  194032
  User-defined configuration:
  UserParameter=TCP.Send.Queue,netstat -ant|grep ESTABLISHED|awk '{sum += $3 } END {print sum}'
  Zabbix Item Key:
  TCP.Send.Queue
  Suggested Zabbix Trigger:
  not necessary
1.8.            NUMA status
  Item description:
  Show NUMA scheduler work status, it can help system performance tuning
  Linux Command:
  # numastat
  node0           node1
  numa_hit               466451682       650742379
  numa_miss                      0          111010
  numa_foreign              111010               0
  interleave_hit            928427          929122
  local_node             452653412       650663005
  other_node              13798270          190384
  User-defined configuration:
  UserParameter=numa.node0.hit,numastat |grep numa_hit|awk '{print $2}'
  UserParameter=numa.node1.hit,numastat |grep numa_hit|awk '{print $3}'
  UserParameter=numa.node0.miss,numastat |grep numa_miss|awk '{print $2}'
  UserParameter=numa.node1.miss,numastat |grep numa_miss|awk '{print $3}'
  Zabbix Item Key:
  numa.node0.hit
  numa.node1.hit
  numa.node0.miss
  numa.node1.miss
  Suggested Zabbix Trigger:
  not necessary
2.       Disk Level Monitor:
2.1.            MySQL data partition's IO scheduler
  Item description:
  Show the MySQL data partition's IO scheduler mode; it can help MySQL performance tuning
  Linux Command:
  #cat /sys/block/sda/queue/scheduler
  noop anticipatory deadline [cfq]
  User-defined configuration:
  UserParameter=sda.io.scheduler,tr -s &quot; &quot; &quot;\n&quot; < /sys/block/sda/queue/scheduler|grep '\[.*\]'
  Zabbix Item Key:
  sda.io.scheduler
  Suggested Zabbix Trigger:
  not necessary
2.2.            MySQL data partition's IO read, write, read Bytes, write Bytes, iowait
  Item description:
  Show the MySQL data partition's IO status; it can help MySQL performance tuning, and help to find out the performance issues
  Notes:
  await=average IO Response Time (in milliseconds)
  avgrq-sz =average IO Chunk>
  avgqu-sz=average IO queue length
  r/s+w/s=IO Per Second
  rkB/s+wkB/s=Throughput(The number of kilobytes)
  %util=Percentage of CPU time during I/O requests
  
  
  Linux Command:
  # iostat -k -x -d 60
  Device: rrqm/swrqm/s r/s  w/s   rkB/s   wkB/s avgrq-sz avgqu-sz await svctm %util
  sda   0.00  0.37  0.00  0.58   0.00    3.80   13.03   0.00    0.17   0.09   0.01
  sda2  0.000.37  0.00  0.58   0.00    3.80   13.03   0.00    0.17   0.09   0.01
  Specify 60 seconds between each report and display statistics in kilobytes per second
  #nohup iostat -k -x -d 60 > /tmp/iostat_output &
  Notes: Hypothesis MySQL data partition is sda2
  User-defined configuration:
  UserParameter=sda2.rps,grep sda2 /tmp/iostat_output |tail -1|awk '{print $4}'
  UserParameter=sda2.wps,grep sda2 /tmp/iostat_output |tail -1|awk '{print $5}'
  UserParameter=sda2.rkBps,grep sda2 /tmp/iostat_output |tail -1|awk '{print $6}'
  UserParameter=sda2.wkBps,grep sda2 /tmp/iostat_output |tail -1|awk '{print $7}'
  UserParameter=sda2.avgrq-sz,grep sda2 /tmp/iostat_output |tail -1|awk '{print $8}'
  UserParameter=sda2.avgqu-sz,grep sda2 /tmp/iostat_output |tail -1|awk '{print $9}'
  UserParameter=sda2.await,grep sda2 /tmp/iostat_output |tail -1|awk '{print $10}'
  UserParameter=sda2.util,grep sda2 /tmp/iostat_output |tail -1|awk '{print $12}'
  Zabbix Item Key:
  sda2.rps
  sda2.wps
  sda2.rkBps
  sda2.wkBps
  sda2.avgrq-sz
  sda2.avgqu-sz
  sda2.await
  sda2.util
  IO Per Second = last[&quot;sda2.rps &quot;,&quot;sda2.wps &quot;]
  IO Throughput = last[&quot;sda2.rkBps&quot;,&quot;sda2.wkBps&quot;]
  Formula in Zabbix:
  IO Per Second =last(&quot;sda2.rps&quot;)+last(&quot;sda2.wps&quot;)
  IO Throughput =last(&quot;sda2.rkBps&quot;)+last(&quot;sda2.wkBps&quot;)
  Suggested Zabbix Trigger(It depends on Business Scenarios):
  {last(&quot;sda2.rps&quot;)+last(&quot;sda2.wps&quot;).min(300)}>1000
  {last(&quot;sda2.rkBps&quot;)+last(&quot;sda2.wkBps&quot;).min(300)}>1000
2.3.            Fsync flushing times
  Item description:
  It is>
  
  Linux Command:
  # cat /proc/sys/vm/dirty_writeback_centisecs
  499
  User-defined configuration:
  UserParameter=fsync.flush.time,cat /proc/sys/vm/dirty_writeback_centisecs
  Zabbix Item Key:
  fsync.flush.time
  Suggested Zabbix Trigger:
  not necessary
2.4.            File descriptor occupation
  Item description:
  Show the number of file descriptors open in all processes, it can help to find out the potential program issues or the network performance problem
  
  Linux Command:
  # cat /proc/sys/fs/file-nr
  510     0       3223952
  User-defined configuration:
  UserParameter=file.desciptor.used,cat /proc/sys/fs/file-nr|awk '{print $1}'
  Zabbix Item Key:
  file.desciptor.used
  Suggested Zabbix Trigger:
  {file.desciptor.used.min(300)}>10000
2.5.            RAID degradation status (using MegaCli or MegaCli64)
  Item description:
  Show the RAID degradation status, it can help to find out the HARD DISK work status
  
  Linux Command:
  Install MegaCli rpm Package:
  #rpm -ivh MegaCli-1.01.39-0.i386.rpm
  # MegaCli64 -cfgdsply -aALL|grep State
  State: Optimal
  State: Optimal
  User-defined configuration:
  UserParameter=raid.status,sudo /opt/MegaRAID/MegaCli/MegaCli64 –cfgdsply –aALL -NoLog|grep Optimal|wc -l
  Zabbix Item Key:
  raid.status
  Suggested Zabbix Trigger:
  {raid.status.last(0)}

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-602720-1-1.html 上篇帖子: centos 下安装mysql 下篇帖子: mysql权限角色管理
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表