Skip to content

Commit

Permalink
Fix py3 and bad index
Browse files Browse the repository at this point in the history
There's some minor non-py3 compat stuff and a bad index on modern
versions of mysql.

Closes chrisboulton#34

Signed-off-by: Phil Dibowitz <[email protected]>
  • Loading branch information
jaymzh committed Aug 31, 2021
1 parent d68aee1 commit 749c5c5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions mysql.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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]
Expand Down

0 comments on commit 749c5c5

Please sign in to comment.