Javascript REST API proxy with HTML UI, nodeJS and iControl module
Problem this snippet solves:
1) Provides browser interface to REST API.
2) Provides an all javascript inclusive app for managing BigIP objects. Enable/Disable/Add/Edit pool members. Only pool members for now.
3) Provides an API proxy via the use of Node.JS .
Most scripts require an application or the CLI to launch or to integrate with. This app offers a GUI interface, in many ways similar to the BigIP GUI, rendered by a browser and served by Node.
NodeJS connects to the BigIP and creates the dynamic pages which are rendered by browser.
With NodeJS coming soon to the BigIP, this app could be installed on and served by the BigIP.
How to use this snippet:
Uses iControl proxy module from github, https://github.com/thwi/node-icontrol
First Install node.js on one of your machines from: https://nodejs.org
Next install the icontrol module: npm install icontrol
To run this:
1) copy snippet and save to file: e.g. bigip_rest_proxy.js
2) start node: node bigip_rest_proxy.js
<<This will start a web server listening on 8080
3) Securely Browse to https://ip_address_of_machine_ running_node:8080
This should work for 11.5 but I have only tested it in 11.6.
Also Note that the credentials for the bigip are hard-coded for now. Sorry. To put your own, go ahead and change them inside the 'connect' function, lines 180-181.
Code :
61606
Tested this on version:
11.6- Bill_Chipman_10NimbostratusYou didn't include the supporting files, just the single bigip_rest_proxy.js file.
- John_Alam_45640Historic F5 AccountYou need the iControl node module which is downloaded and installed using the : npm install icontrol command. Other modules needed are included in default node install. You will also need a certificate file and a private key files.. And you will need to modify the script to point to the location of these files. They are needed because the HTTP server started by the node.js side script accepts only SSL/TLS connections.
- Bency_TharakanNimbostratus
Does this need an adminstrator level permission? I was trying to use the script with an operator level access, but the nodejs script was exiting throwing an error.