# Nginx can't get metrix

**URL:** <https://discuss.elastic.co/t/nginx-cant-get-metrix/121611>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [February 27, 2018, 8:35am UTC](https://discuss.elastic.co/t/nginx-cant-get-metrix/121611 "2018-02-27T08:35:11Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andre\_Vert](https://avatars.discourse-cdn.com/v4/letter/a/cab0a1/32.png) [@Andre\_Vert](https://discuss.elastic.co/u/Andre_Vert)\
**Post date:** [February 27, 2018, 8:35am UTC](https://discuss.elastic.co/t/nginx-cant-get-metrix/121611/1 "2018-02-27T08:35:11Z")

</div>

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é

---

<div class="post-metadata">

**Author:** ![ruflin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ruflin/32/3116_2.png) [@ruflin](https://discuss.elastic.co/u/ruflin)\
**Post date:** [February 28, 2018, 7:58am UTC](https://discuss.elastic.co/t/nginx-cant-get-metrix/121611/2 "2018-02-28T07:58:47Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Andre\_Vert](https://avatars.discourse-cdn.com/v4/letter/a/cab0a1/32.png) [@Andre\_Vert](https://discuss.elastic.co/u/Andre_Vert)\
**Post date:** [February 28, 2018, 3:21pm UTC](https://discuss.elastic.co/t/nginx-cant-get-metrix/121611/3 "2018-02-28T15:21:51Z")

</div>

Fetched it with wget

---

<div class="post-metadata">

**Author:** ![ruflin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ruflin/32/3116_2.png) [@ruflin](https://discuss.elastic.co/u/ruflin)\
**Post date:** [March 2, 2018, 2:04am UTC](https://discuss.elastic.co/t/nginx-cant-get-metrix/121611/4 "2018-03-02T02:04:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Andre\_Vert](https://avatars.discourse-cdn.com/v4/letter/a/cab0a1/32.png) [@Andre\_Vert](https://discuss.elastic.co/u/Andre_Vert)\
**Post date:** [March 2, 2018, 7:56am UTC](https://discuss.elastic.co/t/nginx-cant-get-metrix/121611/5 "2018-03-02T07:56:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ruflin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ruflin/32/3116_2.png) [@ruflin](https://discuss.elastic.co/u/ruflin)\
**Post date:** [March 6, 2018, 5:32am UTC](https://discuss.elastic.co/t/nginx-cant-get-metrix/121611/6 "2018-03-06T05:32:53Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![agathver](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/agathver/32/27733_2.png) [@agathver](https://discuss.elastic.co/u/agathver)\
**Post date:** [March 26, 2018, 9:48am UTC](https://discuss.elastic.co/t/nginx-cant-get-metrix/121611/7 "2018-03-26T09:48:00Z")

</div>

> [@Andre\_Vert](#):
>
> include fastcgi\_params;  
> fastcgi\_pass unix:/var/run/php/php7.1-fpm.sock;

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

```auto
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;
    }

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 23, 2018, 9:48am UTC](https://discuss.elastic.co/t/nginx-cant-get-metrix/121611/8 "2018-04-23T09:48:23Z")

</div>

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