Advertisement
Guest User

Untitled

a guest
May 1st, 2024
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # Function to display disk partitions
  4. show_disk_partitions() {
  5. echo "Disk Partitions:"
  6. df -h | grep '^/dev'
  7. }
  8.  
  9. # Function to display detailed disk I/O activity
  10. show_detailed_disk_io_activity() {
  11. clear
  12. echo "Disk I/O Activity:"
  13. iostat -d 1 2
  14. sleep 1
  15. }
  16.  
  17. # Function to display a summary of disk I/O activity
  18. show_disk_io_summary() {
  19. echo "Disk I/O Summary:"
  20. iostat -d -x 1 2 | awk '/Device:/ || /sda/ {print}'
  21. }
  22.  
  23. # Main function to continuously monitor disk I/O activity
  24. monitor_disk_io() {
  25. while true; do
  26. show_detailed_disk_io_activity
  27. show_disk_io_summary
  28. show_disk_partitions
  29. done
  30. }
  31.  
  32. # Call the main function to start monitoring disk I/O activity
  33. monitor_disk_io
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement