Warning: this code is provided on a best effort basis and is not in any way officially supported or sanctioned by Cohesity. The code is intentionally kept simple to retain value as example code. The code in this repository is provided as-is and the author accepts no liability for damages resulting from its use.
This script shows the protection status for an object.
You can download the scripts using the following commands:
# download commands
curl -O https://raw.githubusercontent.com/cohesity/community-automation-samples/main/python/objectProtectionStatus/objectProtectionStatus.py
curl -O https://raw.githubusercontent.com/cohesity/community-automation-samples/main/python/pyhesity.py
chmod +x objectProtectionStatus.py
# end download commands- protectLinux.py: the main python script
- pyhesity.py: the Cohesity REST API helper module
Place both files in a folder together and run the main script like so:
./objectProtectionStatus.py -v mycluster \
-u admin \
-d mydomain.net \
-o myserver.mydomain.net \
-n mydatabase- -v, --vip: (optional) DNS or IP of the Cohesity cluster to connect to (default is helios.cohesity.com)
- -u, --username: (optional) username to authenticate to Cohesity cluster (default is helios)
- -d, --domain: (optional) domain of username (defaults to local)
- -t, --tenant: (optional) multi-tenancy tenant name
- -i, --useApiKey: (optional) use API key for authentication
- -pwd, --password: (optional) password or API key
- -np, --noprompt: (optional) do not prompt for password
- -mcm, --mcm: (optional) connect through MCM
- -c, --clustername: (optional) helios/mcm cluster to connect to
- -m, --mfacode: (optional) MFA code for authentication
- -e, --emailmfacode: (optional) send MFA code via email
- -s, --sourcename: (optional) name of registered source
- -o, --object: (optional) name of registered source or object to report
- -n, --dbname: (optional) name of database to report