rubrikinc / rubrik-sdk-for-powershell

Rubrik Module for PowerShell
https://build.rubrik.com/sdks/powershell/
MIT License
102 stars 87 forks source link

a way to easily link mssqlinstance to AG to host would be super cool #417

Closed tbroady closed 4 years ago

tbroady commented 5 years ago

so in my environment I have AGs that have same names (ie 3 AGs named AG1 and so on) AND replicated databases between instances that share a name. We protect via the AG.

using get-rubrikdatabase -name I can get the AG id via 'effectivesourceslaobjectid', and then go to get-rubrikavailabilitygroup -id , but there isn't any host information returned.

it would really help with a certain process I am working on if I could easily go from database and/or AG to hostname (primary hostname or host where backup was last taken would be sufficient)

it would be amazing to have it in get-rubrikavailabilitygroup as well as get-rubrikdatabase (again primary or last backedup host, not sure how much info you have access to from the sql instance)

I do know mssqlinstance is in the replicas property of get-rubrikdatabase, but the way it's presented is difficult to use. and I know in get-rubriksqlinstance host name is in rootproperties, but again, it's slightly difficult to pull out.

a property of lastbackeduphostname in get-rubrikdatabase, would be ideal.

jaapbrasser commented 5 years ago

Hello tbroady,

First of all thanks for taking the time to submit an issue! I have some questions in regards to your request:

For both cases could you give an example of the current output, versus the output you would like to get, this would make it easier for me to see what your exact intentions are.

Make sure not to include any identifiable information when you post example output.

tbroady commented 5 years ago

so lets look at get-rubrikdatabase first. sample output below...

It really wouldn't help to unnest rootproperties, because I already have the AG id via effectiveSlaSourceObjectId, rootproperties duplicates this id @{rootType=MssqlAvailabilityGroup; rootId=MssqlAvailabilityGroup:::2bfdc6ea-e160-45cb-b70c-0b58611411fa; rootName=AG1}

ideally there would be a property like I've put in bold below. I could then pipe that to get-rubrikhost and get the host name via the name property of that command.

id : MssqlDatabase:::b085f25b-3654-4464-969d-845412902143

configuredSlaDomainName : Inherit

copyOnly : False

unprotectableReasons :

isInAvailabilityGroup : True

logBackupFrequencyInSeconds : 900

isLogShippingSecondary : False

effectiveSlaSourceObjectId : MssqlAvailabilityGroup:::2bfdc6ea-e160-45cb-b70c-0b58611411fa

hostProtectedFrom: Host:::1234567

rootProperties : @{rootType=MssqlAvailabilityGroup; rootId=MssqlAvailabilityGroup:::2bfdc6ea-e160-45cb-b70c-0b58611411fa; rootName=AG1}

primaryClusterId : 4fac961c-94a2-4782-a20c-275638d2ad69

isRelic : False

configuredSlaDomainId : INHERIT

effectiveSlaSourceObjectName : AG1

effectiveSlaDomainId : d559a4fb-a808-48e1-8646-c0ac86422fbb

effectiveSlaDomainName : SQL

name : Payroll

availabilityGroupId : MssqlAvailabilityGroup:::2bfdc6ea-e160-45cb-b70c-0b58611411fa

isLiveMount : False

logBackupRetentionHours : 48

slaAssignment : Derived

replicas : {@{recoveryForkGuid=B45FB583-9E9E-467D-9F47-700E096B9D58; hasPermissions=True; availabilityInfo=;

                           instanceId=MssqlInstance:::726bf820-849d-48cc-9755-1653a49327f6; recoveryModel=FULL; isArchived=False; isStandby=False; state=ONLINE; rootProperties=;

                           isDeleted=False; instanceName=MSSQLSERVER}, @{recoveryForkGuid=B45FB583-9E9E-467D-9F47-700E096B9D58; hasPermissions=True; availabilityInfo=;

                           instanceId=MssqlInstance:::93a9c64e-0333-44df-a2ee-1e9d9ed287fb; recoveryModel=FULL; isArchived=False; isStandby=False; state=ONLINE; rootProperties=;

                           isDeleted=False; instanceName=MSSQLSERVER}, @{recoveryForkGuid=B45FB583-9E9E-467D-9F47-700E096B9D58; hasPermissions=True; availabilityInfo=;

                           instanceId=MssqlInstance:::ebd60163-0a85-40e1-a888-7ee22417c18d; recoveryModel=FULL; isArchived=False; isStandby=False; state=ONLINE; rootProperties=;

                           isDeleted=False; instanceName=MSSQLSERVER}}
