Forum Discussion
BGP Neighbor API
Hi guys,
Is there any way that I can retrieve output of this command "imish -e "show ip bgp neighbors" via API? Or if not, do you know how I can parse the output of this command from netmiko to something (for example: dictionary) that can be processed further? Thanks
You can run linux commands with REST-API as needed this a month go and you are using the API endpoint
and utilCmdArgs .mgmt/tm/util/bash
Check:
https://community.f5.com/t5/technical-forum/running-bash-commands-via-rest-api/td-p/272516
https://community.f5.com/t5/technical-forum/native-tmsh-bash-commands-via-rest-api/td-p/118662
- thuyngnhu
Altostratus
Is it possible for a imish call, not tmsh call?
If it is in Linux (using imish but not entering it, like in linux when you run tmsh list /sys .. for example ) I don't see why not and testing will give you answer you seek.
Other than that you can use the Ansible module "bigip_command" to do something like:
- name: BGP show
bigip_command:
commands: run util bash -c " xxxxx"
provider "{{ provider }}"
delegate_to: localhost
If you see issues add the commands in a bash script on the F5 and then trigger the script.
Not having right a F5 with a licensed routing module, so I am interested in your tests and if it worked 😀
Here is a working example:
curl -sku admin:xxxx https://xxxx/mgmt/tm/util/bash -X POST -H "Content-Type: application/json" -d "{\"command\":\"run\", \"utilCmdArgs\":\"-c 'ls -alt /var/log'\"}"
but better trigger a bash script file
curl -sku admin:xxxx https://xxxx/mgmt/tm/util/bash -X POST -H "Content-Type: application/json" -d "{\"command\":\"run\", \"utilCmdArgs\":\"-c 'bash /shared/niki.sh'\"}"
Also as I mentioned Ansible can be added with its commands module :
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com