diff --git a/mysql.py b/mysql.py index 95f9bb1..768f7b4 100644 --- a/mysql.py +++ b/mysql.py @@ -349,7 +349,7 @@ def fetch_mysql_status(conn): status[row['Variable_name']] = row['Value'] # calculate the number of unpurged txns from existing variables - if 'Innodb_max_trx_id' in status: + if 'Innodb_max_trx_id' in status and 'Innodb_purge_trx_id' in status: status['Innodb_unpurged_txns'] = int(status['Innodb_max_trx_id']) - int(status['Innodb_purge_trx_id']) if 'Innodb_lsn_last_checkpoint' in status: @@ -582,8 +582,8 @@ def read_callback(): collectd.register_config(configure_callback) if __name__ == "__main__" and not COLLECTD_ENABLED: - print "Running in test mode, invoke with" - print sys.argv[0] + " Host Port User Password " + print("Running in test mode, invoke with") + print(sys.argv[0] + " Host Port User Password ") MYSQL_CONFIG['Host'] = sys.argv[1] MYSQL_CONFIG['Port'] = int(sys.argv[2]) MYSQL_CONFIG['User'] = sys.argv[3]