Skip to content

Instantly share code, notes, and snippets.

@cakyus
Last active January 14, 2019 03:47
Show Gist options
  • Save cakyus/19f3c44c3fe027b06f58162974e9bd30 to your computer and use it in GitHub Desktop.
Save cakyus/19f3c44c3fe027b06f58162974e9bd30 to your computer and use it in GitHub Desktop.
Nmon data collector
#!/bin/bash
# Nmon data collector
# https://gist.github.com/cakyus/19f3c44c3fe027b06f58162974e9bd30
#
# Notes
# 1. Log directory must exist and user has write permission
# 2. Crontab example: 0 0 * * * /bin/bash /root/bin/nmon.bash
#
# This script did not:
# 1. Process nmon log
# 2. Compress log files
# 3. Purge log files
# Output directory
LOG_DIR=/var/log/nmon
# Interval between snapshot
INTERVAL=60
HOUR=$( date +"%H" )
MINUTE=$( date +"%M" )
# Number of snapshots in output file, until midnight
SNAPSHOTS=$(( (((24-$HOUR)*60-$MINUTE)*60)/$INTERVAL ))
/usr/bin/nmon -f -T -I 0.1 -s $INTERVAL -c $SNAPSHOTS -m $LOG_DIR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment