[ZBX-19901] templates/app/nginx_agent/ item/key nginx.version fails Created: 2021 Sep 01  Updated: 2022 Jun 15  Resolved: 2021 Sep 03

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Templates (T)
Affects Version/s: None
Fix Version/s: None

Type: Problem report Priority: Trivial
Reporter: jasper Assignee: Karlis Salins
Resolution: Won't fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Debian


Attachments: PNG File image-2021-09-01-15-06-09-200.png    

 Description   

Steps to reproduce:

  1. Add the template "Nginx by to Zabbix agent" to a linux host running nginx
  2. Navigate to screen title "items" on said host
  3. The item "Nginx: Version" is in failed state.

Result:

The item fails with:

Preprocessing failed for: HTTP/1.1 200 OK..Server: nginx..Date: Wed, 01 Sep 2021 14:59:55 GMT..Content-Type: text/plain..Co...
1. Failed: cannot perform regular expression "Server: nginx\/(.+(?<!\r))" match for value of type "string": pattern does not match

Also can be seen in Zabbix server logs:

2456147:20210901:150610.940 error reason for "worker02:nginx.connections.active" changed: Preprocessing failed for: HTTP/1.1 200 OK..Server: nginx..Date: Wed, 01 Sep 2021 15:06:10 GMT..Content-Type: text/html..Con...
1. Failed: cannot perform regular expression "Active connections: ([0-9]+)" match for value of type "string": pattern does not match

See screenshot attached:

Expected:
Nginx version number.

 

The nginx status stub page displays:

Active connections: 2 
server accepts handled requests
 39210 39210 14447 
Reading: 0 Writing: 1 Waiting: 1 

Like stated here http://nginx.org/en/docs/http/ngx_http_stub_status_module.html

I don't think there's actually a version number to be found so this might give the error. But since I'm pretty new to Zabbix this might not be the case.



 Comments   
Comment by Karlis Salins [ 2021 Sep 02 ]

Hello. Thank you for reporting this issues.

Which zabbix version are you using?

Best regards,
Karlis

Comment by jasper [ 2021 Sep 02 ]

Hi @ksalins,

Sorry I forgot to mention that. I'm using the latest 5.4.

Br,

Jasper

Comment by Karlis Salins [ 2021 Sep 03 ]

Hi, tried reproducing with no luck. Usually similar errors occur because the configuration lacks some parameters, an example of it can be found on Zabbix Official template page for Nginx by agent .

location = /basic_status {
    stub_status;
    allow 127.0.0.1;
    allow ::1;
    deny all;
}

Please try to set it up according to instructions found on the template page. Closing this issue for now, if you still think there are some bugs, feel free to reopen this issue!

Best regards,

Karlis

 

Comment by Oliver Kohll [ 2021 Oct 23 ]

Can we re-open this please? I have the issue too and I think I've found the reason.

My nginx has 'server_tokens off;' in the nginx.conf configuration, so is not reporting a version number.

If I change that to 'server_tokens on', then 

870:20211023:134324.886 item "webfront:nginx.version" became supported

appears in the Zabbix server log. However when it's off, I get

870:20211023:134224.841 error reason for "webfront:nginx.version" changed: Preprocessing failed for: HTTP/1.1 200 OK..Server: nginx..Date: Sat, 23 Oct 2021 12:42:24 GMT..Content-Type: text/plain..Co...
1. Failed: cannot perform regular expression "Server: nginx\/(.+(?<!\r))" match for value of type "string": pattern does not match

So it appears Zabbix can't cope with an nginx that doesn't show version numbers in HTTP requests.

Other nginx monitoring, like 'requests per second' continue to work.

Comment by Stratos Zolotas [ 2022 Jun 15 ]

I can confirm that Zabbix 6.0 with zabbix-agent2, needs 'server_tokens on' for version reporting to work. It should be added to the instructions at least.

Generated at Sun May 04 07:09:33 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.