How to use the libknot.control.KnotCtl function in libknot

To help you get started, we’ve selected a few libknot examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github CZ-NIC / knot / samples / stats_http.py View on Github external
def do_GET(self):
        self.send_response(200)
        self.send_header("Content-type", "text/html")
        self.end_headers()

        # Connect to Knot server.
        ctl = libknot.control.KnotCtl()
        ctl.connect(ctl_socket)
        ctl.set_timeout(ctl_timeout)

        # Get global metrics.
        global_stats = dict()
        try:
            ctl.send_block(cmd="stats", flags=ctl_flags)
            global_stats = ctl.receive_stats()
        except:
            pass

        # Get zone metrics.
        zone_stats = dict()
        try:
            ctl.send_block(cmd="zone-stats", flags=ctl_flags)
            zone_stats = ctl.receive_stats()
github CZ-NIC / knot / samples / stats_influxdb.py View on Github external
def send():
    # Connect to Knot server.
    ctl = libknot.control.KnotCtl()
    ctl.connect(ctl_socket)
    ctl.set_timeout(ctl_timeout)

    # Get global metrics.
    global_stats = dict()
    try:
        ctl.send_block(cmd="stats", flags="F")
        global_stats = ctl.receive_stats()
    except:
        pass

    # Get zone metrics.
    zone_stats = dict()
    try:
        ctl.send_block(cmd="zone-stats", flags="F")
        zone_stats = ctl.receive_stats()

libknot

Python bindings for libknot

GPL-3.0
Latest version published 16 days ago

Package Health Score

60 / 100
Full package analysis