Skip to main content

Posts

Showing posts from September, 2024

Load test Monitor script

 #!/bin/bash # Define logfile and other variables LOGFILE="/path/to/mongod.log"    # Path to MongoDB log file OUTPUT_FILE="/path/to/output.log" # Path where the output will be saved # Record the date echo "===== Date: $(date) =====" >> $OUTPUT_FILE # Record just the first line of w output (system uptime, users, and load average) echo "===== System Uptime, Users, and Load Average (w command) =====" >> $OUTPUT_FILE w | head -n 1 >> $OUTPUT_FILE # Record only the %user value from iostat echo "===== I/O Statistics (%user from iostat command) =====" >> $OUTPUT_FILE iostat | awk '/^ / {getline; print "User CPU: " $1 "%"}' >> $OUTPUT_FILE # Capture top processes, filtering for MongoDB (mongod) echo "===== Top Processes (top command) - Filter for mongod =====" >> $OUTPUT_FILE top -b -n 1 | grep mongod >> $OUTPUT_FILE # Filter MongoDB log for specific information (e....