Skip to content

Commit 1dd04dd

Browse files
Added support for advanced metrics (#126)
* Added API Connectivity Manager 1.5.0 support * Ownership fix * Startup script fix * NGINX App Protect WAF updates * Tested with NGINX Instance Manager 2.9.1 * Added docker-compose support * Tested with NGINX Instance Manager 2.10.0 and Security Monitoring 1.4.0 * Tested with NGINX Instance Manager 2.10.0 and API Connectivity Manager 1.5.0 * Tested with API Connectivity Manager 1.6.0 * Tested with API Connectivity Manager 1.6.0 * README updated * Added support for NGINX Instance Manager 2.10.1 and App Delivery Manager 4.0.0 * Fixed NGINX App Protect detection bug for NGINX Instance Manager 2.10.0+ * Fixed agent syslog receiver bug * README updated * Tested with NGINX Instance Manager 2.11.0 and Security Monitoring 1.5.0 * Tested with NGINX Instance Manager 2.11.0 * Tested with NGINX API Connectivity Manager 1.7.0 * Tested with NGINX Instance Manager 2.12.0 and Security Monitoring 1.6.0 * Tested with API Connectivity Manager 1.8.0 * Tested with API Connectivity Manager 1.8.0 * Tested with NGINX Instance Manager 2.12.0 * Dockerfile updated * Support for NGINX Instance Manager 2.13 * Tested with NGINX Instance Manager 2.13 * Tested with NIM 2.14.0 and SM 1.7.0 * Tested with NIM 2.14.0 and SM 1.7.0 * Tested with NGINX Instance Manager 2.14.0 * Tested with NGINX Instance Manager 2.14.0 * Tested with NGINX App Protect compiler v4.583.0 * Start script updated * Advanced metrics support added * Advanced metrics support added --------- Signed-off-by: 65397 <[email protected]>
1 parent 3c0b01b commit 1dd04dd

File tree

3 files changed

+39
-11
lines changed

3 files changed

+39
-11
lines changed

nginx-agent-docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ARG NAP_WAF=false
66

77
# Initial packages setup
88
RUN apt-get -y update \
9-
&& apt-get -y install apt-transport-https lsb-release ca-certificates wget gnupg2 curl debian-archive-keyring \
9+
&& apt-get -y install apt-transport-https lsb-release ca-certificates wget gnupg2 curl debian-archive-keyring iproute2 \
1010
&& mkdir -p /deployment /etc/ssl/nginx \
1111
&& addgroup --system --gid 20983 nginx \
1212
&& adduser --system --disabled-login --ingroup nginx --no-create-home --home /nonexistent --gecos "nginx user" --shell /bin/false --uid 20983 nginx

nginx-agent-docker/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This repository can be used to build a docker image with NGINX Plus and NGINX In
88

99
This repository has been tested with NGINX agent for:
1010

11-
- NGINX Instance Manager 2.4.0, 2.5.0, 2.5.1, 2.6.0, 2.7.0, 2.8.0, 2.9.0, 2.10.0, 2.10.1, 2.11.0, 2.12.0, 2.13.0, 2.13.1, 2.14.0
11+
- NGINX Instance Manager 2.4.0, 2.5.0, 2.5.1, 2.6.0, 2.7.0, 2.8.0, 2.9.0, 2.10.0, 2.10.1, 2.11.0, 2.12.0, 2.13.0, 2.13.1, 2.14.0, 2.14.1
1212
- API Connectivity Manager 1.4.0, 1.5.0, 1.6.0, 1.7.0, 1.8.0, 1.9.0
1313
- NGINX App Protect WAF 4.100.1+
1414

@@ -75,8 +75,9 @@ the build script will push the image to your private registry once build is comp
7575
1. Edit `manifests/1.nginx-nim.yaml` and specify the correct image by modifying the `image:` line, and set the following environment variables. Default values for `NIM_HOST` and `NIM_GRPC_PORT` can be used if NGINX Instance Manager is deployed using https://github.com/nginxinc/NGINX-Demos/tree/master/nginx-nms-docker
7676
- `NIM_HOST` - NGINX Instance Manager hostname/IP address
7777
- `NIM_GRPC_PORT` - NGINX Instance Manager gRPC port.
78-
- `NIM_INSTANCEGROUP` - instance group for the NGINX Kubernetes Deployment
79-
- `NIM_TAGS` - comma separated list of tags for the NGINX Kubernetes Deployment
78+
- `NIM_INSTANCEGROUP` - instance group for the NGINX instance
79+
- `NIM_TAGS` - comma separated list of tags for the NGINX instance
80+
- `NIM_ADVANCED_METRICS` - set to `"true"` to enable advanced metrics collection
8081
- `NAP_WAF` - set to `"true"` to enable NGINX App Protect WAF (docker image built using `-w`)
8182
- `NAP_WAF_PRECOMPILED_POLICIES` - set to `"true"` to enable NGINX App Protect WAF precompiled policies (docker image built using `-w`)
8283
- `ACM_DEVPORTAL` - set to `"true"` to enable API Connectivity Manager Developer Portal (docker image built using `-d`)

nginx-agent-docker/container/start.sh

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,35 @@ if [[ ! -z "$NIM_TAGS" ]]; then
2727
PARM="${PARM} --tags $NIM_TAGS"
2828
fi
2929

30+
if [[ "$NIM_ADVANCED_METRICS" == "true" ]]; then
31+
if [ $OLD_AGENT == "false" ]
32+
then
33+
EXTRA_EXTENSIONS="- advanced-metrics"
34+
35+
cat - << __EOT__ >> /etc/nginx-agent/nginx-agent.conf
36+
37+
# Advanced metrics
38+
advanced_metrics:
39+
socket_path: /var/run/nginx-agent/advanced-metrics.sock
40+
aggregation_period: 1s
41+
publishing_period: 3s
42+
table_sizes_limits:
43+
staging_table_max_size: 1000
44+
staging_table_threshold: 1000
45+
priority_table_max_size: 1000
46+
priority_table_threshold: 1000
47+
__EOT__
48+
fi
49+
fi
50+
3051
if [[ "$NAP_WAF" == "true" ]]; then
3152
if [ $OLD_AGENT == "true" ]
3253
then
3354
PARM="${PARM} --nginx-app-protect-report-interval 15s --nap-monitoring-collector-buffer-size 50000 --nap-monitoring-processor-buffer-size 50000 --nap-monitoring-syslog-ip 127.0.0.1 --nap-monitoring-syslog-port 514"
3455
else
35-
cat - << __EOT__ >> /etc/nginx-agent/nginx-agent.conf
56+
EXTRA_EXTENSIONS=$EXTRA_EXTENSIONS"\n- nginx-app-protect\n- nap-monitoring"
3657

37-
# Enable NAP and Advanced Metrics
38-
extensions:
39-
- advanced-metrics
40-
- nginx-app-protect
41-
- nap-monitoring
58+
cat - << __EOT__ >> /etc/nginx-agent/nginx-agent.conf
4259
4360
# NGINX App Protect Monitoring config
4461
nap_monitoring:
@@ -62,7 +79,6 @@ __EOT__
6279
done
6380

6481
chown nginx:nginx /opt/app_protect/pipe/*
65-
fi
6682

6783
if [[ "$NAP_WAF_PRECOMPILED_POLICIES" == "true" ]]; then
6884
if [ $OLD_AGENT == "true" ]
@@ -78,6 +94,17 @@ __EOT__
7894
fi
7995
fi
8096

97+
fi
98+
99+
if [[ "$EXTRA_EXTENSIONS" != "" ]]; then
100+
cat - << __EOT__ >> /etc/nginx-agent/nginx-agent.conf
101+
102+
# Enable extensions
103+
extensions:
104+
`echo -e $EXTRA_EXTENSIONS | sed "s/^/\ \ /g"`
105+
__EOT__
106+
fi
107+
81108
if [[ "$ACM_DEVPORTAL" == "true" ]]; then
82109
nginx-devportal server &
83110
fi

0 commit comments

Comments
 (0)