# Path: collectors/lib/utils.py
# PY3 = sys.version_info[0] > 2
# USER = "nobody"
# def drop_privileges(user=USER):
# def is_sockfile(path):
# def err(msg):
#     def is_numeric(value):
#     def is_numeric(value):


import socket
import sys
import time
from collectors.lib import utils
  from collectors.etc import udp_bridge_conf
# see <http://www.gnu.org/licenses/>.
"""Listens on a local UDP socket for incoming Metrics """


try:
except ImportError:
  udp_bridge_conf = None

HOST = '127.0.0.1'
PORT = 8953
SIZE = 8192

def main():
    if not (udp_bridge_conf and udp_bridge_conf.enabled()):
      sys.exit(13)
    utils.drop_privileges()

    def removePut(line):
        if line.startswith('put '):
            return line[4:]
        else:
            return line

    try:
        if (udp_bridge_conf and udp_bridge_conf.usetcp()):
          sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        else:
          sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        sock.bind((HOST, PORT))
    except socket.error as msg:

# Path: collectors/lib/utils.py
# PY3 = sys.version_info[0] > 2
# USER = "nobody"
# def drop_privileges(user=USER):
# def is_sockfile(path):
# def err(msg):
#     def is_numeric(value):
#     def is_numeric(value):


# Path: collectors/0/udp_bridge.py
import socket
import sys
import time
from collectors.lib import utils
  from collectors.etc import udp_bridge_conf

# see <http://www.gnu.org/licenses/>.
"""Listens on a local UDP socket for incoming Metrics """


try:
except ImportError:
  udp_bridge_conf = None

HOST = '127.0.0.1'
PORT = 8953
SIZE = 8192

def main():
    if not (udp_bridge_conf and udp_bridge_conf.enabled()):
      sys.exit(13)
    utils.drop_privileges()

    def removePut(line):
        if line.startswith('put '):
            return line[4:]
        else:
            return line

    try:
        if (udp_bridge_conf and udp_bridge_conf.usetcp()):
          sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        else:
          sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        sock.bind((HOST, PORT))
    except socket.error as msg:

        utils.err('could not open socket: %s' % msg)