Для мониторинга нужно делать запрос к самому игровому серверу, используя valve a2s протокол. На python есть несколько библиотек, реализующих этот протокол:
python-valve,
python-a2s
Пример python-value:
import valve.source.a2s
SERVER_ADDRESS = (..., ...)
with valve.source.a2s.ServerQuerier(SERVER_ADDRESS) as server:
info = server.info()
players = server.players()
print("{player_count}/{max_players} {server_name}".format(**info))
for player in sorted(players["players"], key=lambda p: p["score"], reverse=True):
print("{score} {name}".format(**player))
Пример python-a2s:
>>> import a2s
>>> address = ("stomping.kinofnemu.net", 27015)
>>> a2s.info(address)
SourceInfo(protocol=17, server_name=" 24/7 Dustbowl :: Nemu's Stomping Ground", map_name='cp_dustbowl',
folder='tf', game='Team Fortress', app_id=440, player_count=31, max_players=33, bot_count=21,
server_type='d', platform='l', password_protected=False, vac_enabled=True, version='5579073',
edf=177, port=27015, steam_id=85568392920040090, stv_port=None, stv_name=None,
keywords='brutus,celt,couch,cp,dustbowl,increased_maxplayers,nemu,nocrits,nodmgspread,pony,replays,vanilla',
game_id=440, ping=0.253798684978392)
>>> a2s.players(address)
[Player(index=0, name='Brutus', score=34, duration=836.4749145507812),
Player(index=0, name='RageQuit', score=6, duration=1080.8099365234375),
Player(index=0, name="Screamin' Eagles", score=1, duration=439.8598327636719)]
>>> a2s.rules(address)
{'coop': '0', 'deathmatch': '1', 'decalfrequency': '10', 'metamod_version': '1.10.7-devV',
'mp_allowNPCs': '1', 'mp_autocrosshair': '1', 'mp_autoteambalance': '0', 'mp_disable_respawn_times': '0',
'mp_fadetoblack': '0'}