我不熟悉网络,但我有一个要求,我必须读取一个大in文件,并将虚拟ltm数据存储在一个文件中。
conf文件示例:
> ltm virtual /Common/vs_test {
> destination /Common/10.01.01.111:80
> ip-protocol tcp
> mask 255.255.255.255
> policies {
> /Common/adt_vs_test {}
> }
> profile {
> /Common/ADT_DSS_A_G { }
> }
> rules {
> ....
> }
> security {
> ....
> }
}从这个文件中,我需要
虚拟服务器名称- vs_test IP:10.01.01.111 港口:80 安全策略: DSS_A_G
有人能帮我弄清楚吗?
发布于 2019-03-05 23:44:02
您可以编写一个tmsh脚本,以便在大IP上本地使用来查询这些信息,也可以使用iControl REST接口来查询它。当配置文件和策略被隐藏在父虚拟服务器对象的子集合中时,您可能会得到多个查询,从而精确地找到正确的信息。但是,在一个查询中,可以使用curl或Postman这样的工具提取名称、目的地(虚拟服务器的IP+port)和配置文件集合项:
https://ltm3.test.local/mgmt/tm/ltm/virtual?$select=name,destination,profilesReference&expandSubcollections=true这将以以下json格式返回所有仅具有名称、ip+port和配置文件信息的虚拟服务器(仅显示带有策略的虚拟服务器以保持简洁性):
{
"kind": "tm:ltm:virtual:virtualcollectionstate",
"selfLink": "https://localhost/mgmt/tm/ltm/virtual?$select=name%2Cdestination%2CprofilesReference&expandSubcollections=true&ver=14.0.0",
"items": [
{
"name": "bigvip_443",
"destination": "/Common/192.168.102.60:443",
"profilesReference": {
"link": "https://localhost/mgmt/tm/ltm/virtual/~Common~bigvip_443/profiles?ver=14.0.0",
"isSubcollection": true,
"items": [
{
"kind": "tm:ltm:virtual:profiles:profilesstate",
"name": "ASM_asm_test_policy",
"partition": "Common",
"fullPath": "/Common/ASM_asm_test_policy",
"generation": 569,
"selfLink": "https://localhost/mgmt/tm/ltm/virtual/~Common~bigvip_443/profiles/~Common~ASM_asm_test_policy?ver=14.0.0",
"context": "all",
"nameReference": {
"link": "https://localhost/mgmt/tm/security/bot-defense/asm-profile/~Common~ASM_asm_test_policy?ver=14.0.0"
}
},
{
"kind": "tm:ltm:virtual:profiles:profilesstate",
"name": "clientssl",
"partition": "Common",
"fullPath": "/Common/clientssl",
"generation": 553,
"selfLink": "https://localhost/mgmt/tm/ltm/virtual/~Common~bigvip_443/profiles/~Common~clientssl?ver=14.0.0",
"context": "clientside",
"nameReference": {
"link": "https://localhost/mgmt/tm/ltm/profile/client-ssl/~Common~clientssl?ver=14.0.0"
}
},
{
"kind": "tm:ltm:virtual:profiles:profilesstate",
"name": "http",
"partition": "Common",
"fullPath": "/Common/http",
"generation": 553,
"selfLink": "https://localhost/mgmt/tm/ltm/virtual/~Common~bigvip_443/profiles/~Common~http?ver=14.0.0",
"context": "all",
"nameReference": {
"link": "https://localhost/mgmt/tm/ltm/profile/http/~Common~http?ver=14.0.0"
}
},
{
"kind": "tm:ltm:virtual:profiles:profilesstate",
"name": "tcp",
"partition": "Common",
"fullPath": "/Common/tcp",
"generation": 553,
"selfLink": "https://localhost/mgmt/tm/ltm/virtual/~Common~bigvip_443/profiles/~Common~tcp?ver=14.0.0",
"context": "all",
"nameReference": {
"link": "https://localhost/mgmt/tm/ltm/profile/tcp/~Common~tcp?ver=14.0.0"
}
},
{
"kind": "tm:ltm:virtual:profiles:profilesstate",
"name": "websecurity",
"partition": "Common",
"fullPath": "/Common/websecurity",
"generation": 568,
"selfLink": "https://localhost/mgmt/tm/ltm/virtual/~Common~bigvip_443/profiles/~Common~websecurity?ver=14.0.0",
"context": "all",
"nameReference": {
"link": "https://localhost/mgmt/tm/ltm/profile/web-security/~Common~websecurity?ver=14.0.0"
}
}
]
}
},如果您用您选择的语言编写一个脚本,只从您的虚拟服务器返回您想要的数据,这将更加简洁,并且可以通过远程计算机对您拥有的许多大ip设备执行此操作。
https://stackoverflow.com/questions/55008715
复制相似问题