Version: 1.4.9This documentation is for Spitfire 1.4.9.
Infrastructure — web servers, Memcached, Prometheus
Nginx, Apache, HAProxy, Memcached and Prometheus endpoints are collected through a Tower. They need no user; open the status page to the Tower's IP only. The add steps are the same as for databases.
Nginx
Quick install
- Run on the nginx server.
curl -fsSL "https://<spitfire>/api/v1/setup/ds/nginx.sh?t=<token>&lang=en" -o /tmp/sf-nginx.sh && bash /tmp/sf-nginx.sh - When you see
OK: ..., you are done.
The script writes only /etc/nginx/conf.d/spitfire.conf (an older one is kept as
spitfire.conf.spitfire.bak), runs nginx -t and reloads only after asking. The file opens
stub_status on port 8089 to the Tower IP and 127.0.0.1 only, and sends every request as one JSON
line over syslog (UDP 5140) to the Tower's Collector; nothing runs on the nginx server. In the
product the line comes ready with the address and a fresh token.
Manual install
- Write the Tower machine's IP.
TOWER_IP=10.0.0.5 - Write the Spitfire config.
sudo tee /etc/nginx/conf.d/spitfire.conf >/dev/null <<'EOF' log_format spitfire_json escape=json '{"time":"$time_iso8601","status":"$status","request_time":"$request_time",' '"upstream":"$proxy_host","upstream_addr":"$upstream_addr","upstream_status":"$upstream_status",' '"upstream_response_time":"$upstream_response_time","method":"$request_method"}'; access_log syslog:server=<tower-ip>:5140,tag=nginx,nohostname spitfire_json; server { listen 8089; location = /nginx_status { stub_status; allow <tower-ip>; allow 127.0.0.1; deny all; } } EOF sudo sed -i "s/<tower-ip>/$TOWER_IP/g" /etc/nginx/conf.d/spitfire.conf - Test and reload nginx.
sudo nginx -t && sudo systemctl reload nginx - Add it: Infrastructure sources → Nginx.
Address: http://<nginx-host>:8089/nginx_status Access log port: 5140 - Check from the Tower machine.
curl -fsS http://<nginx-host>:8089/nginx_status | grep -q '^Active connections' && echo 'OK: nginx stub_status reachable'
Why the access log: stub_status gives connections only. The JSON line gives the
status class, request time (p50/p95/average), the upstream, the peer and its response time; it
works on the free nginx too, with no module and no agent. Allow UDP 5140 from the nginx server to the
Tower. A server block with its own access_log does not inherit this one: add the same
access_log syslog:... line inside it. When /etc/nginx/conf.d is not included in http {},
nginx -T | grep spitfire.conf shows nothing; then write the file into the included directory.
The VTS module can be read with the Prometheus monitored system instead.
NGINX Plus (Beta): run nginx-prometheus-exporter --nginx.plus --nginx.scrape-uri=http://127.0.0.1:8080/api and enter its address in the NGINX Plus exporter
address field (e.g. http://web.corp:9113/metrics); the dashboard then shows the peer states from
the Plus API. Tested with recorded data only. Panels: requests, requests by status class, upstream
requests by result, connections, accepted and handled connections. Tables: requests, 4xx/5xx,
average/p50/p95, active and dropped connections; upstreams; peers. Findings: dropped connections,
5xx above 1%, p95 above 1 s, a peer down (warning), every peer of an upstream down (critical).
Apache
Quick install
Run the command on the Apache server, answer the questions.
curl -fsSL "https://<spitfire>/api/v1/setup/ds/apache.sh?t=<token>" -o /tmp/sf-apache.sh && bash /tmp/sf-apache.shWhen you see this line, you are done.
OK: Apache added to Spitfire, first metrics within ~1 min
In the product (the Quick install tab) the command comes ready with your address and a fresh token; the token is valid for 1 hour and adds one monitored system. The script knows the Debian/Ubuntu, RHEL and official httpd image layouts, opens the status page to the Tower's IP only, checks the config with -t and does a graceful reload once you agree.
Manual install
Add the status page.
sudo tee /etc/apache2/conf-available/spitfire-status.conf >/dev/null <<'EOF' ExtendedStatus On <Location "/server-status"> SetHandler server-status Require ip <tower-ip> </Location> EOF sudo a2enmod status && sudo a2enconf spitfire-statusCheck the config and reload.
sudo apachectl -t && sudo apachectl gracefulTry it from the Tower machine.
curl -fsS 'http://<host>/server-status?auto' | grep -q '^Total Accesses' && echo 'OK: Apache status page is open'Add it in Infrastructure sources → Apache → Manual install.
On RHEL the file is /etc/httpd/conf.d/spitfire-status.conf and needs no a2enmod/a2enconf. Address: http://<host>/server-status?auto.
HAProxy
Quick install
- Run on the HAProxy server.
curl -fsSL "https://<spitfire>/api/v1/setup/ds/haproxy.sh?t=<token>&lang=en" -o /tmp/sf-haproxy.sh && bash /tmp/sf-haproxy.sh - When you see
OK: ..., you are done.
The script adds one block at the end of haproxy.cfg between # BEGIN spitfire and
# END spitfire (the file is backed up as haproxy.cfg.spitfire.bak), runs haproxy -c and
reloads only after asking. A rerun replaces the block, never adds a second one. In the product the
line comes ready with the address and a fresh token.
Manual install
- Write the Tower machine's IP.
TOWER_IP=10.0.0.5 - Back up haproxy.cfg.
sudo cp -p /etc/haproxy/haproxy.cfg /etc/haproxy/haproxy.cfg.spitfire.bak - Add the stats frontend.
sudo tee -a /etc/haproxy/haproxy.cfg >/dev/null <<'EOF' # BEGIN spitfire frontend spitfire_stats mode http bind *:8404 acl spitfire_tower src <tower-ip> 127.0.0.1 http-request deny unless spitfire_tower http-request use-service prometheus-exporter if { path /metrics } stats enable stats uri /stats stats refresh 10s # END spitfire EOF sudo sed -i "s/<tower-ip>/$TOWER_IP/g" /etc/haproxy/haproxy.cfg - Test and reload HAProxy.
sudo haproxy -c -f /etc/haproxy/haproxy.cfg && sudo systemctl reload haproxy - Add it: Infrastructure sources → HAProxy.
Address: http://<haproxy-host>:8404/stats - Check from the Tower machine.
curl -fsS 'http://<haproxy-host>:8404/stats;csv' | grep -q '^# pxname' && echo 'OK: HAProxy stats reachable'
The frontend answers the Tower IP and 127.0.0.1 only. Delete the prometheus-exporter
line when haproxy -vv | grep prometheus prints nothing (the script checks this itself). Spitfire
turns on the receiver's optional metrics (status, active servers, queue, response time, failed
checks, downtime) and keeps them per frontend, backend and server. Tables: backends (troubled
first), servers, frontends. Findings: a backend with no UP server (critical), a server DOWN, 5xx
above 1%, a queue for 5 minutes, sessions above 90% of the limit, failing health checks
(warning).
Memcached
Quick install (on the Tower machine)
Copy the command, paste it into the terminal and run it.
curl -fsSL "https://<spitfire>/api/v1/setup/ds/memcached.sh?t=<token>" -o /tmp/sf-memcached.sh && bash /tmp/sf-memcached.shWhen you see
OK: memcached ..., you are done.
In the product UI these lines come ready, with your address and a fresh token. Memcached needs no user: the script reads stats from the Tower machine, shows the connection and memory limits and registers the source. SASL is not supported: neither the Collector's receiver nor the text protocol's stats can authenticate, so open port 11211 to the Tower's IP only.
Manual install
Read the stats from the Tower machine.
printf 'stats\r\nquit\r\n' | nc <host> 11211 | grep -q '^STAT uptime' && echo "OK: memcached"Add it under Infrastructure sources → Memcached, address
<host>:11211.
Live view
The Memcached dashboard has a Live view card. Read now reads stats, stats slabs and stats items on the Tower: connections against max_connections, memory against limit_maxbytes, evictions, reclaimed and expired-unfetched items, and the slab classes by memory. A class with out-of-memory errors is marked red, one that evicts yellow. Counters are compared over the last 15 minutes of reads.
Prometheus
Quick install
Run the command on the machine serving
/metrics, answer the questions.curl -fsSL "https://<spitfire>/api/v1/setup/ds/prometheus.sh?t=<token>" -o /tmp/sf-prometheus.sh && bash /tmp/sf-prometheus.shWhen you see this line, you are done.
OK: Metrics endpoint added to Spitfire, first metrics within ~1 min
In the product (the Quick install tab) the command comes ready with your address and a fresh token; the token is valid for 1 hour and adds one monitored system. Any endpoint serving /metrics works (e.g. node_exporter on :9100); the script tries the address and checks it speaks the Prometheus format.
Manual install
Try the endpoint from the Tower machine.
curl -fsS 'http://<host>:9100/metrics' | grep -q '^# TYPE' && echo 'OK: metrics endpoint answered'Add it in Infrastructure sources → Prometheus → Manual install.
Every metric of the endpoint is on the dashboard's All metrics tab: All metrics.
Threshold findings
| Technology | Finding |
|---|---|
| Nginx | Dropped connections, 5xx above 1%, p95 above 1 s, a peer down (warning); every peer of an upstream down (critical) |
| HAProxy | A server DOWN, 5xx above 1%, a queue for 5 minutes, sessions above 90% of the limit, failing health checks, response or connection errors (warning); a backend with no UP server (critical) |
| Memcached | Evictions went up (warning) |
| Memcached | Memory above 90% of limit_maxbytes while evicting (warning) |
| Memcached | Get hit ratio below 80%, from 100 gets on (warning) |
| Memcached | Connections above 90% of max_connections (warning) |
| Memcached | Connections refused: rejected_connections or listen_disabled_num went up (critical) |
| Memcached | Out-of-memory errors: items could not be stored (critical) |
| Memcached | Restarted recently: the cache is cold (warning) |
| Prometheus | A scrape target is down, up = 0 (critical) |
Success check
- On the Tower machine
curl -s http://<host>:8089/nginx_status(or the address in question) answers. - Last test = Connected, and within 1-2 minutes the dashboard shows lines.