Automate Replication Status check | Nutanix Community
Skip to main content
I am looking for a something that i can setup in an automated task on a server to poll for any active replications for Protection Domains and if true to pull information and email it. The output i am looking for in the email would be something like below.



Protection Domain : ProtectionDomainName

Replication Operation : Sending

Start Time : 03/11/2019 12:00:02 EDT

Remote Site : RemoteSiteName

Snapshot Id : 2918635

Bytes Completed : 444.08 MiB (465,653,447 bytes)

Snapshot Size : 2.57 GiB (2,760,598,528 bytes)

Complete Percent : 95.38689



If anyone already has something like this setup that would be awesome, my scripting skills are slim to none so any help would be awesome.

@BSchaffer Sorry that it has taken this long for us to get back to you.

 

This could be improved a lot more but it works, the script could be something like:

========================================================================

#!/bin/bash

ncli pd ls-repl-status > Replications 

if grep "None" ./Replications; then

echo "No replication is Running now"; 

else

/home/nutanix/serviceability/bin/email-alerts --to_address="comma separated email addresses" --subject="======== Replications running ========>>> `cat ./Replications`"

echo ====> Email was Sent 

fi

========================================================================

You should change its permission so it can be executed and then add it to cron jobs in a CVM in the cluster. This wont really poll any process in the cluster but it can run every minute or so to report any replication that is still running at the top of every 5 minutes

/usr/bin/crontab -l && echo "*/5 * * * * bash -lc  <the-script-name>") | /usr/bin/crontab -

 

This will add load to the cvm it run on, and I do recommend you check this with nutanix support if you are really implementing it

 

Regards,

 

-Said