BIG-IP Rest API

BIG-IP

アフィリエイト広告を利用しています

Powershellのガチのプロジェクトを経験したことにより、格段にwindowsが自動化できて楽に

なった、これに気をよくしたので現在BIG-IPの保守運用を楽にするためPowershellを使った

画面選択系簡単なツールを作成してみた。

このようなBIG-IP制御ツールは、大企業の運用部門でbashやvbsなど大金をかけてベンダーに発注するのをよく見かけるがpowershellでほぼ簡単に作成できる。

設計

iniファイルに管理用ExternalIPアドレス、APIを実行するユーザーなど記述し、メンテナンス性を考慮して設計する。

プログラム

以下サンプル画面

以下サンプルソース

curlの結果をパイプを使用して ConvertFrom-Json コマンドレットに渡す

ConvertFrom-Jsonコマンドレットは、JavaScript Object Notation(JSON)形式の文字列を、JSON文字列の各フィールドのプロパティを持つカスタムPSCustomObjectオブジェクトに変換します

    #Virtual Server
    ${bigipUrl} = "https://$BIG_VIP/mgmt/tm/ltm/virtual"
    ${bigipAPI} = curl.exe -k -u $UserInf -H "Content-Type: application/json" -X GET ${bigipUrl} | ConvertFrom-Json 
    Write-Host  "##############################################" -ForegroundColor Yellow
    Write-Host  "##"                                              -ForegroundColor Yellow
    Write-Host  "## 仮想サーバ"                                    -ForegroundColor Yellow
    Write-Host  "##"                                                -ForegroundColor Yellow
    Write-Host  "##############################################"     -ForegroundColor Yellow
    Write-Host "selfLink"${bigipAPI}.selfLink
    Write-Host "source"${bigipAPI}.items.source
    Write-Host "Name"${bigipAPI}.items.name
    Write-Host "destination"${bigipAPI}.items.destination
    Write-Host "pool"${bigipAPI}.items.pool
    Write-Host "rules"${bigipAPI}.items.rules

コメント

Loan Calculator

ローン計算

万円
%
ヶ月

タイトルとURLをコピーしました