User Tools

Site Tools


Sidebar


Tags Cloud
nginx_ustats

This is an old revision of the document!


Автоматическая установка модуля ustats, предназначенного для отображения статистики upstream'ов для nginx.
Версия под Debian wheezy. Должен быть установлен пакет build-essential.

Активируется по добавлению в конфиг виртуального хоста

      location /ustats {
          ustats memsize=2m;
          ustats_refresh_interval 6000;
          ustats_html_table_width 95;
          ustats_html_table_height 95;
      }

Сам скрипт:

#!/bin/bash

SRC_DIR="/opt/src/ustats"

mkdir -p $SRC_DIR
git clone https://github.com/0xc0dec/ustats.git $SRC_DIR
cd $SRC_DIR
git pull

rm -rf $SRC_DIR/nginx-src
mkdir -p $SRC_DIR/nginx-src
cd $SRC_DIR/nginx-src
apt-get source nginx-full
apt-get build-dep nginx-full -y

nginx_src=`find $SRC_DIR/nginx-src -maxdepth 1 -type d | tail -n 1`
cd $nginx_src

cat $SRC_DIR/nginx.patch | patch -p1 --dry-run
OUT=$?
if [[ $OUT == 0 ]]; then
    cat $SRC_DIR/nginx.patch | patch -p1
    cp -a $SRC_DIR/ustats src/http/modules/
    sed 's#--prefix=/etc/nginx \\#--prefix=/etc/nginx --add-module=src/http/modules/ustats \\#g' -i debian/rules
    debuild -us -uc -b
fi
nginx_ustats.1387114569.txt.gz · Last modified: 2013/12/15 13:36 by kyxap