tbroady commented 5 years ago

for ags... I was thinking something like this... (again in bold)

logBackupFrequencyInSeconds : 900

PrimaryHost : host:::12345 SecondaryHost : host:::54321 (and so on for as many secondaries as exist)

slaAssignment : Direct

copyOnly : False

effectiveSlaSourceObjectId : MssqlAvailabilityGroup:::2bfdc6ea-e160-45cb-b70c-0b58611411fa

primaryClusterId : 4fac961c-94a2-4782-a20c-275638d2ad69

effectiveSlaDomainId : d559a4fb-a808-48e1-8646-c0ac86422fbb

effectiveSlaSourceObjectName : AG1

configuredSlaDomainName : SQL

effectiveSlaDomainName : SQL

id : MssqlAvailabilityGroup:::2bfdc6ea-e160-45cb-b70c-0b58611411fa

configuredSlaDomainId : d559a4fb-a808-48e1-8646-c0ac86422fbb

logRetentionHours : 48

name : AG1

clumnah commented 5 years ago

Jaap, we may need to work with engineering on this. They have classified an AG as a host in the product. The AG is the host and it references each child SQL instance as a replica server.


From: tbroady notifications@github.com Sent: Wednesday, July 31, 2019 11:29:21 PM To: rubrikinc/rubrik-sdk-for-powershell rubrik-sdk-for-powershell@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: Re: [rubrikinc/rubrik-sdk-for-powershell] a way to easily link mssqlinstance to AG to host would be super cool (#417)

for ags... I was thinking something like this... (again in bold)

logBackupFrequencyInSeconds : 900

PrimaryHost : host:::12345 SecondaryHost : host:::54321 (and so on for as many secondaries as exist)

slaAssignment : Direct

copyOnly : False

effectiveSlaSourceObjectId : MssqlAvailabilityGroup:::2bfdc6ea-e160-45cb-b70c-0b58611411fa

primaryClusterId : 4fac961c-94a2-4782-a20c-275638d2ad69

effectiveSlaDomainId : d559a4fb-a808-48e1-8646-c0ac86422fbb

effectiveSlaSourceObjectName : AG1

configuredSlaDomainName : SQL

effectiveSlaDomainName : SQL

id : MssqlAvailabilityGroup:::2bfdc6ea-e160-45cb-b70c-0b58611411fa

configuredSlaDomainId : d559a4fb-a808-48e1-8646-c0ac86422fbb

logRetentionHours : 48

name : AG1

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://nam03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Frubrikinc%2Frubrik-sdk-for-powershell%2Fissues%2F417%3Femail_source%3Dnotifications%26email_token%3DAFKMBSFMUBXXAEV6EVWFJODQCHY2DA5CNFSM4IIJ75F2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3IOYQI%23issuecomment-517008449&data=02%7C01%7C%7Cb461cbf9547e4759874008d715f5c5b8%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637002017629987349&sdata=yyCuyyVeNWpdTlOFZC7AtmLlCk00qG%2BuqK4FqA7bvpo%3D&reserved=0, or mute the threadhttps://nam03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAFKMBSG5TWGYMN34PJJY263QCHY2DANCNFSM4IIJ75FQ&data=02%7C01%7C%7Cb461cbf9547e4759874008d715f5c5b8%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637002017629997360&sdata=Tk34IcFZoLO2c5ty2q5PGrwghHFApTXH5r6%2FLficthQ%3D&reserved=0.

jaapbrasser commented 4 years ago

As this is something that we cannot do on the module we will have to wait for a future release before this can be implement, we will close this request for the time being.