diff --git a/mongodb-org-3.2/defaults/main.yml b/mongodb-org-3.2/defaults/main.yml index eed15b2..f82d69f 100644 --- a/mongodb-org-3.2/defaults/main.yml +++ b/mongodb-org-3.2/defaults/main.yml @@ -23,3 +23,8 @@ mongodb_allowed_hosts: mongodb_cluster_enabled: False mongodb_replicaset: storagedev mongodb_replica_keyfile: '{{ mongodb_dbpath }}/replica_keyfile' + +mongodb_ganglia_auth_enabled: False +mongodb_ganglia_db: admin +mongodb_ganglia_auth_mechanism: MONGODB-CR +# User and password are stored in the variables mongo_monitoring_u and mongo_monitoring_pwd diff --git a/mongodb-org-3.2/templates/mongodb.pyconf.j2 b/mongodb-org-3.2/templates/mongodb.pyconf.j2 index a23f9b1..5ed2f72 100644 --- a/mongodb-org-3.2/templates/mongodb.pyconf.j2 +++ b/mongodb-org-3.2/templates/mongodb.pyconf.j2 @@ -3,10 +3,18 @@ modules { 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 %} } } } diff --git a/mongodb-org-3/defaults/main.yml b/mongodb-org-3/defaults/main.yml index eed15b2..6e0f1b3 100644 --- a/mongodb-org-3/defaults/main.yml +++ b/mongodb-org-3/defaults/main.yml @@ -23,3 +23,9 @@ mongodb_allowed_hosts: mongodb_cluster_enabled: False mongodb_replicaset: storagedev mongodb_replica_keyfile: '{{ mongodb_dbpath }}/replica_keyfile' + +mongodb_ganglia_auth_enabled: False +mongodb_ganglia_db: admin +mongodb_ganglia_auth_mechanism: MONGODB-CR +# User and password are stored in the variables mongo_monitoring_u and mongo_monitoring_pwd + diff --git a/mongodb-org-3/templates/mongodb.pyconf.j2 b/mongodb-org-3/templates/mongodb.pyconf.j2 index a23f9b1..5ed2f72 100644 --- a/mongodb-org-3/templates/mongodb.pyconf.j2 +++ b/mongodb-org-3/templates/mongodb.pyconf.j2 @@ -3,10 +3,18 @@ modules { 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 %} } } }