Page 1 of 1

UOSA stats in Conky

Posted: Wed Sep 07, 2011 10:50 pm
by Stuck
I guess this is the most appropriate place to post this. Here is something I hacked up very quickly. It's a way of displaying UOSA stats on your conky setup. If you don't know what conky is, I highly recommend looking into it for nerd points.

It works by polling myUOSA every couple of minutes with curl, and then setting up a grep pipeline to extract the desired data. It's very hacky and not very efficient, but it will allow you to display the current number of players online as well as the time of the next event on your conky window.

Players Online:

Code: Select all

Players: ${texeci 1800 curl -s http://my.uosecondage.com/Status | grep -m 1 -oE "Players Online: [0-9]+" | grep -oE "[0-9]+"} online
Next Event:

Code: Select all

Next Event: ${texeci 1800 curl -s http://my.uosecondage.com/Events/Schedule | grep -m 1 -oE "[0-9]+:[0-9]+[apm]+"}
These should be inserted into your ~/.conkyrc file, under the TEXT section. (See: http://conky.sourceforge.net/documentation.html for more info). You also obviously need curl installed.

Warning: Do not set the polling intervals to anything lower than what they are. It will be spawning a bunch of threads for no reason and it's already inefficient on top of that. Furthermore, I'm sure Derrick doesn't want people polling myUOSA every 2 seconds. As it stands right now, I have the polling intervals set at 30 minutes, which I think is reasonable. I will not be held responsible for whatever happens to anyone's machine if you do something less than intelligent.

Re: UOSA stats in Conky

Posted: Mon Apr 09, 2012 4:25 pm
by Derrick
I think the new website broke this :(

The stats are now coming from a soon to be new joinUO service.
This will grab the shard stats as a json: http://api.joinuo.com/api/status/bf8d24 ... 827f9f6a1b

Sample:
{"Chars":190142,"Clients":530,"isOnline":true,"Items":7994272,"PollTime":"2012-04-09T20:25:16.6706328Z","Uptime":"09:04:41","Ver":2}

The json format and location of this service are still pretty preliminary; I'll repost when it's final.

Correction: Misread the OP, this is using the myUOSA status page, but the web api may be a better place to snatch the stats from, and feel free to poll every few seconds.

Re: UOSA stats in Conky

Posted: Mon Apr 23, 2012 6:42 pm
by Stuck
Derrick wrote:The stats are now coming from a soon to be new joinUO service.
This will grab the shard stats as a json: http://api.joinuo.com/api/status/bf8d24 ... 827f9f6a1b

Sample:
{"Chars":190142,"Clients":530,"isOnline":true,"Items":7994272,"PollTime":"2012-04-09T20:25:16.6706328Z","Uptime":"09:04:41","Ver":2}
This is really cool. This will be even better for conky stats. Unfortunately, there's no real omnipresent command-line tool for parsing json, but it's still possible to `sed` or `awk` it.

Re: UOSA stats in Conky

Posted: Wed Apr 25, 2012 11:35 pm
by Derrick
If you need a better format I'd be happy to provide. Let me know :)