# 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/etc/mongodb3_conf.py
# def get_settings():


import sys
import time
import os
    import pymongo
from collectors.lib import utils
from collectors.etc import mongodb3_conf
    rs_status = res['myState']
    rs_members = res['members']

    for replica in res['members']:
        replica_name = replica['name'].replace(':', '_')
        replica_state = replica['stateStr']
        if int(replica['health']) == 1:
            replica_health = 'online'
        else:
            replica_health = 'offline'

        for metric in REPLICA_METRICS:
            cur = replica
            try:
                for m in metric.split('.'):
                    cur = cur[m]
            except KeyError:
                continue
            print('mongo.replica.%s %d %s replica_set=%s replica=%s replica_state=%s replica_health=%s' % (metric, ts, cur, replica_set_name, replica_name, replica_state, replica_health))

def loadEnv():
    global USER, PASS, INTERVAL, DB_NAMES, CONFIG_CONN, MONGOS_CONN, REPLICA_CONN
    for item in mongodb3_conf.get_settings()['db'].split(','):
        DB_NAMES.append(item)

    for item in mongodb3_conf.get_settings()['config'].split(','):
        if item:
            host_port = item.split(':')
            CONFIG_CONN.append({'host': host_port[0], 'port': int(host_port[1]), 'link': None})


# 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/etc/mongodb3_conf.py
# def get_settings():


# Path: collectors/0/mongo3.py
import sys
import time
import os
    import pymongo
from collectors.lib import utils
from collectors.etc import mongodb3_conf

    rs_status = res['myState']
    rs_members = res['members']

    for replica in res['members']:
        replica_name = replica['name'].replace(':', '_')
        replica_state = replica['stateStr']
        if int(replica['health']) == 1:
            replica_health = 'online'
        else:
            replica_health = 'offline'

        for metric in REPLICA_METRICS:
            cur = replica
            try:
                for m in metric.split('.'):
                    cur = cur[m]
            except KeyError:
                continue
            print('mongo.replica.%s %d %s replica_set=%s replica=%s replica_state=%s replica_health=%s' % (metric, ts, cur, replica_set_name, replica_name, replica_state, replica_health))

def loadEnv():
    global USER, PASS, INTERVAL, DB_NAMES, CONFIG_CONN, MONGOS_CONN, REPLICA_CONN
    for item in mongodb3_conf.get_settings()['db'].split(','):
        DB_NAMES.append(item)

    for item in mongodb3_conf.get_settings()['config'].split(','):
        if item:
            host_port = item.split(':')
            CONFIG_CONN.append({'host': host_port[0], 'port': int(host_port[1]), 'link': None})


    for item in mongodb3_conf.get_settings()['mongos'].split(','):