Forum Discussion
How to efficiently delete a node from LTM?
Well, I prefer to think of it as a "customization" rather than a "hack," but that is a matter for debate, I suppose. In any event, very few customers pay attention to the "Description" fields, so I doubt we will include a field to manipulate them in an official iApp release. Your python scripts sound very clever. Let me know how things go.
cheers, Fred
an example
#!/usr/bin/python # -*- coding: UTF-8 -*- import sys import urllib2 import json def get_nginxapi(url): ct_headers = {'Content-type':'application/json'} request = urllib2.Request(url,headers=ct_headers) response = urllib2.urlopen(request) html = response.read() return html api = sys.argv[3] try: data = get_nginxapi(api) data = json.loads(data) except: data = '' m = 0 lowwater = int(sys.argv[4]) try: for peer in data['peers']: state = peer['state'] if state == 'up': m = m + 1 except: m = 0 #print data['peers'][]['state'] #print m if m >= lowwater: print 'UP'
very nice! I have another blog post coming up that is similar in idea. The basic idea is to collect the number of available upstreams and use that as information to update the BIG-IP. The article uses NGINX JavaScript (NJS) to do the lookup on NGINX (vs. externally via Python). Once the article is posted; I'll post the link here.
here's the article that I mentioned earlier: https://www.nginx.com/blog/just-one-post-declarative-dns-with-f5-and-nginx-javascript/