updted mysql scripts to zabbix 3.0 and newest ss_get_mysql_stats
This commit is contained in:
		| @@ -1,9 +1,16 @@ | ||||
| #!bin/bash | ||||
| #!/bin/bash | ||||
|  | ||||
| comma=1 | ||||
| echo -n "{\"data\":[" | ||||
|  | ||||
| for i in $(sudo /bin/find /var/lib/mysql -type f -printf %p+%s= | tr "=" "\n" | grep -v "\/mysql\/mysql\/" | grep "\.ibd" | cut -d "+" -f 1 | sed 's/@002d/\-/g' | cut -d "/" -f 5- | sed 's/.ibd//g' ); do | ||||
| if [ -e /san/mysql-fs/mysql ]; then | ||||
|   path="/san/mysql-fs/mysql/" | ||||
| else | ||||
|   path="/var/lib/mysql/" | ||||
| fi | ||||
|  | ||||
|  | ||||
| for i in $(sudo /bin/find $path -type f -printf %p+%s= | tr "=" "\n" | grep -v "\/mysql\/mysql\/" | grep "\.ibd" | cut -d "+" -f 1 | sed 's/@002d/\-/g' | cut -d "/" -f 5- | sed 's/.ibd//g' ); do | ||||
|  | ||||
|            dbname=$(echo $i | cut -d '/' -f 1) | ||||
|            tblname=$(echo $i | cut -d '/' -f 2) | ||||
|   | ||||
| @@ -12,12 +12,18 @@ if [ $# -ne 2 ]; then | ||||
|   exit 1 | ||||
| fi | ||||
|  | ||||
| if [ -e /san/mysql-fs/mysql ]; then | ||||
|   path="/san/mysql-fs/mysql/" | ||||
| else | ||||
|   path="/var/lib/mysql/" | ||||
| fi | ||||
|  | ||||
| cachefileage=$(($(date +%s) - $(stat -c %Y $cachefile))) | ||||
| process_running=$(ps aux | grep 'find /var/lib/mysql' | grep -v "grep" | wc -l) | ||||
|  | ||||
| if [ "$cachefileage" -gt 60 ] && [ "$process_running" -eq 0 ]; then | ||||
|  | ||||
|   sudo /bin/find /var/lib/mysql -type f -printf %p+%s= | tr "=" "\n" | grep -v "\/mysql\/mysql\/" | grep "\.ibd" | sed 's/@002d/\-/g' > $cachefile.$random | ||||
|   sudo /bin/find $path -type f -printf %p+%s= | tr "=" "\n" | grep -v "\/mysql\/mysql\/" | grep "\.ibd" | sed 's/@002d/\-/g' > $cachefile.$random | ||||
|  | ||||
|         if [ $? -eq 0 ]; then | ||||
|                 mv $cachefile.$random $cachefile | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Gerard Stanczak
					Gerard Stanczak