mirror of https://github.com/mikaku/Monitorix.git
added the options 'username' and 'password' in 'mongodb.pm' to provide support for authentication. #246
This commit is contained in:
parent
220ad09e8d
commit
cdd30ed9d1
|
@ -209,9 +209,13 @@ sub mongodb_update {
|
||||||
my $mongo = trim($ml[$n]);
|
my $mongo = trim($ml[$n]);
|
||||||
my $host = $mongodb->{desc}->{$mongo}->{host} || "";
|
my $host = $mongodb->{desc}->{$mongo}->{host} || "";
|
||||||
my $port = $mongodb->{desc}->{$mongo}->{port} || "";
|
my $port = $mongodb->{desc}->{$mongo}->{port} || "";
|
||||||
|
my $user = $mongodb->{desc}->{$mongo}->{username} || "";
|
||||||
|
my $pass = $mongodb->{desc}->{$mongo}->{password} || "";
|
||||||
my $cmd = "mongo ";
|
my $cmd = "mongo ";
|
||||||
$cmd .= "--host $host " if $host;
|
$cmd .= "--host $host " if $host;
|
||||||
$cmd .= "--port $port " if $port;
|
$cmd .= "--port $port " if $port;
|
||||||
|
$cmd .= "-u $user " if $user;
|
||||||
|
$cmd .= "-p $pass " if $pass;
|
||||||
$cmd .= "--eval \"printjson(db.serverStatus())\"";
|
$cmd .= "--eval \"printjson(db.serverStatus())\"";
|
||||||
|
|
||||||
if(open(IN, "$cmd |")) {
|
if(open(IN, "$cmd |")) {
|
||||||
|
|
|
@ -2377,6 +2377,16 @@ This is the port number of the MongoDB server specified in its block.
|
||||||
Default value: \fI\fP
|
Default value: \fI\fP
|
||||||
.RE
|
.RE
|
||||||
.P
|
.P
|
||||||
|
.BI username
|
||||||
|
.RS
|
||||||
|
This is the username for authentication of the MongoDB server specified in its block.
|
||||||
|
.RE
|
||||||
|
.P
|
||||||
|
.BI password
|
||||||
|
.RS
|
||||||
|
This is the password for authentication of the MongoDB server specified in its block.
|
||||||
|
.RE
|
||||||
|
.P
|
||||||
.BI db_list
|
.BI db_list
|
||||||
.RS
|
.RS
|
||||||
This is a comma-separated list of databases to be monitored of the MongoDB server specified in its block.
|
This is a comma-separated list of databases to be monitored of the MongoDB server specified in its block.
|
||||||
|
|
Loading…
Reference in New Issue