Zabbix monitoring MySQL script (for reference only)

Source: Internet
Author: User
Tags mysql client

MySQL Client Add

/etc/zabbix/zabbix_agentd.d, Userparameter_mysql.confuserparameter=mysql.version,mysql-  Vuserparameter=mysql.status[*],/etc/zabbix/scripts/chk_mysql.sh $1userparameter= Mysql.ping,mysqladmin-uzabbix-p123456-p3306-h10. 0.0. 6  ping | Grep-c Alive

MySQL Client monitoring script

mkdir/etc/zabbix/scripts/Touch/etc/zabbix/scripts/chk_mysql.shchmod u+x/etc/zabbix/scripts/Chk_mysql.shchown-R zabbix.zabbix/etc/zabbix/scripts/chk_mysql.sh/etc/zabbix/scripts/chk_mysql.sh#!/bin/sh#-------------------------------------------------------------------------------# author:kk# Email: [Email protected]163. Commysql_pwd='123456'Mysql_host='127.0.0.1'Mysql_port='3306'Echo"Please input one arguement:"fi Case$1 inchecho $result;;        Com_update) echo $result;;    Slow_queries);;    Com_select) echo $result;; Com_rollback) Result= '/application/mysql/bin/mysqladmin-u$mysql_user-h$mysql_host-p${mysql_pwd}-S $MYSQL _sock extended-status |grep-w"Com_rollbacK"|cut-d"|"-f3 'echo $result;; Questions) Result= '/application/mysql/bin/mysqladmin-u$mysql_user-h$mysql_host-p${mysql_pwd}-S $MYSQL _sock status|cut-f4-d":"|cut-f1-d"S"' echo $result;; Com_insert) Result= '/application/mysql/bin/mysqladmin-u$mysql_user-h$mysql_host-p${mysql_pwd}-S $MYSQL _sock extended-status |grep-w"Com_insert"|cut-d"|"-F3 ' Echo $result;; Com_delete) Result= '/application/mysql/bin/mysqladmin-u$mysql_user-h$mysql_host-p${mysql_pwd}-S $MYSQL _sock extended-status |grep-w"Com_delete"|cut-d"|"-F3 ' Echo $result;; Com_commit) Result= '/application/mysql/bin/mysqladmin-u$mysql_user-h$mysql_host-p${mysql_pwd}-S $MYSQL _sock extended-status |grep-w"Com_commit"|cut-d"|"-F3 ' Echo $result;; Bytes_sent) Result= '/application/mysql/bin/mysqladmin-u$mysql_user-h$mysql_host-p${mysql_pwd}-S $MYSQL _sock extended-status |grep-w"bytes_sent"|cut-d"|"-F3 ' Echo $result;; bytes_received) Result= '/application/mysql/bin/mysqladmin-u$mysql_user-h$mysql_host-p${mysql_pwd}-S $MYSQL _sock extended-status |grep-w"bytes_receiVed"|cut-d"|"-f3 'echo $result;; Com_begin) Result= '/application/mysql/bin/mysqladmin-u$mysql_user-h$mysql_host-p${mysql_pwd}-S $MYSQL _sock extended-status |grep-w"Com_begin"|Cut-D"|"-F3 ' Echo $result;; *) echo"usage:$0 (uptime| com_update| slow_queries| Com_select| com_rollback| Questions)"        ;; Esac


MySQL Stress test command

Mysqlslap-a-I. 10000-UROOT-P123.ASD

Server-Side execution gets the client host name

/application/zabbix/bin/zabbix_get-s 10.0.0.6-p 10050-k "System.hostname"

Server execution get client key value

/application/zabbix/bin/zabbix_get-s 10.0.0.6-p 10050-k "System.cpu.load[all,avg15]"

  

Server execution get client key value

/application/zabbix/bin/zabbix_get-s 10.0.0.6-p 10050-k "Mysql.status[uptime]"

  

Zabbix monitoring MySQL script (for reference only)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.