|
#!/bin/sh
|
|
|
|
PARAM=${1:-noexistent}
|
|
|
|
CACHE_FILE=/tmp/zbx-mysql_slave_status
|
|
test -z `/usr/bin/find ${CACHE_FILE} -mmin -5 2>/dev/null` && \
|
|
echo "SHOW SLAVE STATUS\\G" | mysql --defaults-file=/etc/mysql/debian.cnf \
|
|
--batch --skip-pager --skip-column-names >${CACHE_FILE}
|
|
cat ${CACHE_FILE} | perl -ne "print \$1 if m/\b${PARAM}: (.+)$/"
|
|
|