def collector(hostname, cmd, result):
    conn = pymongo.Connection(
            __opts__['mongo.host'],
            __opts__['mongo.port'],
            )
    db = conn[__opts__['mongo.db']]

    user = __opts__.get('mongo.user')
    password = __opts__.get('mongo.password')
    if user and password:
        db.authenticate(user, password)

    collection = db[hostname]
    back = _escape_dot(result)
    log.debug( back )
    collection.insert({
        'utctime' : datetime.datetime.utcnow(),
        'cmd' : cmd,
        'result' : back})
Collect data in a mongo database.
dataset/ETHPy150Open thatch45/salt-monitor/salt/ext/monitor/collectors/mongo.py/collector