@@ -0,0 +1,1852 @@
+import dns.resolver%0Aimport socket%0A%0A%0Aclass Py3status:%0A    %22%22%22%0A    This module launch a simple query on each nameservers for the specified domain.%0A    Nameservers are dynamically retrieved. The FQDN is the only one mandatory parameter.%0A    It's also possible to add additional nameservers by appending them in nameservers list.%0A%0A    The default resolver can be overwritten with my_resolver.nameservers parameter.%0A%0A    Written and contributed by @nawadanp%0A    %22%22%22%0A    def __init__(self):%0A        self.domain = 'google.com'%0A        self.lifetime = 0.3%0A        self.resolver = %5B%5D%0A        self.nameservers = %5B%5D%0A%0A    def ns_checker(self, i3status_output_json, i3status_config):%0A        response = %7B'full_text': '', 'name': 'ns_checker'%7D%0A        position = 0%0A        counter = 0%0A        error = False%0A        nameservers = %5B%5D%0A%0A        my_resolver = dns.resolver.Resolver()%0A        my_resolver.lifetime = self.lifetime%0A        if self.resolver:%0A            my_resolver.nameservers = self.resolver%0A%0A        my_ns = my_resolver.query(self.domain, 'NS')%0A%0A        # Insert each NS ip address in nameservers%0A        for ns in my_ns:%0A            nameservers.append(str(socket.gethostbyname(str(ns))))%0A        for ns in self.nameservers:%0A            nameservers.append(str(ns))%0A%0A        # Perform a simple DNS query, for each NS servers%0A        for ns in nameservers:%0A            my_resolver.nameservers = %5Bns%5D%0A            counter += 1%0A            try:%0A                my_resolver.query(self.domain, 'A')%0A            except:%0A                error = True%0A%0A        if error:%0A            response%5B'full_text'%5D = str(counter) + ' NS NOK'%0A            response%5B'color'%5D = i3status_config%5B'color_bad'%5D%0A        else:%0A            response%5B'full_text'%5D = str(counter) + ' NS OK'%0A            response%5B'color'%5D = i3status_config%5B'color_good'%5D%0A%0A        return (position, response)%0A

Add new module ns_checker.py