• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Issue Statistics error

Apoxe

New Pleskian
Hi, i have a customer with a statistic of use problem, he have several domains and have 200mb of sql databases and system report 560mb, when i run

Edit: plesk 12.5 on vps centos 6

/usr/local/psa/admin/sbin/statistics –calculate-one –domain-name=clientdomain.com

have this several problems:



[2017-05-04 17:45:44] ERR [panel] throw: pg_connect(): Unable to connect to PostgreSQL server: could not connect to server: No such file or directory

Is the server running locally and accepting

connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

statistics_collector[6261]: Relinking of virtual host logs `/usr/local/psa/admin/sbin/relink-vhost-logs --domain-name clientdomain2.com --sys-user-login clientloginuser --webspace-name clientbasedomain.com' failed with code 3.
Stdout:
Stderr:'./clientbasedomain.com/logs/clientdomain2.com' doesn't exist. Specify --create to create.
ERROR: Cannot relink logs. Target directory '/var/www/vhosts/clientbasedomain.com/logs/clientdomain2.com' is in invalid state.

statistics_collector[6261]: Relinking of virtual host logs `/usr/local/psa/admin/sbin/relink-vhost-logs --domain-name clientdomain3.com --sys-user-login clientloginuser --webspace-name clientbasedomain.com' failed with code 3.
Stdout:
Stderr:'./clientbasedomain.com/logs/clientdomain3.com' doesn't exist. Specify --create to create.
ERROR: Cannot relink logs. Target directory '/var/www/vhosts/clientbasedomain.com/logs/clientdomain3.com' is in invalid state.

statistics_collector[6261]: Relinking of virtual host logs `/usr/local/psa/admin/sbin/relink-vhost-logs --domain-name clientdomain4.com --sys-user-login clientloginuser --webspace-name clientbasedomain.com' failed with code 3.
Stdout:
Stderr:'./clientbasedomain.com/logs/clientdomain4.com' doesn't exist. Specify --create to create.
ERROR: Cannot relink logs. Target directory '/var/www/vhosts/clientbasedomain.com/logs/clientdomain4.com' is in invalid state.

statistics_collector[6261]: Relinking of virtual host logs `/usr/local/psa/admin/sbin/relink-vhost-logs --domain-name subdomain.clientdomain3.com --sys-user-login clientloginuser --webspace-name clientbasedomain.com' failed with code 3.
Stdout:
Stderr:'./clientbasedomain.com/logs/subdomain.clientdomain3.com' doesn't exist. Specify --create to create.
ERROR: Cannot relink logs. Target directory '/var/www/vhosts/clientbasedomain.com/logs/subdomain.clientdomain3.com' is in invalid state.

statistics_collector[6261]: Relinking of virtual host logs `/usr/local/psa/admin/sbin/relink-vhost-logs --domain-name subdomain.clientdomain5.com --sys-user-login clientloginuser --webspace-name clientbasedomain.com' failed with code 3.
Stdout:
Stderr:'./clientbasedomain.com/logs/subdomain.clientdomain5.com' doesn't exist. Specify --create to create.
ERROR: Cannot relink logs. Target directory '/var/www/vhosts/clientbasedomain.com/logs/subdomain.clientdomain5.com' is in invalid state.

statistics_collector[6261]: Relinking of virtual host logs `/usr/local/psa/admin/sbin/relink-vhost-logs --domain-name clientdomain6.com --sys-user-login clientloginuser --webspace-name clientbasedomain.com' failed with code 3.
Stdout:
Stderr:'./clientbasedomain.com/logs/clientdomain6.com' doesn't exist. Specify --create to create.
ERROR: Cannot relink logs. Target directory '/var/www/vhosts/clientbasedomain.com/logs/clientdomain6.com' is in invalid state.

statistics_collector[6261]: Relinking of virtual host logs `/usr/local/psa/admin/sbin/relink-vhost-logs --domain-name clientdomain5.com --sys-user-login clientloginuser --webspace-name clientbasedomain.com' failed with code 3.
Stdout:
Stderr:'./clientbasedomain.com/logs/clientdomain5.com' doesn't exist. Specify --create to create.
ERROR: Cannot relink logs. Target directory '/var/www/vhosts/clientbasedomain.com/logs/clientdomain5.com' is in invalid state.

statistics_collector[6261]: Relinking of virtual host logs `/usr/local/psa/admin/sbin/relink-vhost-logs --domain-name clientdomain7.com --sys-user-login clientloginuser --webspace-name clientbasedomain.com' failed with code 3.
Stdout:
Stderr:'./clientbasedomain.com/logs/clientdomain7.com' doesn't exist. Specify --create to create.
ERROR: Cannot relink logs. Target directory '/var/www/vhosts/clientbasedomain.com/logs/clientdomain7.com' is in invalid state.
 
Last edited:
It seems that there are issues with either directory permissions or missing directories. Have you tried
# plesk repair web
?
 
