Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython
INSTALL>
pypm install python-dnslb

How to install python-dnslb

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install python-dnslb
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
Windows (64-bit)
Mac OS X (10.5+)
Linux (32-bit)
Linux (64-bit)
0.2.3 Available View build log
 
License
BSD
Dependencies
Lastest release
version 0.2.3 on Jan 9th, 2014

Python DNS LB & Traffic Director

This snippet of python is meant to be used with https://github.com/abh/geodns - a geo-aware DNS server in GO. The idea is to monitor a set of services and periodically generate a JSON zone based on the service instances that are up and responding correctly. This can be used as a poor-mans "global dns load balancer".

Installation

As alwasy, setting up a virtualenv might be a good idea but other than that do the usual, i.e in this case:

pip install python-dlslb

or

git clone git@github.com:leifj/python-dnslb.git cd python-dnslb ./setup.py install
Running

Create a yaml-file somewhere (lets call it example.com.yaml):

```yaml contact: hostmaster.example.com nameservers:

System Message: WARNING/2 (<string>, line 29); backlink

Inline literal start-string without end-string.

System Message: WARNING/2 (<string>, line 29); backlink

Inline interpreted text or phrase reference start-string without end-string.

System Message: ERROR/3 (<string>, line 32)

Unexpected indentation.
  • ns1.example.com
  • ns2.example.com

System Message: WARNING/2 (<string>, line 34)

Block quote ends without a blank line; unexpected unindent.
hosts:
host-1:
  • 1.2.3.4
host-2:
  • 1.2.3.5
  • 1.2.4.1
host-3
  • 4.3.2.1
aliases:
  • www
labels:
  • north-america
    • host-1
  • europe
    • host-2
    • host-3
checks:
  • check_http:

    vhost: "www.example.com"

    System Message: WARNING/2 (<string>, line 53)

    Block quote ends without a blank line; unexpected unindent.

    url: "/"

System Message: WARNING/2 (<string>, line 54)

Definition list ends without a blank line; unexpected unindent.

```

System Message: WARNING/2 (<string>, line 54); backlink

Inline literal start-string without end-string.

System Message: WARNING/2 (<string>, line 54); backlink

Inline interpreted text or phrase reference start-string without end-string.

Then run the following command:

dnslb --loglevel=DEBUG -z example.com.json -c example.com.yaml

The monitor will startup and connect to each IP address listed for all hosts in the hosts table, issuing a GET request for '/' with the Host header set to www.example.com Periodically the monitor will write a json zonefile to example.com.json. The zonefile will always list A and AAAA recoreds for the hosts but will only list A and AAAA for the zone (example.com in our case) and for each label for those addresses that passes the test (check_http in this case).

The zonefile can be fed directly into geodns.

NEWS

0.2

Release Date: Mon Apr 8 12:49:06 CEST 2013

  • Initial release
0.2.1

Release Date: Mon Apr 8 12:49:06 CEST 2013

  • Fixes label handling
0.2.2

Release Date: Wed Jul 31 13:59:43 CEST 2013

  • Conditionally export check_* depending on imports
0.2.3
  • Release Date: Fri Aug 16 10:19:08 CEST 2013*
  • better logging
  • email notification (beta)

Subscribe to package updates

Last updated Jan 9th, 2014

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.