forked from elastic/logstash
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add script to hackily check for progress on a long import.
- Loading branch information
1 parent
8462bd0
commit 97d71ed
Showing
1 changed file
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/zsh | ||
|
||
if [ "$#" -ne 1 ] ; then | ||
echo "Usage; $0 logfile" | ||
exit 1 | ||
fi | ||
logfile="$1" | ||
|
||
pid=$(ps -u $USER -f | awk '/bin.logstash -[f]/ {print $2}') | ||
fileno=$(lsof -nPp $pid | grep -F "$logfile" | awk '{ print int($4) }') | ||
pos=$(awk '/pos:/ {print $2}' /proc/$pid/fdinfo/$fileno) | ||
starttime=$(awk '{print $22}' /proc/$pid/stat) | ||
curtime=$(awk '{print $1}' /proc/uptime) | ||
lines=$(dd if="$logfile" bs=$pos count=1 | wc -l) | ||
|
||
duration=$(($curtime - ($starttime / 100.))) | ||
rate=$(( $lines / (0.0 + $duration) )) | ||
|
||
echo "Duration: $duration" | ||
echo "Rate: $rate" | ||
|