Last active
January 14, 2019 03:47
-
-
Save cakyus/19f3c44c3fe027b06f58162974e9bd30 to your computer and use it in GitHub Desktop.
Nmon data collector
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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