[ZBX-20968] Template App Apache by Zabbix agent - Preprocessing server version regex Created: 2022 Apr 26  Updated: 2024 Apr 10  Resolved: 2022 Nov 21

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Templates (T)
Affects Version/s: 6.0.4rc1, 6.2.0alpha2
Fix Version/s: None

Type: Problem report Priority: Major
Reporter: ethn84 Assignee: Aleksandre Sebiskveradze (Inactive)
Resolution: Won't fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Debian 11


Attachments: PNG File Capture d’écran 2022-04-26 à 16.26.36.png     PNG File Capture d’écran 2022-04-26 à 16.27.16.png     PNG File Screenshot 2022-06-07 at 17.53.35.png     PNG File Screenshot 2022-06-07 at 18.11.55.png     PNG File test-result.png     PNG File test-string.png    
Issue Links:
Sub-task
depends on ZBX-21344 Official Apache template gets Server ... Closed
depends on ZBX-21345 Official Apache template ServerVersio... Closed
Team: Team INT
Sprint: Support backlog

 Description   

Hi,

First issue, I don't really know how to contribute.

Steps to reproduce:

  1. Execute Apache: Get status item on host with mod_status enabled

Result:

  1. Get only "Apache" in ServerVersion field if there is a / in the server version (ex: Apache/2.4.53 (Debian) OpenSSL/1.1.1n)

Expected:

Solved by modifying preprocessing Javascript //Convert apache to JSON:

Line 12, change

var line = lines[i].match(/([A-z0-9 ]+): (.*)/);

by

var line = lines[i].match(/([A-z0-9 ]+): (.*$)/);

Thanks.



 Comments   
Comment by Eriks Sneiders [ 2022 Jun 06 ]

Would it be possible to get a full response from the server-status?auto.

Also Zabbix agent 2 debug log and the response of the 
zabbix_agent2 -t web.page.get[<ip_address>/server-status?auto]

As two possibilities come to mind either the response contains a different Server key and so the ServerVersion key is overwritten as per the JS logic from pre-processing. Or the other possibility is that if Zabbix is built from source the wrong libpcre is uses and the match does not work correctly.

Comment by ethn84 [ 2022 Aug 08 ]

Hi,

This is the response to server-status?auto (zabbix server):

{"ServerVersion":"Apache/2.4.54 (Debian) OpenSSL/1.1.1n","ServerMPM":"prefork","Server Built":"2022-06-09T04:26:43","CurrentTime":"Monday, 08-Aug-2022 15:49:39 CEST","RestartTime":"Monday, 08-Aug-2022 12:27:36 CEST","ParentServerConfigGeneration":1,"ParentServerMPMGeneration":0,"ServerUptimeSeconds":12122,"ServerUptime":"3 hours 22 minutes 2 seconds","Load1":0.08,"Load5":0.08,"Load15":0.12,"Total Accesses":2024,"Total kBytes":25602,"Total Duration":200900,"CPUUser":28.09,"CPUSystem":12.44,"CPUChildrenUser":17.29,"CPUChildrenSystem":7.67,"CPULoad":0.540257,"Uptime":12122,"ReqPerSec":0.166969,"BytesPerSec":2162.72,"BytesPerReq":12952.8,"DurationPerReq":99.2589,"BusyWorkers":2,"IdleWorkers":8,"Scoreboard":"_W_W.______...........................................................................................................................................","CacheType":"SHMCB","CacheSharedMemory":512000,"CacheCurrentEntries":32,"CacheSubcaches":32,"CacheIndexesPerSubcaches":88,"CacheTimeLeftOldestAvg":123,"CacheTimeLeftOldestMin":6,"CacheTimeLeftOldestMax":294,"CacheIndexUsage":"1%","CacheUsage":"1%","CacheStoreCount":1039,"CacheReplaceCount":0,"CacheExpireCount":1002,"CacheDiscardCount":0,"CacheRetrieveHitCount":0,"CacheRetrieveMissCount":0,"CacheRemoveHitCount":6,"CacheRemoveMissCount":0,"Workers":{"waiting":8,"starting":0,"reading":0,"sending":2,"keepalive":0,"dnslookup":0,"closing":0,"logging":0,"finishing":0,"cleanup":0,"slot":140}}

Response to direct request on host:

zabbix_agent2 -t web.page.gethttps://127.0.0.1/server-status?auto
web.page.gethttps://127.0.0.1/server-status?auto[s|HTTP/1.1 200 OK
Connection: close
Content-Type: text/plain; charset=ISO-8859-1
Date: Mon, 08 Aug 2022 13:40:25 GMT
Server: Apache/2.4.54 (Debian)
Vary: Accept-Encoding127.0.0.1

