首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >是否有一种方法可以使用F5或任何其他语言从大ip文件中获取数据?

是否有一种方法可以使用F5或任何其他语言从大ip文件中获取数据?
EN

Stack Overflow用户
提问于 2019-03-05 17:46:24
回答 1查看 448关注 0票数 0

我不熟悉网络,但我有一个要求,我必须读取一个大in文件,并将虚拟ltm数据存储在一个文件中。

conf文件示例:

代码语言:javascript
复制
> 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

有人能帮我弄清楚吗?

EN

回答 1

Stack Overflow用户

发布于 2019-03-05 23:44:02

您可以编写一个tmsh脚本,以便在大IP上本地使用来查询这些信息,也可以使用iControl REST接口来查询它。当配置文件和策略被隐藏在父虚拟服务器对象的子集合中时,您可能会得到多个查询,从而精确地找到正确的信息。但是,在一个查询中,可以使用curl或Postman这样的工具提取名称、目的地(虚拟服务器的IP+port)和配置文件集合项:

代码语言:javascript
复制
https://ltm3.test.local/mgmt/tm/ltm/virtual?$select=name,destination,profilesReference&expandSubcollections=true

这将以以下json格式返回所有仅具有名称、ip+port和配置文件信息的虚拟服务器(仅显示带有策略的虚拟服务器以保持简洁性):

代码语言:javascript
复制
{
    "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设备执行此操作。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/55008715

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档