# 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 os
import pwd
import sys
import time
from collectors.lib import utils
      os.nice(19)  # this collector can be very CPU intensive.  So be nicer.
    except OSError as e:
      print("warning: failed to self-renice:", e, file=sys.stderr)

    interval = 60

    # resolve the list of users to match on into UIDs
    uids = {}
    for user in USERS:
        try:
            uids[str(pwd.getpwnam(user)[2])] = user
        except KeyError:
            continue

    try:
        tcp = open("/proc/net/tcp")
        # if IPv6 is enabled, even IPv4 connections will also
        # appear in tcp6. It has the same format, apart from the
        # address size
        try:
            tcp6 = open("/proc/net/tcp6")
        except IOError as exc:
            if exc.errno == 2:  # No such file => IPv6 is disabled.
                tcp6 = None
            else:
                raise
    except IOError as e:
        print("Failed to open input file: %s" % (e,), file=sys.stderr)
        return 13  # Ask tcollector to not re-start us immediately.


# 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/procnettcp.py
import os
import pwd
import sys
import time
from collectors.lib import utils

      os.nice(19)  # this collector can be very CPU intensive.  So be nicer.
    except OSError as e:
      print("warning: failed to self-renice:", e, file=sys.stderr)

    interval = 60

    # resolve the list of users to match on into UIDs
    uids = {}
    for user in USERS:
        try:
            uids[str(pwd.getpwnam(user)[2])] = user
        except KeyError:
            continue

    try:
        tcp = open("/proc/net/tcp")
        # if IPv6 is enabled, even IPv4 connections will also
        # appear in tcp6. It has the same format, apart from the
        # address size
        try:
            tcp6 = open("/proc/net/tcp6")
        except IOError as exc:
            if exc.errno == 2:  # No such file => IPv6 is disabled.
                tcp6 = None
            else:
                raise
    except IOError as e:
        print("Failed to open input file: %s" % (e,), file=sys.stderr)
        return 13  # Ask tcollector to not re-start us immediately.


    utils.drop_privileges()