コード例 #1
0
def collect(session, header, minute_cpt):
    stmt = """SELECT
  conn_status.channel_name as channel_name,
  conn_status.service_state as IO_thread,
  applier_status.service_state as SQL_thread,
  conn_status.LAST_QUEUED_TRANSACTION as last_queued_transaction,
  applier_status.LAST_APPLIED_TRANSACTION as last_applied_transaction,
  if(LAST_APPLIED_TRANSACTION_ORIGINAL_COMMIT_TIMESTAMP = 0, 0,
  LAST_APPLIED_TRANSACTION_END_APPLY_TIMESTAMP -
                            LAST_APPLIED_TRANSACTION_ORIGINAL_COMMIT_TIMESTAMP) 'rep delay (sec)',                         
  LAST_QUEUED_TRANSACTION_START_QUEUE_TIMESTAMP -
                           LAST_QUEUED_TRANSACTION_ORIGINAL_COMMIT_TIMESTAMP 'transport time',
  LAST_QUEUED_TRANSACTION_END_QUEUE_TIMESTAMP -
                           LAST_QUEUED_TRANSACTION_START_QUEUE_TIMESTAMP 'time RL',
  LAST_APPLIED_TRANSACTION_END_APPLY_TIMESTAMP -
                           LAST_APPLIED_TRANSACTION_START_APPLY_TIMESTAMP 'apply time',
  if(GTID_SUBTRACT(LAST_QUEUED_TRANSACTION, LAST_APPLIED_TRANSACTION) = "","0" ,
      abs(time_to_sec(if(time_to_sec(APPLYING_TRANSACTION_ORIGINAL_COMMIT_TIMESTAMP)=0,0,
      timediff(APPLYING_TRANSACTION_ORIGINAL_COMMIT_TIMESTAMP,now()))))) `lag_in_sec`
FROM
  performance_schema.replication_connection_status AS conn_status
JOIN performance_schema.replication_applier_status_by_worker AS applier_status
  ON applier_status.channel_name = conn_status.channel_name"""
    common._run_me(session, stmt, header, "replication.txt")

    return
コード例 #2
0
def collect(session, header, minute_cpt):
    stmt = "select unix_timestamp() as `timestamp`, t1.* from performance_schema.status_by_user as t1"
    common._run_me(session, stmt, header, "status_by_user.txt")
    stmt = "select unix_timestamp() as `timestamp`, t1.* from performance_schema.status_by_host as t1"
    common._run_me(session, stmt, header, "status_by_host.txt")
    stmt = "select unix_timestamp() as `timestamp`, t1.* from performance_schema.status_by_thread as t1"
    common._run_me(session, stmt, header, "status_by_thread.txt")
    stmt = "select unix_timestamp() as `timestamp`, t1.* from performance_schema.status_by_account as t1"
    common._run_me(session, stmt, header, "status_by_account.txt")
    stmt = "show global status"
    common._run_me(session, stmt, header, "global_status.txt")
    return
コード例 #3
0
def collect(session, header, minute_cpt):
    if (minute_cpt == 1) or (minute_cpt % 60 == 0):
        stmt = """SELECT unix_timestamp() as `timestamp`, schema_name, format_pico_time(total_latency) tot_lat,   
       exec_count, format_pico_time(total_latency/exec_count) latency_per_call, 
       query_sample_text 
  FROM sys.x$statements_with_runtimes_in_95th_percentile AS t1
  JOIN performance_schema.events_statements_summary_by_digest AS t2 
    ON t2.digest=t1.digest 
 WHERE schema_name NOT in ('performance_schema', 'sys') 
ORDER BY (total_latency/exec_count) desc LIMIT 10"""
        common._run_me(session, stmt, header, "queries.txt")
    return
コード例 #4
0
def collect(session, header, minute_cpt):
    if (minute_cpt == 1) or (minute_cpt % 60 == 0):
        stmt = """select timestamp, device, total_bytes, available_bytes, 
                         use_percent, mount_point 
                  from performance_schema.health_block_device t1 order by timestamp desc limit 1"""
        common._run_me(session, stmt, header, "mds_block_device.txt")
        stmt = """select * from performance_schema.health_process_memory order by timestamp desc limit 1"""
        common._run_me(session, stmt, header, "mds_process_memory.txt")
        stmt = """select * from performance_schema.health_system_memory order by timestamp desc limit 1"""
        common._run_me(session, stmt, header, "mds_system_memory.txt")
    return
コード例 #5
0
ファイル: metrics.py プロジェクト: lefred/mysqlshell-plugins
def collect(session, header, minute_cpt):
    stmt = "select unix_timestamp() as `timestamp`, t1.* from sys.metrics as t1"
    common._run_me(session, stmt, header, "metrics.txt")
    return
コード例 #6
0
def collect(session, header, minute_cpt):
    if (minute_cpt == 1) or (minute_cpt % 60 == 0):
        stmt = "show engine innodb status"
        common._run_me(session, stmt, header, "innodb_status.txt")
    return
コード例 #7
0
def collect(session, header, minute_cpt):
    stmt = """select unix_timestamp() as `timestamp`, t1.* from sys.processlist t1 
              where pid is not NULL"""
    common._run_me(session, stmt, header, "processlist.txt")

    return
コード例 #8
0
def collect(session, header, minute_cpt):
    if (minute_cpt == 1) or (minute_cpt % 60 == 0):
        stmt = "select unix_timestamp() as `timestamp`, t1.* from sys.host_summary as t1"
        common._run_me(session, stmt, header, "host_summary.txt")
    return