modules {
    module {
        name = "mongodb"
        language = "python"
        param server_status {
{% if mongodb_ganglia_auth_enabled %}
            value = "mongo --quiet --authenticationMechanism {{ mongodb_ganglia_auth_mechanism }} -u {{ mongo_monitoring_u }} -p {{ mongo_monitoring_pwd }} --eval 'printjson(db.serverStatus())' {{ mongodb_ganglia_db }}"
{% else %}
            value = "mongo --quiet --eval 'printjson(db.serverStatus())'"
{% endif %}
        }
        param rs_status {
{% if mongodb_ganglia_auth_enabled %}
            value = "mongo --quiet --authenticationMechanism {{ mongodb_ganglia_auth_mechanism }} -u {{ mongo_monitoring_u }} -p {{ mongo_monitoring_pwd }} --eval 'printjson(rs.status())' {{ mongodb_ganglia_db }}"
{% else %}
            value = "mongo --quiet --eval 'printjson(rs.status())'"
{% endif %}
        }
    }
}

collection_group {
    collect_every = 30
    time_threshold = 90
    metric {
        name = "mongodb_opcounters_insert"
        title = "Inserts"
    }
    metric {
        name = "mongodb_opcounters_query"
        title = "Queries"
    }
    metric {
        name = "mongodb_opcounters_update"
        title = "Updates"
    }
    metric {
        name = "mongodb_opcounters_delete"
        title = "Deletes"
    }
    metric {
        name = "mongodb_opcounters_getmore"
        title = "Getmores"
    }
    metric {
        name = "mongodb_opcounters_command"
        title = "Commands"
    }
    metric {
        name = "mongodb_backgroundFlushing_flushes"
        title = "Flushes"
    }
    metric {
        name = "mongodb_mem_mapped"
        title = "Memory-mapped Data"
    }
    metric {
        name = "mongodb_mem_virtual"
        title = "Process Virtual Size"
    }
    metric {
        name = "mongodb_mem_resident"
        title = "Process Resident Size"
    }
    metric {
        name = "mongodb_extra_info_page_faults"
        title = "Page Faults"
    }
    metric {
        name = "mongodb_globalLock_ratio"
        title = "Global Write Lock Ratio"
    }
    metric {
        name = "mongodb_indexCounters_btree_miss_ratio"
        title = "BTree Page Miss Ratio"
    }
    metric {
        name = "mongodb_globalLock_currentQueue_total"
        title = "Total Operations Waiting for Lock"
    }
    metric {
        name = "mongodb_globalLock_currentQueue_readers"
        title = "Readers Waiting for Lock"
    }
    metric {
        name = "mongodb_globalLock_currentQueue_writers"
        title = "Writers Waiting for Lock"
    }
    metric {
        name = "mongodb_globalLock_activeClients_total"
        title = "Total Active Clients"
    }
    metric {
        name = "mongodb_globalLock_activeClients_readers"
        title = "Active Readers"
    }
    metric {
        name = "mongodb_globalLock_activeClients_writers"
        title = "Active Writers"
    }
    metric {
        name = "mongodb_connections_current"
        title = "Open Connections"
    }
    metric {
        name = "mongodb_connections_current_ratio"
        title = "Open Connections"
    }
    metric {
        name = "mongodb_slave_delay"
        title = "Replica Set Slave Delay"
    }
    metric {
        name = "mongodb_asserts_total"
        title = "Asserts per Second"
    }
}