ServerVersion: Apache/2.4.54 (Debian) OpenSSL/1.1.1n
ServerMPM: prefork
Server Built: 2022-06-09T04:26:43
CurrentTime: Monday, 08-Aug-2022 15:40:25 CEST
RestartTime: Monday, 08-Aug-2022 12:27:36 CEST
ParentServerConfigGeneration: 1
ParentServerMPMGeneration: 0
ServerUptimeSeconds: 11568
ServerUptime: 3 hours 12 minutes 48 seconds
Load1: 0.26
Load5: 0.20
Load15: 0.18
Total Accesses: 1805
Total kBytes: 24234
Total Duration: 186468
CPUUser: 24.75
CPUSystem: 10.95
CPUChildrenUser: 17.29
CPUChildrenSystem: 7.67
CPULoad: .524378
Uptime: 11568
ReqPerSec: .156034
BytesPerSec: 2145.2
BytesPerReq: 13748.3
DurationPerReq: 103.306
BusyWorkers: 2
IdleWorkers: 8
Scoreboard: {}W.{}K{}...........................................................................................................................................
TLSSessionCacheStatus
CacheType: SHMCB
CacheSharedMemory: 512000
CacheCurrentEntries: 32
CacheSubcaches: 32
CacheIndexesPerSubcaches: 88
CacheTimeLeftOldestAvg: 119
CacheTimeLeftOldestMin: 1
CacheTimeLeftOldestMax: 293
CacheIndexUsage: 1%
CacheUsage: 1%
CacheStoreCount: 977
CacheReplaceCount: 0
CacheExpireCount: 943
CacheDiscardCount: 0
CacheRetrieveHitCount: 0
CacheRetrieveMissCount: 0
CacheRemoveHitCount: 2
CacheRemoveMissCount: 0]

Log in debug mode:

2022/08/08 15:46:22.369591 executed direct exporter task for key 'web.page.get["http://127.0.0.1:80/server-status?auto"]'
2022/08/08 15:46:22.369758 sending passive check response: 'HTTP/1.1 200 OK
Connection: close
Content-Type: text/plain; charset=ISO-8859-1
Date: Mon, 08 Aug 2022 13:46:22 GMT
Server: Apache/2.4.54 (Debian)
Vary: Accept-Encoding

127.0.0.1
ServerVersion: Apache/2.4.54 (Debian) OpenSSL/1.1.1n
ServerMPM: prefork
Server Built: 2022-06-09T04:26:43
CurrentTime: Monday, 08-Aug-2022 15:46:22 CEST
RestartTime: Monday, 08-Aug-2022 12:27:36 CEST
ParentServerConfigGeneration: 1
ParentServerMPMGeneration: 0
ServerUptimeSeconds: 11925
ServerUptime: 3 hours 18 minutes 45 seconds
Load1: 0.02
Load5: 0.11
Load15: 0.15
Total Accesses: 1916
Total kBytes: 24910
Total Duration: 193186
CPUUser: 26.38
CPUSystem: 11.73
CPUChildrenUser: 17.29
CPUChildrenSystem: 7.67
CPULoad: .528889
Uptime: 11925
ReqPerSec: .160671
BytesPerSec: 2139.02
BytesPerReq: 13313.1
DurationPerReq: 100.828
BusyWorkers: 2
IdleWorkers: 8
Scoreboard: W_{}.{}{}K{_}...........................................................................................................................................
TLSSessionCacheStatus
CacheType: SHMCB
CacheSharedMemory: 512000
CacheCurrentEntries: 33
CacheSubcaches: 32
CacheIndexesPerSubcaches: 88
CacheTimeLeftOldestAvg: 111
CacheTimeLeftOldestMin: 1
CacheTimeLeftOldestMax: 229
CacheIndexUsage: 1%
CacheUsage: 1%
CacheStoreCount: 1016
CacheReplaceCount: 0
CacheExpireCount: 981
CacheDiscardCount: 0
CacheRetrieveHitCount: 0
CacheRetrieveMissCount: 0
CacheRemoveHitCount: 2
CacheRemoveMissCount: 0' to '127.0.0.1'

Zabbix version (installed from official repos):

$ zabbix_server --version
zabbix_server (Zabbix) 5.0.26
Revision 1eb7c56219b 25 July 2022, compilation time: Jul 25 2022 09:48:21

Generated at Sat Dec 13 21:48:36 EET 2025 using Jira 10.3.13#10030013-sha1:56dd970ae30ebfeda3a697d25be1f6388b68a422.