Prerequisites
install the infrastructure agent (newrelic-infra)
check nginx status page working or not
curl http://127.0.0.1/status // its a php fpm page don’t confuse (i did)
pool: www
process manager: dynamic
start time: 12/May/2021:02:49:15 +0000
start since: 213269
accepted conn: 37437
listen queue: 0
max listen queue: 6
listen queue len: 65536
idle processes: 15
active processes: 1
total processes: 16
max active processes: 13
max children reached: 0 (read more at php fpm status page)
process manager: dynamic
start time: 12/May/2021:02:49:15 +0000
start since: 213269
accepted conn: 37437
listen queue: 0
max listen queue: 6
listen queue len: 65536
idle processes: 15
active processes: 1
total processes: 16
max active processes: 13
max children reached: 0 (read more at php fpm status page)
root@-s-4vcpu-8gb-blr1-01:~# curl http://127.0.0.1/nginx_status/
Active connections: 58
server accepts handled requests
1264885 1264885 1360068
Reading: 0 Writing: 1 Waiting: 57
Active connections: 58
server accepts handled requests
1264885 1264885 1360068
Reading: 0 Writing: 1 Waiting: 57
here waiting means keepalive connections
NGINX integration (nri-nginx)
new relic nginx integration
sudo apt-get install -y newrelic-infra nri-nginx
Edit newrelic nginx yaml file
cd /etc/newrelic-infra/integrations.d
sudo cp nginx-config.yml.sample nginx-config.yml
nano nginx-config.yml
# Name of Nginx status module OHI is to query against. discover | ngx_http_stub_status_module | ngx_http_status_module | ngx_http_api_module
#status_module: discover
status_module: ngx_http_stub_status_module
#status_module: discover
status_module: ngx_http_stub_status_module
nginx open source ngx_http_stub_status_module is the default
Change status url from
– name: nginx-server-metrics
command: metrics
arguments:
# If you’re using ngx_http_api_module be certain to use the full path up to and including the version number
status_url: http://127.0.0.1/status# Name of Nginx status module OHI is to query against. discover | ngx_http_stub_status_module | ngx_http_status_module | ngx_http_api_module
#status_module: discover
status_module: ngx_http_stub_status_module
command: metrics
arguments:
# If you’re using ngx_http_api_module be certain to use the full path up to and including the version number
status_url: http://127.0.0.1/status# Name of Nginx status module OHI is to query against. discover | ngx_http_stub_status_module | ngx_http_status_module | ngx_http_api_module
#status_module: discover
status_module: ngx_http_stub_status_module
to http://127.0.0.1/nginx_status/
– name: nginx-server-inventory
command: inventory captures the configuration parameters set in the NGINX config file
arguments:
config_path: /etc/nginx/nginx.conf
command: inventory captures the configuration parameters set in the NGINX config file
arguments:
config_path: /etc/nginx/nginx.conf
# status_url is used to identify the monitored entity to which the inventory will be attached.
status_url: http://127.0.0.1/status
status_url: http://127.0.0.1/status
to http://127.0.0.1/nginx_status/
Restart new relic agent
systemctl restart newrelic-infra
Check the nginx dashboard on newrelic
infrastructure >> third party services >> integrations >> nginx Dashboard
Requests per second
Active Connections
Requests per second, by server
Connections Accepted per second
Connections Dropped per second
Nginx Inventory
No inventory match your current search and filter selection.
Read more at monitoring nginx with newrelic
Errors and troubleshooting
prefix=integration/com.newrelic.nginx stderr=”[FATAL] can’t continue: Line 0 of status doesn’t match\n” working-
you misconfigured nginx status page with php – fpm status page.