Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions agent360/plugins/cloudlinux.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,14 @@ def run(self, config):
except Exception:
return "Could not load lveinfo data"

if data['success'] is not 1:
if data['success'] != 1:
return "Failed to load lveinfo"

results = {}

for line in data['data']:
username = line['ID']
# ID may be an int (UID without a username), keys must be uniform
username = str(line['ID'])
del line['ID']
results[username] = line

Expand Down
34 changes: 21 additions & 13 deletions agent360/plugins/mysql.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,29 +129,37 @@ def run(self, config):
pass

cursor = db.cursor(MySQLdb.cursors.DictCursor)
cursor.execute('SHOW SLAVE STATUS')
query_result_slave = cursor.fetchone()
# Try MySQL 8.4+ syntax first, fall back to older syntax for backward compatibility
try:
cursor.execute('SHOW REPLICA STATUS')
query_result_slave = cursor.fetchone()
except MySQLdb.OperationalError:
cursor.execute('SHOW SLAVE STATUS')
query_result_slave = cursor.fetchone()

# Support both old and new column names
non_delta_slave = (
'slave_io_state',
'master_host',
'seconds_behind_master',
'read_master_log_pos',
'slave_io_state', 'replica_io_state',
'master_host', 'source_host',
'seconds_behind_master', 'seconds_behind_source',
'read_master_log_pos', 'read_source_log_pos',
'relay_log_pos',
'slave_io_running',
'slave_sql_running',
'slave_io_running', 'replica_io_running',
'slave_sql_running', 'replica_sql_running',
'last_error',
'exec_master_log_pos',
'exec_master_log_pos', 'exec_source_log_pos',
'relay_log_space',
'slave_sql_running_state',
'master_retry_count'
'slave_sql_running_state', 'replica_sql_running_state',
'master_retry_count', 'source_retry_count'
)
if query_result_slave is None:
query_result_slave = dict()
for key, value in query_result_slave.items():
key = key.lower().strip()
if key == 'slave_sql_running':
# Handle both old and new column names
if key in ('slave_sql_running', 'replica_sql_running'):
value = 1 if value == 'Yes' else 0
if key == 'slave_io_running':
if key in ('slave_io_running', 'replica_io_running'):
value = 1 if value == 'Yes' else 0

for c in constructors:
Expand Down
Loading