-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmysql_status.sh
More file actions
executable file
·46 lines (37 loc) · 1.16 KB
/
mysql_status.sh
File metadata and controls
executable file
·46 lines (37 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
#---------------------------------------------------------------#
# ScriptsName: mysql_status.sh #
# ScriptsPath:/github/scripts/mysql.status.sh #
# Purpose: <zabbix monitor scripts> #
# check MySQL various State value push to zabbix page #
# Edition: 1.1 #
# CreateDate:2016-06-19 13:31 #
# Author: Payne Zheng <zzuai520@live.com> #
#---------------------------------------------------------------#
Variable=$1
MysqlUser=zabbixagent
MysqlPasswd=zabbixagent
MysqlBin="/usr/bin/mysql"
LogInShow() {
local KeyWord
KeyWord=$1
Value=$("$MysqlBin" -u "$MysqlUser" -p"$MysqlPasswd" -e "show status;" | \
awk '/'$KeyWord'/{print $2}')
echo $Value
}
case $Variable in
"Threads_running" )
LogInShow $Variable
;;
"Threads_created" )
LogInShow $Variable
;;
"Threads_connected" )
LogInShow $Variable
;;
"Threads_cached" )
LogInShow $Variable
;;
* )
exit 0
esac