uWSGI
Bleemeo monitors uWSGI through automatic service detection and built-in metrics gathered from the uWSGI stats server.
Auto-Detection
Section titled “Auto-Detection”Glouton automatically detects uWSGI instances running on the host. To enable metrics collection, the stats server must be enabled by adding --stats 127.0.0.1:1717 --memory-report to your uWSGI command. Without --memory-report, the uwsgi_memory_used metric is not available.
By default, Glouton assumes the stats server runs on port 1717. If the auto-detected parameters are incorrect, you can override them manually.
sudo tee /etc/glouton/conf.d/99-uwsgi.conf > /dev/null << 'EOF'service: # For a uWSGI running outside a container - type: "uwsgi" address: "127.0.0.1" port: 8080 stats_port: 1717 # If your server uses the --stats-http option, set the protocol to "http". # If not set, "tcp" is used by default. stats_protocol: "tcp"
# For an additional uWSGI running outside a container - type: "uwsgi" instance: "NAME_ASSOCIATED_WITH_YOUR_ADDITIONAL_SERVICE" address: "127.0.0.1" port: 8080 stats_port: 1717
# For a uWSGI running in a Docker container - type: "uwsgi" instance: "CONTAINER_NAME" port: 8080 stats_port: 1717EOFCreate or edit C:\ProgramData\glouton\conf.d\99-uwsgi.conf:
service: # For a uWSGI running outside a container - type: "uwsgi" address: "127.0.0.1" port: 8080 stats_port: 1717 # If your server uses the --stats-http option, set the protocol to "http". # If not set, "tcp" is used by default. stats_protocol: "tcp"
# For an additional uWSGI running outside a container - type: "uwsgi" instance: "NAME_ASSOCIATED_WITH_YOUR_ADDITIONAL_SERVICE" address: "127.0.0.1" port: 8080 stats_port: 1717
# For a uWSGI running in a Docker container - type: "uwsgi" instance: "CONTAINER_NAME" port: 8080 stats_port: 1717Built-in Metrics
Section titled “Built-in Metrics”| Metric | Description |
|---|---|
service_status | Status of uWSGI |
uwsgi_requests | Number of requests per second |
uwsgi_transmitted | Amount of data transmitted in bits per second |
uwsgi_memory_used | Memory used in bytes |
uwsgi_avg_request_time | Average time to process a request in seconds |
uwsgi_exceptions | Number of exceptions per second |
uwsgi_harakiri_count | Number of worker timeouts per second |
Monitoring Troubleshooting
Section titled “Monitoring Troubleshooting”See Troubleshoot a Service Check or Missing Metrics for what applies to every service: finding the address and port Glouton really uses, what each check message means, and how to read the collection error — which does not appear in the agent logs at the default level.
The Service Check is not OK
Section titled “The Service Check is not OK”The check only opens the TCP port — it sends no command — so it fails when the
port is wrong (Connection refused), when a firewall drops the packets
(connection timed out after 10 seconds), or when the configured address
cannot be parsed (Invalid TCP address). A green check proves the port is
open, and nothing more.
Metrics are Missing
Section titled “Metrics are Missing”A passing check says nothing about the metrics: they are collected separately.
Metrics come from the uWSGI stats server, on stats_port if set and 1717
otherwise, over TCP unless stats_protocol says http.
Reproduce what Glouton does, from the machine where the agent runs:
nc -w 2 127.0.0.1 1717 | head -c 200| What you see | Cause | Fix |
|---|---|---|
| a connection error on port 1717 | The stats server is not enabled | Add --stats 127.0.0.1:1717 to the uWSGI command |
a connection error, and no TCP port for uWSGI in ss -lntp |
The stats server listens on a UNIX socket | Glouton does not support the socket form — expose the stats server on a TCP port |
| a connection error | The stats server is on another port | Set stats_port |
| a parsing error | The stats server is exposed over HTTP | Set stats_protocol: "http" |
uwsgi_memory_used is the only missing metric, everything else arrives |
uWSGI does not collect memory usage unless asked to | Add --memory-report to the uWSGI command |