noisiv 1
noisiv
Manwe Work 1
Manwe Work
Agora Metin2 1
Agora Metin2
Bvural41 1
Bvural41
onur akbaş 1
onur akbaş
IronTalonX 1
IronTalonX
D 1
delimuratt
berzahx 1
berzahx
PrimeAC 1
PrimeAC
DEVLOPER 1
DEVLOPER
ShadowFon 1
ShadowFon
mavzermete 1
mavzermete
Hikaye Ekle

Metin2 Statistics with InfluxDB

  • Konuyu başlatan Konuyu başlatan charparodar
  • Başlangıç tarihi Başlangıç tarihi
  • Cevaplar Cevaplar 11
  • Görüntüleme Görüntüleme 2K

charparodar

Level 2
Üye
Katılım
7 Eyl 2016
Konular
12
Mesajlar
59
Online süresi
3d 16h
Reaksiyon Skoru
42
Altın Konu
0
TM Yaşı
9 Yıl 9 Ay 11 Gün
Başarım Puanı
77
MmoLira
945
DevLira
15
Ticaret - 0%
0   0   0

HERAKLES Otomatik Avlı kalıcı sunucu. 19 Haziran'da açılıyor. Atius & Wizard güvencesiyle hemen kayıt ol, ön kayıt ödülleri aktif. HEMEN TIKLA!

GitHub:
The following tutorial is also available on the GitHub repository.


Metin2-InfluxDB



The purpose of this is to be able to create dashboards with the timeseries statistics, like the ones seen on the video made with Grafana.

Install InfluxDB:

ℹ️ Information

If you intend on using Cloudflare (and nginx as reverse proxy, since InfluxDB’s default port is 8086, which isn’t supported by Cloudflare, if you choose the docker installation, just map it to a port supported by Cloudflare, preferably HTTPS), you will need to create a firewall exception to bypass all rules that come from your metin2 game server so it doesn’t get blocked or challenged.

I recommend setting up nginx as reverse proxy, that way the port 443 can be used for all hosts configured on nginx.

On FreeBSD, only InfluxDB 1.8.* is available, not recommended, since the latest major stable version is 2.1. This tutorial was made for version 2.1, there may be differences on the requests.

An IP address can be used, but a domain with SSL setup is preferable, for obvious reasons.

InfluxDB Setup​


Create an organization​

v9RJzpK.png


Create a bucket​


FP7jFbD.png


Lib cURL​


FreeBSD Setup​


Install it:
[CODE lang="bash" title="Install lib cURL"]pkg install curl[/CODE]

And link it on the Makefile:
[CODE lang="makefile" title="Link lib on makefile"]-lcurl[/CODE]

Windows Setup​

For Windows it works with both vcpkg and compiling the lib manually.

Shared lib:
[CODE lang="bash" title="Install lib cURL vcpkg shared"]vcpkg install curl[openssl]:x86-windows[/CODE]

Static lib:
[CODE lang="bash" title="Install lib cURL vcpkg static"]vcpkg install curl[openssl]:x86-windows-static[/CODE]

Auto Event Manager​

In case you already have this class/file, just compare and make the necessary changes. All the changes related to Influx are wrapped with the macro INFLUX_STATS.

Don't forget to also make the necessary changes on main.cpp. If you are already using this you won't need to include the header and initialize the class.

Edit Time​

The default is send the data every 10 minutes.

On the file InfluxData.cpp, edit this code:
[CODE lang="cpp" title="Edit Time"]void CInfluxData::Check(int day, int hour, int minute, int second) {
int lastNumber = minute % 10;

if (isInfluxEnabled && lastNumber == 0 && second == 00)[/CODE]

If lastNumber = 0, then it means the number is divisible by, in this case, 10. Make sure when you edit the time to don't forget the seconds part, if you don't use it, it will run every second inside the minute you want to run it.

Examples for other times​


Every minute​

[CODE lang="cpp" title="Every minute"] if (isInfluxEnabled && second == 00)[/CODE]

Every 5 minutes​

[CODE lang="cpp" title="Every 5 minutes"] int lastNumber = minute % 5;[/CODE]

Every 30 seconds​

[CODE lang="cpp" title="Every 30 seconds"] int lastNumber = seconds % 30;

if (isInfluxEnabled && lastNumber == 0)[/CODE]

Configuration​

To use this make sure you have it only enabled on ONE core per channel, the online counter inside the channel is common between the cores, just add this on the CONFIG file to enable Influx on the core.
Kod:
INFLUX_ENABLE: 1

The rest of the settings, can either be set on the source or by CONFIG options (this are the default values set on the source):
Kod:
INFLUX_URL: http://127.0.0.1:8086
INFLUX_TOKEN: <token>
INFLUX_ORG: <organization>
INFLUX_BUCKET: <bucket>

NodeJS Version​

In case you don't to use the source, a NodeJS version is available where you can use the Metin2 API to get the user count and send it to Influx.

The source method is preferred.

Acknowledgments:​

for testing the tutorial on Windows.
for testing the tutorial on FreeBSD.
 
Fazer um video com a instalação seria de grande ajuda.
 
Paylaşım için teşekkürler. Birisi oyun içi ne işe yaradığını daha net anlatabilir mi
 
Paylaşım için teşekkürler. Birisi oyun içi ne işe yaradığını daha net anlatabilir mi
Ingame it doesn't do anything, the source part is just to send the online players of the channel to InfluxDB, that can be used to build dashboards, like the one on the video made with Grafana.

Fazer um video com a instalação seria de grande ajuda.
I could think about it when I have some free time in the next few days.
 
You are doing great things with NodeJS, congratulations. But why not use it on systems like rabbit? I think it would be more beneficial to use sorting systems such as Rabbit. I think that the load on the system will not be felt at all because it lists the intense requests.

Docs :
 

Şu an konuyu görüntüleyenler (Toplam : 0, Üye: 0, Misafir: 0)

Geri
Üst