AWStats | Country origin

Hello!
After my prior message (Awstats|how to access?), now customer want to see “origin country”

All IP have “Unknown (unresolved ip)” status

/etc/awstats/awstats.conf is the original and have ‘DNSLookup=1’

Is there any setting that I should activate?

https://mediatemple.net/community/products/dv/204644400/how-do-i-configure-awstats-to-show-the-country-of-site-visitors

1 Like

Almost there.

I read that site and others before ask here.

However, I m lookig for “oficial way” or “nearest to oficial way”

Following that old guide maybe is not suitable for updated enviroment. GeoIP.dat is not longer available, and actually, format is mmdb.

Maybe, this https://github.com/eldy/awstats/issues/86 link could be more useful.
It’s an issue opened at 2018, and still open.

Seems to be easier convert to old format than use actual.

There is no “official way” or “nearest to official way”. We didn’t even know that it didn’t work properly.

I quit using this kind of software years ago de to inaccuracies of measuring. There are better alternatives available.

As explained in here Regarding DNS problem

We share the code for free. Try to improve the system mainly for our self how ever instead keeping it for our self we share the result and spread some love (and some code). Try to fix a solution by your self. And then create or a tutorial for it or maybe even create a pull request. This way the software can be improved.

If you want a Hosting Control panel out of the box please buy Cpanel…

Well, it’s not my fault that you didn’t know that this option is not working.

Yes, I know that is not best tool and that are better alternatives.

And after 3rd paragraph: well…What can I say. 20 years using linux, and “What do you want from me? It’s free!” is always there.

I fix it, but if I ask for an official or nearest way, is because I don’t want to fuck all install.

If you say: “we don’t have idea”, I can take as valid answer too.
Even a “wow, you found a bug, please, fill a report at github and will be try our best, but maybe take years (or never)” …

If you have a bad day, take a rest.

I have to admit I did not look deeper into it, before posting the link. if you tried that geoip plugin before and found it not working, that piece of information would have been helpful in your starting post already :wink:

however, awstats is a third party service that gets installed along with others. Hestia relies on the version in the repos to be somehow ready to use and it won’t really fix outdated or missing stuff within for you. so I am afraid indeed this is something you need to figure yourself or take over to the AWStats git/forums…

as others pointed out already, of course we can look into integrating a patch or plugin, but I think even then there can’t be real support here, as it’s always gonna be a plugin for third party software anyway :man_shrugging:

sorry if we sometimes sound rude here, just trying to set expecatations very straight all the time. I also guess different tone of voice often does translate badly and therefore answer might not sound like they are intended to :wink:

1 Like

Oke found the non out of the box solutions

Login as root or use sudo
Step 1 Check if the following package is installed with / or install it

apt-get install perl-CPAN
perl -MCPAN -e "install Geo::IP::PurePerl"
perl -MCPAN -e "install Geo::IP"

Uncomment the following line in /etc/awstats/awstats.conf

#LoadPlugin="geoip GEOIP_STANDARD /usr/share/GeoIP/GeoIP.dat"

Edit the file awstats.domain.com.conf and add the line

LoadPlugin="geoip GEOIP_STANDARD /usr/share/GeoIP/GeoIP.dat"

Run the following command:

echo "$BIN/v-update-web-domain-stat user domain.com" >> \ 
>     $HESTIA/data/queue/webstats.pipe

Force update AWStats

/usr/local/hestia/bin/v-update-sys-queue webstats

Please try and confirm it is working then I will try to create the out of the box solutions.

Please remind to update currently not the the domain via the control pannel as this will overwrite the changes in Awstats domain config.

(Changed few commands !)

1 Like

We had some issues with implementing it during the install. How ever you can use the following command

wget -O $HESTIA/bin/v-update-sys-hestia-git https://raw.githubusercontent.com/hestiacp/hestiacp/master/bin/v-update-sys-hestia-git
chmod +x $HESTIA/bin/v-update-sys-hestia-git
$HESTIA/bin/v-update-sys-hestia-git master

And then execute the file
bash /usr/local/hestia/install/upgrade/manual/install_awstats_geoip.sh

