Accessing Mysql in Analytics¶
Quick Access to the Mysql DB¶
Use this script to get quick access to the Mysql DB:
#!/bin/sh
#
# Quicly enter Mysql
# Sets environment variables based on config
if [[ -x $(which mysql) ]]; then
MYSQL_PATH=$(which mysql)
else
echo "No apparent MySQL client exists! exiting..."
exit 1
fi
CONFIG_FILE='/etc/zenoss_analytics/zenoss_analytics.conf'
ETLHOSTNAME=`grep "^etl.jdbc.hostname" $CONFIG_FILE | cut -d"=" -f2`
ETLPORT=`grep "^etl.jdbc.port" $CONFIG_FILE | cut -d"=" -f2`
DBUSER=`grep "^etl.jdbc.username" $CONFIG_FILE | cut -d"=" -f2`
DBPASS=`grep "^etl.jdbc.password" $CONFIG_FILE | cut -d"=" -f2`
ETLDB=`grep "^etl.jdbc.dbname" $CONFIG_FILE | cut -d"=" -f2`
# Start mysql in this way to get to the right database:
$MYSQL_PATH -u $DBUSER --password=$DBPASS \
-h $ETLHOSTNAME -P$ETLPORT $ETLDB --skip-column-names -A
Dealing with Job Triggers¶
To see the Cronjobs for triggers from inside mysql:
select * from QRTZ_CRON_TRIGGERS;
Look at the Triggers:
select * from QRTZ_TRIGGERS; select trigger_name, trigger_state from QRTZ_TRIGGERS;
Remove all your batches from DB directly:
select extractor_key from meta_extractor where extractor_fqdn = 'mine.zenoss.loc'; # find the numbers it outputs : Say (20,22,31) delete from meta_batch where extractor_key in (20,22,31);