Search code examples
djangouwsgigraphitegraphite-carbon

uwsgi vassal magic variable


I'm running uwsgi 1.9.20 in emperor mode and sending all of my vassals' stats to a carbon/graphite server. Looking good, except the %n magic variable doesn't return the "filename without extension" as specified in the docs, but rather the socket setting, e.g. 127_0_0_1:14002. Or at least that is what I see in graphite.

# uwsgi.ini
[uwsgi]
emperor = /usr/local/uwsgi/vassals/
emperor-tyrant = 1 
vacuum = 1
carbon = 172.12.2.4:2003
carbon-id = %n
# settings to apply to all vassals
vassal-set = plugin-dir=/usr/local/uwsgi/plugins 
vassal-set = enable-metrics=1 
vassal-set = carbon=172.12.2.4:2003
vassal-set = plugins=carbon
vassal-set = carbon-use-metrics=1

The emperor is started with:

uwsgi --ini /usr/local/uwsgi/uwsgi.ini

Example vassal config:

# bob.xml
<uwsgi>
    <pidfile>/home/bob/bob.pid</pidfile>
    <socket>127.0.0.1:14002</socket>
    <protocol>scgi</protocol>
    <pythonpath>/home/bob/pybin/bob</pythonpath>
    <virtualenv>/home/bob/pybin/bob-venv</virtualenv>
    <module>bob.wsgi</module>
    <workers>3</workers>
    <procname-prefix>bob: </procname-prefix>
    <buffer-size>8192</buffer-size>
    <daemonize>/home/bob/logs/bob.log</daemonize>
    <disable-logging />
    <master />
    <vacuum />
</uwsgi>

I also tried vassal-set = carbon-id=%n, but that shows up as just uwsgi in graphite. What am I doing wrong with the magic variable here?

FYI Python version is 2.7.3 on CentOS 6.4.


Solution

  • The carbon metric name is built as:

    carbon-root.hostname.carbon-id
    

    so you need to set both carbon-root and carbon-id