And follow the instructions. During the next update of Awstats it should work according before…

In the future some additional information will be created…

3 Likes

I could’nt fixed by myself. Seems that something not working. Also, I don’t take in mind to edit Hestia templates before. It could be related.

I did a rollback of all my changes.

I’m trying with proposed solution upgrading Hestia to master branch

This have an error:

root@srv:~# bash /usr/local/hestia/install/upgrade/manual/install_awstats_geoip.sh
grep: /usr/local/hestia/data/templates/web/awstats/awstats.conf: No such file or directory
Reading '/root/.cpan/Metadata'
  Database was generated on Sat, 16 May 2020 13:41:04 GMT
Geo::IP::PurePerl is up to date (1.26).
Reading '/root/.cpan/Metadata'
  Database was generated on Sat, 16 May 2020 13:41:04 GMT
Geo::IP is up to date (1.51).
sed: can't read /etc/awstats.conf: No such file or directory

Right path is /etc/awstats/awstats.conf

After run manually sed -i '/LoadPlugin=\"geoip GEOIP_STANDARD \/usr\/share\/GeoIP\/GeoIP.dat\"/s/^#//g' /etc/awstats/awstats.conf and exec again /usr/local/hestia/bin/v-update-sys-queue webstats (with new webstats.pipe added) seems to be working, but I will waint until tomorrow and let that awstats run tonight (my version hang at night)

But, seems to be working

Thanks for testing, please let me know if tomorrow all is working properly.

Changed the file names in git accordingly. Anyway thanks for testing :slight_smile:

1 Like

Seems that after run proposal solution, at some point all dns configuration has been reset to default (upgrading to master, maybe?).

I had some custom records going to others servers or specific settings

I m doing a backup restore. Well… it’s saturday and mostly, will not notice it

¯ \ _ (ツ) _ / ¯

Upgrade does a rebuild of the hestia users, this may include also dns configuration. Also you should have been warned while running v-update-sys-hestia-git that this command isnt for production server at all :smiley::

Can you write more what exactly you’ve edited and got a reset during the upgrade? Just to know if that is something we would need to fix before we release the new version.

I saw it, but I didn’t think that will reset dns config without copy to /root/hst_backups/ XD

Seems that most of changes, are A and WWW pointing to another server.

domain.com. 300     IN      A       52.200.197.31
www     300     IN      A               52.200.197.31

I just host emails

I did a basic restore:

tar -xf /backup/username.2020-05-16_06-49-22.tar --wildcards "*.db"
cat /backup/dns/domain.com/conf/domain.com.db > /home/user/conf/dns/domain.com.db
/etc/init.d/bind9 reload

However, on Hestia CP I still with hard resetted version (?)

Please create a bug report at https://github.com/hestiacp/hestiacp/issues

This shouldn’t be allowed…

DNS should not be resettet, there is no reason for it at all. As @eris wrote, please open a issue report with all informations you can get, so we can track down and try to reproduce your issue.

Did some debugging

Just setup a test server that can be safely be destroyed Added a domain and “played” some thing with the settings

I had already changed some values in the www record / A record

Switched from test branch to release checked everything was the same

Switched a few times between master and release. No issue

The I changed the default IP in /edit/dns/ and then switched between the releases everything gets reset… to the new IP.

Could you please check what the IP value in /edit/dns was and include this information in the bug report?

As Maxmind currently do not update their GeoIP database (.db) version there can be free of charge download the GeoIP 2 Lite version in .mmdb.

Here is a converter to convert .mmdb to .db. https://github.com/sherpya/geolite2legacy

or all-ready converted https://mailfud.org/geoip-legacy/

Well… it does not work for me.

root@srv:~# bash /usr/local/hestia/install/upgrade/manual/install_awstats_geoip.sh
LoadPlugin="geoip GEOIP_STANDARD /usr/share/GeoIP/GeoIP.dat"
Plugin allready enabled
root@srv:~# grep Load /etc/awstats/awstats.some.site.ua.conf 
LoadPlugin="geoip GEOIP_STANDARD /usr/share/GeoIP/GeoIP.dat"

1 Like