Closed MikaPower closed 3 years ago
Hi. I followed this tutorial https://en.admininfo.info/c-mo-instalar-y-configurar-monitorix-en-ubuntu-18 After setting up everything I found that when I go the built-in server it never asks for a password even thought I set it. I did change enabled = y and also created the password using sudo htpasswd -d -c /var/lib/monitorix/htpasswd admin
This is because you forgot to specify which hosts/IPs will be forced to authenticate. By default none is (which looks like not much sense to me right now).
Starting from the 3.13.0 version there are two new options inside the <auth>
subsection: hosts_deny
and hosts_allow
(documented here) which are empty by default, which means that even when authentication is enabled all hosts can pass through. This is intended to have a list of hostnames or IP address that don't need to authenticate because they are trusted.
So, just define the option hosts_deny = all
and you'll force authentication to everybody.
I'll modify the main configuration file to include the option hosts_deny = all
in order to keep the same behavior as it had before the introduction of this new feature in #274.
Sorry for the inconveniences.
Then I tried setting up postgres by enabling the graph and changing the database name, user and password which lead to me having to install DBD::Pg module. After all this I check the logs and it shows: gsql::pgsql_update: Cannot connect to PostgreSQL 'localhost:5432'. ERROR: while updating /var/lib/monitorix/pgsql.rrd: /var/lib/monitorix/pgsql.rrd: expected timestamp not found in data source from N
Please, make sure your PostgreSQL is listening in the port 5432 at localhost.
Please, make sure your PostgreSQL is listening in the port 5432 at localhost.
Pgsql is working fine on that port. I even created a script to test it
#!/usr/bin/perl
use DBI;
my $dbh = DBI->connect('dbi:Pg:dbname=database;','user','pass',{AutoCommit$
print "2+2=",$dbh->selectrow_array("SELECT 2+2"),"\n";
I can also access it on local machine and on the outside if I open port 5432
My pg_hba.conf:
# IPv4 local connections:
host all all 127.0.0.1/32 md5
host all all 0.0.0.0/0 md5
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 md5
Is there any place after monitorix log in which I can see more info on the error? Thanks
Can you, please, paste the <pgsql>
section from your configuration file?
Also, the output of netstat -lntp
or ss -lntp
.
Thanks.
So, just define the option
hosts_deny = all
and you'll force authentication to everybody.
Doing this didn't asks me for authentication, instead got an 403.
Can you, please, paste the
section from your configuration file?
<pgsql>
list = localhost
<desc>
<localhost>
host = localhost
port = 5432
username = nuno
password = ......
db_list = extreme,
</localhost>
</desc>
rigid = 0, 0, 0, 0, 0, 0
limit = 100, 100, 100, 100, 100, 100
</pgsql>
Also, the output of netstat -lntp or ss -lntp
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 30662/rpcbind
tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 23558/monitorix-htt
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 915/nginx: master p
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 692/systemd-resolve
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 894/sshd
tcp 0 0 0.0.0.0:5432 0.0.0.0:* LISTEN 14583/postgres
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 915/nginx: master p
tcp6 0 0 :::111 :::* LISTEN 30662/rpcbind
tcp6 0 0 :::22 :::* LISTEN 894/sshd
tcp6 0 0 :::5432 :::* LISTEN 14583/postgres
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 0.0.0.0:111 0.0.0.0:* users:(("rpcbind",pid=30662,fd=8))
LISTEN 0 128 0.0.0.0:8080 0.0.0.0:* users:(("monitorix-httpd",pid=23601,fd=3))
LISTEN 0 128 0.0.0.0:80 0.0.0.0:* users:(("nginx",pid=27257,fd=9),("nginx",pid=915,fd=9))
LISTEN 0 128 127.0.0.53%lo:53 0.0.0.0:* users:(("systemd-resolve",pid=692,fd=13))
LISTEN 0 128 0.0.0.0:22 0.0.0.0:* users:(("sshd",pid=894,fd=3))
LISTEN 0 128 0.0.0.0:5432 0.0.0.0:* users:(("postgres",pid=14583,fd=7))
LISTEN 0 128 0.0.0.0:443 0.0.0.0:* users:(("nginx",pid=27257,fd=8),("nginx",pid=915,fd=8))
LISTEN 0 128 [::]:111 [::]:* users:(("rpcbind",pid=30662,fd=11))
LISTEN 0 128 [::]:22 [::]:* users:(("sshd",pid=894,fd=4))
LISTEN 0 128 [::]:5432 [::]:* users:(("postgres",pid=14583,fd=8))
I also tried giving a wrong password but it didn't give any extra info besides the error on my first post
Doing this didn't asked me authentication, instead got an 403.
You must declare that option inside the <auth>
subsection. I've checked and it works.
I also tried giving a wrong password but it didn't give any extra info besides the error on my first post
You might want to add the -d pgsql
or even -d all
argument when running Monitorix to get more debug information.
You must declare that option inside the
subsection. I've checked and it works.
Ah men, my bad, sorry making you lose time on this one.
You might want to add the -d pgsql or even -d all argument when running Monitorix to get more debug information.
Which command should I add this?
I start monitorix with systemctl start monitorix
Which command should I add this? I start monitorix with systemctl start monitorix
Monitorix, as many other tools, have an environment file located in /etc/sysconfig/monitorix
from which you can add extra command line options that will be passed when Monitorix is started.
You must configure it like this:
# Here you can specify your Monitorix command line options.
#
OPTIONS="-d pgsql"
Still the same info as before. I'm checking the file /var/log/monotorix. Is this the right file?
Still the same info as before. I'm checking the file /var/log/monotorix. Is this the right file?
You should get much more information in /var/log/monitorix
.
What OS you have there? and how do you installed Monitorix?
You should get much more information in /var/log/monitorix
Looks the same as before
What OS you have there? and how do you installed Monitorix?
Ubuntu 18.04, and I installed monitorix following the tutorial on my first post
I partially solved the problem. In the file pgsql.rm line 207
"DBI:Pg:host=$host;port=$port",
I added the database name:
"dbi:Pg:dbname=extreme;host=$host;port=$port",
The graphs are now working, I didn't check where you iterate the databases list on the pgsql conf options but I will do it now and see if I can help a little more.
I added the database name:
The PostgreSQL module was added in this 3.13.0 version, perhaps it needs some fixings, but it worked finely here. You shouldn't have to add the database name in there because Monitorix first takes the global parameters and then the specific database parameters.
I think that the user you configured only have permission for the extreme
database and not for the global configuration.
Hmm, I see an extra comma at the end of your database name in the option db_list
.
db_list = extreme,
This should be harmless, but it's better to not be there.
You are indeed correct. On the pgsql config file I used the database owner and not the postgres user. After using postgres user everything works fine. I would like to thank you for your time and work. Have a nice day.
Many thanks for reporting that issue.
Hi. I followed this tutorial https://en.admininfo.info/c-mo-instalar-y-configurar-monitorix-en-ubuntu-18 After setting up everything I found that when I go the built-in server it never asks for a password even thought I set it. I did change
enabled = y
and also created the password usingsudo htpasswd -d -c /var/lib/monitorix/htpasswd admin
Then I tried setting up postgres by enabling the graph and changing the database name, user and password which lead to me having to install DBD::Pg module. After all this I check the logs and it shows:gsql::pgsql_update: Cannot connect to PostgreSQL 'localhost:5432'.
ERROR: while updating /var/lib/monitorix/pgsql.rrd: /var/lib/monitorix/pgsql.rrd: expected timestamp not found in data source from N
Thanks Nuno