Nginx can't get metrix

Hi, it's me again...

I'm running a virtual machine, that is reachable under 192.168.10.10 with an nginx server.

config for the status page:

location ~ ^/(status|ping)$ {
         stub_status on;
         allow all;
         access_log off;
         include fastcgi_params;
         fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
    }

it's reachable under the IP/status.

Module config:

- module: nginx
  metricsets: ["stubstatus"]
  period: 10s

  # Nginx hosts
  hosts: ["http://127.0.0.1"]

  # Path to server status. Default server-status
  server_status_path: "status"

Metrics as json

{"pool":"www","process manager":"dynamic","start time":1519719213,"start since":1986,"accepted conn":361,"listen queue":0,"max listen queue":0,"listen queue len":0,"idle processes":2,"active processes":1,"total processes":3,"max active processes":2,"max children reached":0,"slow requests":0}

error im Metricbeat:

{
  "_index": "metricbeat-6.2.2-2018.02.27",
  "_type": "doc",
  "_id": "xEBw1mEBtbW47Ws-JHNX",
  "_version": 1,
  "_score": null,
  "_source": {
    "@timestamp": "2018-02-27T08:45:28.044Z",
    "metricset": {
      "host": "127.0.0.1",
      "rtt": 1085,
      "name": "stubstatus",
      "module": "nginx"
    },
    "error": {
      "message": "cannot parse active connections from Nginx stub status"
    },
    "beat": {
      "name": "ubuntu",
      "hostname": "ubuntu",
      "version": "6.2.2"
    }
  },
  "fields": {
    "@timestamp": [
      "2018-02-27T08:45:28.044Z"
    ]
  },
  "sort": [
    1519721128044
  ]
}

I changed the server_status_path to status, as this is my page.
I already tried to change the nginx ip to 192.168.10.10 with and without the http.
All other metrics are sending data to elastic.
Can anyone help me?

Greetings

André

The metrics you posted as json above, are these the ones that are exposed by the endpoint? If yes, did you fetch them with curl or similar?

Fetched it with wget

From the same machine where metricbeat is running or where nginx is running? Could you post the exact wget command you used?

wget http://127.0.0.1/status?json=true.
Metricbeat and nginx are runnung on the same machine.

Could you try server_status_path: "/status" instead of server_status_path: "status"?

Your NGINX is configured incorrectly. You are sending php-fpm status where you expect NGINX status. Remove those quoted lines, your config should work.

Here is a snipped that I use in production, with php-fpm

location /server-status {
        stub_status on;
        # access_log off;
        # allow 127.0.0.1;
        # deny all;
    }

# PHP-fmp status for use with php-fpm module
    location ~ ^/(status|ping) {
        # access_log off;
        # allow 127.0.0.1;
        # deny all;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
    }

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.