updted mysql scripts to zabbix 3.0 and newest ss_get_mysql_stats

This commit is contained in:
Gerard Stanczak
2016-07-07 20:28:16 +02:00
parent 198fed313a
commit b4dc231893
4 changed files with 384 additions and 419 deletions

View File

@@ -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)

View File

@@ -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