2016-10-21 4 views
0

PowerShell iControl 스냅인을 통해 대기 F5 LTM 호스트에 대한 변경을 자동화하고 있습니다.iControl PowerShell 스냅인을 통해 F5 LTM에 보류중인 변경 사항이 있는지 확인하십시오.

자동화가 변경되기 전에 대기중인 F5 호스트와 라이브 F5 호스트간에 보류중인 변경 사항이 있는지 프로그래밍 방식으로 확인하고자합니다.

iControl 스냅인이나 API를 통해 보류중인 변경 사항을 확인할 수있는 방법이 있습니까?

답변

0

iControl Wiki에서 답변을 찾았습니다. get_sync_status_overview() 방법 "은 구성원으로 속해있는 모든 장치 그룹에서 현재 장치의 존재의 상태를 얻는다"

위키 참조 : 나는 다른 사람이 유용하게 사용할 수 있다는 PowerShell에서 다음 함수를 작성했습니다 https://devcentral.f5.com/wiki/iControl.Management__DeviceGroup__SyncStatus.ashx

같은 종류의 작업을 시도 할 때. 장치가 독립형이거나 그룹에있는 장치와 동기화되어 있으면 true를 반환하고 그룹에 동기화해야하는 F5 호스트가 변경된 경우 false를 반환하고 다른 모든 경우에는 오류를 반환합니다.

function Is-DeviceInSync 
{ 
    <# 
    .SYNOPSIS 
    Gets the sync status of F5 devices within the device group 
    #> 

    $syncStatus = (Get-F5.iControl).ManagementDeviceGroup.get_sync_status_overview() 

    if ($syncStatus.member_state -eq "MEMBER_STATE_STANDALONE") 
    { 
     write-host "This F5 device is standalone, no sync is required" 
     return $true 
    } 
    elseif ($syncStatus.member_state -eq "MEMBER_STATE_IN_SYNC") 
    { 
     write-host "This F5 device is in sync with members of its device group, no sync is required" 
     return $true 
    } 
    elseif ($syncStatus.member_state -eq "MEMBER_STATE_NEED_MANUAL_SYNC") 
    { 
     write-host "This F5 device is not standalone and changes have been made to this device that have not been synced to the device group" 
     return $false 
    } 
    elseif ($syncStatus.member_state -eq "MEMBER_STATE_SYNCING") 
    { 
     write-host "This F5 device is currently synching with devices in it's group, waiting 10 seconds before checking again..." 
     Start-Sleep -Seconds 10 
     Is-DeviceInSync 
    } 
    else 
    { 
     throw "This F5 device is not in a stable sync state with devices in it's group, please manually verify the sync state of this device before running this script again" 
    } 
} 

참고 :이 기능은 초기화-F5.iControl 기능이 실행 된 가정 사용자는 이미 F5 호스트로 인증