...
Referensi
- How to use Apache Benchmark (ab) to login to a site, https://stackoverflow.com/questions/25339972/how-to-use-apache-benchmark-ab-to-login-to-a-site
...
sudo apt install curl gnupg2 ca-certificates lsb-release debian-archive-keyring
curl https://nginx.org/keys/nginx_signing.key | gpg --dearmor | sudo tee /usr/share/keyrings/nginx-archive-keyring.gpg >/dev/null
gpg --dry-run --quiet --import --import-options import-show /usr/share/keyrings/nginx-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] \
http://nginx.org/packages/debian `lsb_release -cs` nginx" | sudo tee /etc/apt/sources.list.d/nginx.list
echo -e "Package: *\nPin: origin nginx.org\nPin: release o=nginx\nPin-Priority: 900\n" \
| sudo tee /etc/apt/preferences.d/99nginx
sudo apt update && sudo apt upgrade
mkdir software
sudo apt-get source nginx
sudo apt-get build-dep nginx
cd nginx/
sudo dpkg -i lib*.deb
sudo dpkg -i nginx-core_1.18.0-6.1_amd64.deb nginx-common_1.18.0-6.1_all.deb nginx_1.18.0-6.1_all.deb
git clone https://github.com/vozlt/nginx-module-vts.git
cd /usr/local/src/nginx-1.18.0/
sudo ./configure --with-compat --add-dynamic-module=/home/cendikia/software/nginx-module-vts/
sudo make modules
sudo cp objs/ngx_http_vhost_traffic_status_module.so /etc/nginx/modules/
Untuk prometheus, kita tidak perlu menggunakan export, karena nginx-module-vts sudah mendukung format untuk prometheus, yg dapat diakses pada alamat :
http://localhost/status/format/prometheus
Konfigurasi prometheus
/etc/prometheus/prometheus.yml
scrape_configs:
# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
- job_name: 'prometheus'
# Override the global default and scrape targets from this job every 5 seconds.
scrape_interval: 5s
scrape_timeout: 5s
# metrics_path defaults to '/metrics'
# scheme defaults to 'http'.
static_configs:
- targets: ['localhost:9090']
- job_name: node
# If prometheus-node-exporter is installed, grab stats about the local
# machine by default.
static_configs:
- targets: ['localhost:9100']
- job_name: 'nginx-vts'
metrics_path: '/status/format/prometheus'
static_configs:
- targets: ['localhost']
Grafana
Untuk Grafana kita menggunakan Dashboard berikut :
https://grafana.com/grafana/dashboards/14824
Referensi