SpitfireLoad Testing & Observabilityv1.4.9 · What's new

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

  1. Run on the nginx server.
    bash
    curl -fsSL "https://<spitfire>/api/v1/setup/ds/nginx.sh?t=<token>&lang=en" -o /tmp/sf-nginx.sh && bash /tmp/sf-nginx.sh
  2. When you see OK: ..., you are done.
Note

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

  1. Write the Tower machine's IP.
    bash
    TOWER_IP=10.0.0.5
  2. Write the Spitfire config.
    bash
    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
  3. Test and reload nginx.
    bash
    sudo nginx -t && sudo systemctl reload nginx
  4. Add it: Infrastructure sources → Nginx.
    text
    Address: http://<nginx-host>:8089/nginx_status   Access log port: 5140
  5. Check from the Tower machine.
    bash
    curl -fsS http://<nginx-host>:8089/nginx_status | grep -q '^Active connections' && echo 'OK: nginx stub_status reachable'
Note

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.

Note

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

  1. Run the command on the Apache server, answer the questions.

    bash
    curl -fsSL "https://<spitfire>/api/v1/setup/ds/apache.sh?t=<token>" -o /tmp/sf-apache.sh && bash /tmp/sf-apache.sh
  2. When you see this line, you are done.

    text
    OK: Apache added to Spitfire, first metrics within ~1 min
Note

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

  1. Add the status page.

    bash
    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-status
  2. Check the config and reload.

    bash
    sudo apachectl -t && sudo apachectl graceful
  3. Try it from the Tower machine.

    bash
    curl -fsS 'http://<host>/server-status?auto' | grep -q '^Total Accesses' && echo 'OK: Apache status page is open'
  4. Add it in Infrastructure sources → Apache → Manual install.

Note

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

  1. Run on the HAProxy server.
    bash
    curl -fsSL "https://<spitfire>/api/v1/setup/ds/haproxy.sh?t=<token>&lang=en" -o /tmp/sf-haproxy.sh && bash /tmp/sf-haproxy.sh
  2. When you see OK: ..., you are done.
Note

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

  1. Write the Tower machine's IP.
    bash
    TOWER_IP=10.0.0.5
  2. Back up haproxy.cfg.
    bash
    sudo cp -p /etc/haproxy/haproxy.cfg /etc/haproxy/haproxy.cfg.spitfire.bak
  3. Add the stats frontend.
    bash
    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
  4. Test and reload HAProxy.
    bash
    sudo haproxy -c -f /etc/haproxy/haproxy.cfg && sudo systemctl reload haproxy
  5. Add it: Infrastructure sources → HAProxy.
    text
    Address: http://<haproxy-host>:8404/stats
  6. Check from the Tower machine.
    bash
    curl -fsS 'http://<haproxy-host>:8404/stats;csv' | grep -q '^# pxname' && echo 'OK: HAProxy stats reachable'
Note

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)

  1. Copy the command, paste it into the terminal and run it.

    bash
    curl -fsSL "https://<spitfire>/api/v1/setup/ds/memcached.sh?t=<token>" -o /tmp/sf-memcached.sh && bash /tmp/sf-memcached.sh
  2. When you see OK: memcached ..., you are done.

Note

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

  1. Read the stats from the Tower machine.

    bash
    printf 'stats\r\nquit\r\n' | nc <host> 11211 | grep -q '^STAT uptime' && echo "OK: memcached"
  2. 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

  1. Run the command on the machine serving /metrics, answer the questions.

    bash
    curl -fsSL "https://<spitfire>/api/v1/setup/ds/prometheus.sh?t=<token>" -o /tmp/sf-prometheus.sh && bash /tmp/sf-prometheus.sh
  2. When you see this line, you are done.

    text
    OK: Metrics endpoint added to Spitfire, first metrics within ~1 min
Note

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

  1. Try the endpoint from the Tower machine.

    bash
    curl -fsS 'http://<host>:9100/metrics' | grep -q '^# TYPE' && echo 'OK: metrics endpoint answered'
  2. Add it in Infrastructure sources → Prometheus → Manual install.

  3. 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

  1. On the Tower machine curl -s http://<host>:8089/nginx_status (or the address in question) answers.
  2. Last test = Connected, and within 1-2 minutes the dashboard shows lines.