Yes Peter


Repairing web server configuration

Repairing web server configuration for the domain

clientbasedomain.com ........................................... [OK]


Error messages: 0; Warnings: 0; Errors resolved: 0
 
The "error code 3" was pointing to permission issues in other cases. Could you please check your /logs directory of the domains where statistics fail? They should have permissions 0700. If not, set permission to logs with
# chmod 700 /var/www/vhosts/DOMAIN.TLD/logs/
# chown .root /var/www/vhosts/DOMAIN.TLD/logs/
Then re-run statistics and see if it works.
 
Maybe something is wrong in the logs directory. I suggest to
# mv /var/www/vhosts/DOMAIN.TLD/logs /var/www/vhosts/DOMAIN.TLD/logs_backup
(When you execute this command, statistics will not be able to read the current log files that were created up to now. This can probably not be reverted; but it must be done to proceed to the next step.)
Afterwards, update the directory structure with
# plesk repair --update-vhosts-structure
Then try again with statistics.
 
thanks, only issue now it's :

[2017-05-05 08:50:37] ERR [panel] throw: pg_connect(): Unable to connect to PostgreSQL server: could not connect to server: No such file or directory

Is the server running locally and accepting

connections on Unix domain socket "/tmp/.s.PGSQL.5432"?


i don't have postgresql installed i have mysql

and my principal problem it's not resolved.

this client have multiples database with a average size of 250 mb but system report 575mb, looking for an answear to this problem i found the /usr/local/psa/admin/sbin/statistics –calculate-one command

disco.png
 
Could you please clarify:
- Is the statistics now being calculated correctly or not?
- The PostgreSQL issue: That seems to be different issue?
 
Thanks again peter

- Is the statistics now being calculated correctly or not?
i have no more error like code 3 when i run /usr/local/psa/admin/sbin/statistics –calculate-one –domain-name=clientdomain.com but it's not correct size of database, i have unchecked the backups value in


- The PostgreSQL issue: That seems to be different issue?
only have thas echo in terminal when i run /usr/local/psa/admin/sbin/statistics –calculate-one –domain-name=clientdomain.com

now this is my terminal

[root@servername]# /usr/local/psa/admin/sbin/statistics --calculate-one --domain-name=clientbasedomain.com
[2017-05-05 10:13:55] ERR [panel] throw: pg_connect(): Unable to connect to PostgreSQL server: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
[2017-05-05 10:13:55] ERR [panel] pg_connect(): Unable to connect to PostgreSQL server: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
[root@servername]#


 
In the Plesk panel, could you please navigate to Tools & Settings > Server Management > Database Servers? There is no PostgreSQL server in the list, but only the single MySQL (MariaDB) server?
 
Could you please double-check on the operating system that there is no PostgreSQL server active? What is the output of
# netstat -plunt | grep postgre
# which psql
?
 
shure

[root@servername ~]# netstat -plunt | grep postgre

[root@servername ~]#
[root@servername ~]# which psql

/usr/bin/which: no psql in (/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)

[root@servername ~]#
 
I assume that the Plesk statistics utility has not noticed that PostgreSQL is no longer installed. It is expecting the service, but the service is not active. I was unable to recreate the issue on my CentOS test server.

My suggestion is to reinstall the Plesk PostgreSQL component, enter admin credentials in the GUI and start the service, then stop the service and uninstall the component. My hope is that by doing this, all Plesk database entries will be updated to the proper values, so that all Plesk components including awstats will notice that the database server is not present. Installing and deinstalling PostgreSQL does not interfere with MySQL, so I am not expecting issues with that.

You have verified that the component is currently not installed, so you can
# plesk installer --select-product-id plesk --select-release-current --install-component postgresql

After installation go into the Plesk panel > Tools & Settings > Server Management > Database Servers click on the grey circle button before "PostgreSQL" entry. On the following page enter a username (any, for example "test") and a password, confirm password, click OK. Server should now have started and display a green circle button. By activating the server we are making sure that Plesk can access it. If the circle is green, everything is fine. When you now run the statistics tool, the error should not show. You can test it.

Then stop and remove the service:
# service postgresql stop
# plesk installer --select-product-id plesk --select-release-current --remove-component postgresql

Then try statistics again:
# /usr/local/psa/admin/sbin/statistics --calculate-one --domain-name clientdomain.com

It should no longer display the error.

If this still does not work, next question: Are you using the awstats that was delivered with Plesk or could it be possible that it was installed separatedly from an OS vendor repository?
 
i follow all your steps, when i install postgresql and run statistics no error.

when i uninstall postgresql and run statistics error again ...

i don't install another awstats version, only plesk.
 
I am sorry that I could not help with this. I have not found any additional information in documentation, FAQ or other resources on this. I can only suggest to open a ticket with Plesk support as I do not know, what exactly the statistics program is doing internally (why it is looking for PostgreSQL).
 
Back
Top