mdrisser
Dabbler
- Joined
- Nov 13, 2015
- Messages
- 19
This isn't a question, more like a solution.
I have had, and seen that others have had, the question of how to see the progress of a replication that is currently underway. I have seen 3 different answers to this.
1. It is too difficult to do
2. It used to be in the Web GUI, but it was removed for some unknown reason
The third answer was a snippet in a forum somewhere that showed that it actually is possible to see the progress, using the 'ps' command in a shell (ps auxwwU root | grep 'zfs:') (No, that is not a typo, the two 'w' given as part of the arguments to ps are required to remove the line length limit for the line that is returned). I tested it and it does indeed seem to show the progress of the replication, although I make no claims as to the accuracy of the progress shown. For those of us who, like me, need to be able to give an answer to the higher ups about the status, I've put together a little Python Script that will do that. I present that script to you here. It is not the most elegant solution, and could probably be improved upon, but it does give us something to give to the higher ups who may ask.
I hope you find this useful.
I have had, and seen that others have had, the question of how to see the progress of a replication that is currently underway. I have seen 3 different answers to this.
1. It is too difficult to do
2. It used to be in the Web GUI, but it was removed for some unknown reason
The third answer was a snippet in a forum somewhere that showed that it actually is possible to see the progress, using the 'ps' command in a shell (ps auxwwU root | grep 'zfs:') (No, that is not a typo, the two 'w' given as part of the arguments to ps are required to remove the line length limit for the line that is returned). I tested it and it does indeed seem to show the progress of the replication, although I make no claims as to the accuracy of the progress shown. For those of us who, like me, need to be able to give an answer to the higher ups about the status, I've put together a little Python Script that will do that. I present that script to you here. It is not the most elegant solution, and could probably be improved upon, but it does give us something to give to the higher ups who may ask.
Code:
#!/usr/local/bin/python import os # If your replications are running as a user other than root, change the name # here f = os.popen("ps auxwwU root | grep 'zfs:'") rep_status = f.read() f.close() rep_status = rep_status.split(' ') snapshot = rep_status[29] percentage = rep_status[30] percentage = percentage.strip('(').strip(':') transferred = rep_status[31] transferred = transferred.strip(')') transferred = transferred.split('/') trans_gb = int(transferred[0]) / 1024 / 1024 / 1024 trans_size_gb = int(transferred[1]) / 1024 / 1024 print "Snapshot: %s\n\t%scomplete\n\tTransferred %dGB of %dGB" % (snapshot, percentage, trans_gb, trans_size_gb)
I hope you find this useful.