hulxv / vnstat-client

GUI Client for vnStat Network Monitor for Linux or GNU/Linux
https://hulxv.github.io/vnstat-client/
GNU General Public License v2.0
150 stars 10 forks source link

Collection of data from other servers #4

Closed AnonymousWebHacker closed 2 years ago

AnonymousWebHacker commented 2 years ago

Hello, first of all, greet you, and thank you, as well as vergoh. I should create 2 separate inssues, but since I opened one, I'm going to mention them both here

Describe the solution you'd like 1 - Is there any way to host this repo as a web service?, example ip_public:3444/login ? 2 - The only thing missing, for this to be perfect, is being able to read data from other servers with vnstat installed

Describe alternatives you've considered A kind of agent could be used that imports the data to the app, or simply, a vnstat-client.conf , where you can specify the IP of the servers, and their credentials, or at least a private key to be able to connect and collect the data

Additional context It will be necessary to take into account, if an agent has to be created that sends the data to the client, or take security measures in case of configuring with credentials

happy Hackin :)

AnonymousWebHacker commented 2 years ago

Traffic measurement is practically done on servers (where there are no graphical interfaces). vnstat has its practical use on such servers, but vnstatclient would have no use. If you want to make better use of it, try to host vnstatclient as a service where (you can see traffic from that server), and from other servers.

The other variant is to use local vnstatclient on the desktop PC, and connect to said servers

hulxv commented 2 years ago

Honestly, Its a nice and interesting feature. Did you know a way to do that ? I will be thankful for you if you can explain that to me 🙏.

AnonymousWebHacker commented 2 years ago

I think it is something that @vergoh may be interested in, perhaps he has thought about that possibility. If it can be done, if it is possible, it is only to see if it happens in vnstat or in the vnstclient.

vnstat, you can use an agent to export/import remote data.

The other variant is power through scripts, specify example ip , and ssh private key , where I would access /var/lib/vnstat and create a sync copy every x time, and the vnstatclient can read that remote data.

1 [vnstatclient]  ------------------------------------> [vnstat]
2 [vnstatclient]  <------------------------------------ [vnstat]
3 [vnstatclient]  <-----------------------------------> [vnstat]

There are three ways to configure elements:

By request Automatically Import Export

hulxv commented 2 years ago

After a lot of thinking, I found a way to do that but I'm not sure if that's the best way. Can we build a tool we can call it "vnstat-server", It does one thing, Make a server on localhost and API to enable us to get all vnstat data (databases, configs, controlling on the daemon, etc...), And vnstat-client will manage this operation but the user should enable "vnstat-server" on every server which he wants to monitor its traffic.

Or Is there a better way?

AnonymousWebHacker commented 2 years ago

Perfect, it couldn't be better, to have a vnstat-server, and an API to be able to collect the data. In this way, your vnstat-client project would have a better use, and more logic, than just graphing the local traffic of where you execute it.

AnonymousWebHacker commented 2 years ago

The API for data collection would need a secret key, (not everyone would be happy that their data could be seen by others).

You can get a vnstat-server, which installs a web vnstat-client on the server, with credentials to view the graphs.

The vnstat-server can have a vnstat-server.conf , where you can configure whether you want a vnstat-client web service running, or just accept connections from a vnstat-client on a desktop PC.

As in the vnstat-client web/desktop you could add as many servers as you want, just having the secret key

hulxv commented 2 years ago

Okay, Thanks for suggestions. I will start build vnstat-server as soon as possible

AnonymousWebHacker commented 2 years ago

I have been working on a script hosted on a local repository, using vnstat . I specify the amount of traffic that an interface is allowed, and when it reaches that limit, it sends a report by mail, and performs tasks such as turning off vpns ..etc. It could also be some future enhancements added to your vnstat-client. I see a great future for your project.

I'll leave the inssuse open, so you have the honor of closing it when you do the vnstat-server :)

hulxv commented 2 years ago

Thanks a lot for you for your great suggestion 😄❤️.

When I finish building vnstat-server, I will inform you in this issue, If you have more suggestions, I will happy to hear it 😃.

vergoh commented 2 years ago

