Hello

I have been trying to monitor stats in our uWSGI instance. Our config --
without the stats stuff -- looks like this:

>>
env UWSGI_VASSAL_MODULE=wsgi_app
env UWSGI_VASSAL_CHMOD=666
env UWSGI_VASSAL_DISABLE-LOGGING=true
setuid www-data
setgid www-data
exec /usr/local/bin/uwsgi --log-syslog emperor --emperor /etc/uwsgi/vassals
--emperor-broodlord 10
<<

>>
[uwsgi]
log-syslog=uwsgi-keepcalm
socket=:3031
pythonpath=/var/www-hosts/keepcalm
processes=4
zerg-server=/var/www-hosts/keepcalm/restricted/broodlord.sock
vassal-sos-backlog=5

[zerg]
log-syslog=uwsgi-keepcalm-zerg
zerg=/var/www-hosts/keepcalm/restricted/broodlord.sock
pythonpath=/var/www-hosts/keepcalm
<<

This means we have an emperor process, then a [uwsgi] master with four
workers underneath it. Under load, zerg masters will spawn, each with a
single worker underneath them.

http://uwsgi-docs.readthedocs.org/en/latest/Options.html#emperor-stats-emperor-stats-server

So, first off I tried `-emperor-stats` on :1717 in the main config. That
was kinda useless, because all it told me was that there was there was a
single Emperor doing very little. I expected it would return stats on all
of the children underneath the emperor, but it doesn't.

http://uwsgi-docs.readthedocs.org/en/latest/StatsServer.html

So I then I tried `stats=:1717` in the [uwsgi] section. That conflicted
with the emperor's use of the port, so I stopped the emperor from serving
stats. That was great, it told me what the four normal workers were doing
-- but it didn't give me the zerg stats. Of course, if I tell the zergs to
use :1717 they conflict with each other, the normal [uwsgi] workers and the
Emperor.

So I thought, OK, let's not use a port... I tried a file.
stats=/tmp/statsock and used `socat /tmp/statsock stdio` to watch it. But
then I found that whatever process spawned most recently would own the
stats and nothing would be shown for other processes.

I guess I could use SNMP or push to a file or Mongo, but I don't want to
use SNMP or Mongo and the file would get massive. All I want to do is get
some JSON which tells me what all the workers are doing, irrespective of
whether they're zergs or normal workers.

The only solution I can think of is to have:
/tmp/emperor.sock
/tmp/appname1-normalworkers.sock
/tmp/appname1-zerg1.sock
/tmp/appname1-zerg2.sock
/tmp/appname1-zerg3.sock
/tmp/appname2-normalworkers.sock
/tmp/appname2-zerg1.sock
/tmp/appname2-zerg2.sock
/tmp/appname2-zerg3.sock
etc.

...then poll /tmp/appname1* and munge the JSON together. But that can't be
right. I must be doing this wrong. How are other people doing this?

Best
Aidan
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to