Get Client RAM Consumption (and more)

Hello all,

Is there a way to get the RAM (and uptime) of clients (throught scripting for example) in order to monitor/display it ?

The system.util.getSessionsInfos() is very close from what I need but it lacks the RAM.

You could setup a gateway message handler event script to accept messages containing RAM usage info from clients. In that gateway handler, you could update a dataset tag that has ids, usernames, and RAM availability+usage. Then each client would only need to read the dataset tag and format it into a vision component.

The clients would also need a client event timer script to send those RAM update messages at a reasonable interval. You’d also want to send a message in a client shutdown script to tell the gateway to purge that users information from the dataset. That way only active client connections will be present in your RAM dataset.

1 Like

Sure - just system.net.httpGet, eg:

sessionEndpoint = system.util.getGatewayAddress() + '/data/vision/status/sessions'
sessionData = system.net.httpGet(sessionEndpoint)
sessions = system.util.jsonDecode(sessionData)

Just about all of the new status pages in 7.9 are using Javascript to query the gateway for JSON data, which is then rendered by the frontend. By hitting these endpoints yourself you can pull in the same data.

1 Like

I’m not sure if I’m doing that right - first I had a 403 error, but what returned from my getGatewayAddress() had /main in it so I removed that from the end, and then it worked but this seems to have returned the HTML for initial project page.

Edit: I’m not super knowledgable w/ this end of things so I think I’m understanding now that the original path was fine, but I wasn’t logged in so it was forbidden?

Edit: I'm not super knowledgable w/ this end of things so I think I'm understanding now that the original path was fine, but I wasn't logged in so it was forbidden?

The status/config page endpoints do indeed require authenticated gateway sessions. This is to prevent unauthorized access to potentially sensitive system information.

1 Like

Right, that makes sense, but I’m not sure how to make sure that happens. I would have imagined the designer and script console, which have already been authenticated in some way, would already have that covered. I haven’t tried it in the actual clientso that may work there, but it would be awkward to try and develop something when you can’t get decent information in the designer (without doing something weird to get sample data)

1 Like

Did you ever find a resolution to this? I’m working on logging client RAM usage right now.