I have been working on a script hosted on a local repository, using vnstat . I specify the amount of traffic that an interface is allowed, and when it reaches that limit, it sends a report by mail, and performs tasks such as turning off vpns ..etc. It could also be some future enhancements added to your vnstat-client. I see a great future for your project.

Be sure to check the --alert feature added in version 2.9 as it should at least reduce the need of parsing vnStat output for triggering things when limit are reached and it also has the option of reacting to the estimated usage reaching a given limit. See the man page and the command line help text for an overview of the options, those offer rather many different combinations depending on the use case.

As for getting remote data, it may be worth checking the vnstat-json.cgi output. It provides the vnstat --json (+ parameters) output via http(s) a little bit depending on how it's installed and how the httpd is configured. It's also pre-configured as part of https://github.com/vergoh/vnstat-docker / https://hub.docker.com/r/vergoh/vnstat for rather effortless and fast deployment (assuming docker is available).

hulxv commented 2 years ago

I started work in vns or vnStat Server I know I'm late but I apologize for that. 😅

baxiry commented 2 years ago

If the purpose is to read vnstat data from several remote servers and control remotely... it is better to implement an ssh . connection You don't need to install clients on every server that read, send data, and wait for commands. Nor do you need to implement an api

hulxv commented 2 years ago

If the purpose is to read vnstat data from several remote servers and control remotely... it is better to implement an ssh . connection You don't need to install clients on every server that read, send data, and wait for commands. Nor do you need to implement an api

SSH is a solution but not the best for our case. I need something simple to use and provide me with what I need to use in vnstat-client, So I think building a REST API is better.

And after 5 months (yeah, I take a long time because I was busy studying, I'm sorry for that), Only a little left until I finish finally 😅

AnonymousWebHacker commented 2 years ago

Today ssh access is not reliable at all.

I think the best would be a vnstat-client to see/control the traffic of other nodes.

and a [vnstat-server or vnstat-node] that is installed on the servers that you want to monitor.

The vnstat-server will be in charge of sending data to the vnstat-client I - vnstat-client web (in case of being web and with static IP). II - vnstat-client desktop (I would have to see what method can be used so that vnstat-client identifies itself in the vnstat-server and this sends the metrics back)

vnstat-client or vnstat-node would be in charge of sending metrics, and executing actions/commands within the server

hulxv commented 2 years ago

After 4 months (yeah, It's too a long time). Finally, vnstat-server has been released.

Currently, I will be working on supporting it in vnstat-client.

nomanaziz2 commented 2 years ago

Hey, i really like and appreciate your work. I have two questions if you don't mind, 1) Will vnstat-client support integration with multiple vnstat-servers? 2) Is the release date of vnstat-client (integrated with vnstat-server) near?

hulxv commented 2 years ago

1) Will vnstat-client support integration with multiple vnstat-servers?

I didn't think about it before but it's will be a good feature and maybe I add it after the next release because if add it, that will delay the next release and that what I don't want to happen.

Anyway, after the next release I will open an issue to remember it and add it.

2) Is the release date of vnstat-client (integrated with vnstat-server) near?

Yes, It's very near, maybe in a few days. It's all ready but under testing to be sure all fine to release the new version.

Thank you for your interest and appreciation for the project, and I hope to provide something useful and good.

hulxv commented 2 years ago

I released v5.0.0-beta. Now, I want to be sure there are no bugs. So Is there anyone who can test it and write his feedback here to close the issue? If there are any bugs, I will fix it and release a new version.

Is there a volunteer for testing?

AnonymousWebHacker commented 2 years ago

I have been on vacation for a long time, although I have been waiting for your publications.

Let me take everything, and understand how it works, to help you with the tests.

hulxv commented 2 years ago

If there is anything you don't understand, You can ask here and I will explain it to you.

hulxv commented 2 years ago

Is all fine? @AnonymousWebHacker

AnonymousWebHacker commented 2 years ago

Working perfect for now , tnks for this great tool :)

hulxv commented 2 years ago

That's great! Thanks for your suggestion and If there is more suggestions or any problem, Just open an issue 😄.