You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 15, 2024. It is now read-only.
When I use myserver._info, it sends out a big dictionary which has ram when it's offline and ram and maxram when online. maxram is kind of self-explanatory but ram also works like maxram and does not give the actual RAM usage.
And now, how I use python-aternos. I use this in my node.js project by calling the python file through the terminal with a feature in node.js and I am an absolute newbie in python.
If anyone can tell me how to get RAM usage that'll be very appreciated or if the developer itself adds something to get RAM usage, that'll be very nice of them
The text was updated successfully, but these errors were encountered:
server.ram (and server._info['ram']) returns data from the _info dictionary which is requested just one time - when AternosServer object is created.
You can update it manually calling server.fetch(), but if you send this request in a loop for auto-updates, Aternos might suspend your account, so you should use websocket streams.
When your Minecraft server is online, there is a used RAM indicator on the server panel page (aternos.org/panel) that is updated in real-time by a script which receives data from a websocket server at aternos.org/hermes. But we have to subscript to the "used RAM (heap)" stream, more about streams.
Here's how to do it in python-aternos:
importasynciofrompython_aternosimportClient, atwssat=Client.from_credentials('username', 'password')
srv=at.list_servers()[0]
socket=srv.wss() # AternosWss object# handler for used RAM stream@socket.wssreceiver(atwss.Streams.ram)asyncdefram(used):
# used is intprint('Current RAM usage:', used, 'bytes')
# starting minecraft serversrv.start()
# connecting to websocket# this function also sends streams subscriptionsasyncio.run(socket.connect())
That's all. Run the script and you'll get output like: Current RAM usage: 879372712 bytes
When I use
myserver._info
, it sends out a big dictionary which hasram
when it's offline andram
andmaxram
when online.maxram
is kind of self-explanatory butram
also works likemaxram
and does not give the actual RAM usage.And now, how I use python-aternos. I use this in my node.js project by calling the python file through the terminal with a feature in node.js and I am an absolute newbie in python.
If anyone can tell me how to get RAM usage that'll be very appreciated or if the developer itself adds something to get RAM usage, that'll be very nice of them
The text was updated successfully, but these errors were encountered: