SET GLOBAL general_log_file='/var/lib/mysql/general.log'; SET GLOBAL log_output = 'FILE,TABLE'; SET GLOBAL general_log = 'ON'; SET GLOBAL general_log = 1;
2. check plugin pam show plugins SELECT plugin_name,plugin_version,plugin_status,plugin_type,plugin_library,plugin_author FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME LIKE '%pam%';
pg_ctl [root@teguhth ~]# su - postgres Last login: Sun May 12 08:18:13 WIB 2024 on pts/1 -bash-4.2$ pg_ctl -D /var/lib/pgsql/15/data status -bash: pg_ctl: command not found -bash-4.2$ -bash-4.2$ pg_ctl -D /var/lib/pgsql/15/data start -bash: pg_ctl: command not found -bash-4.2$ -bash-4.2$ pg_ctl -D /var/lib/pgsql/15/data stop -bash: pg_ctl: command not found -bash-4.2$ -bash-4.2$
1. Enable WAL (Write-Ahead Logging): PostgreSQL uses Write-Ahead Logging for durability. Ensure that your PostgreSQL server is configured to use WAL.
2. Create Audit Table: Create an audit table where you will log the changes.
CREATE TABLE audit_table ( id SERIAL PRIMARY KEY, table_name TEXT NOT NULL, action_type TEXT NOT NULL, old_data JSONB, new_data JSONB, changed_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP );
1. Query 1 SELECT @@servername as ServerName, command, percent_complete,total_elapsed_time, estimated_completion_time, start_time FROM sys.dm_exec_requests WHERE command IN ('RESTORE DATABASE','BACKUP DATABASE')
echo "run custom_service.sh <name_service>" PIDX=${1} # Mendapatkan PID dari proses mariadbd MARIADB_PID=$(pgrep $PIDX)
# Mendapatkan informasi tentang proses mariadbd dari top TOP_INFO=$(top -n 1 -b -p "$MARIADB_PID" | tail -n +8 | head -n 1) Mem_Total_mb=$(free -m | awk 'NR==2{printf "%.f", $2 }') Mem_Total_gb=$(free -m | awk 'NR==2{printf "%.2f", $2/1024 }')
# Mengekstrak nilai CPU dan penggunaan memori dari output top CPU_USAGE=$(echo "$TOP_INFO" | awk '{print $9}') MEMORY_USAGE=$(echo "$TOP_INFO" | awk '{print $10}') MEMORY_B=$(echo "$TOP_INFO" | awk '{print $6 }')
echo "CPU Usage(%) $PIDX : ${CPU_USAGE}%" echo "Memory Usage(%) $PIDX: ${MEMORY_USAGE}%" echo "Memory Usage $PIDX : ${MEMORY_B}" echo "Memory Total Server : $Mem_Total_mb MB or $Mem_Total_gb GB"