[ZBX-9605] Item vfs.file.regexp[/etc/issue,"^(.*[0-9])(.*)$",,1,1,\1] returns error "Start line parameter must not exceed end line" on Ubuntu Trusty Created: 2015 May 31  Updated: 2017 May 30  Resolved: 2015 Jul 27

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Agent (G)
Affects Version/s: 2.4.5
Fix Version/s: 2.2.10rc1, 2.4.6rc1, 2.5.0

Type: Incident report Priority: Major
Reporter: Nicolas C. Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: regexps, ubuntu
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Zabbix Agent 2.4.5 (revision 53282) on Ubuntu Trusty 64-bits
Zabbix Server 2.4.5 (revision 53282) on Debian Wheezy 64-bits



 Description   

A Ubuntu Trusty server is monitored, it has a /etc/issue file containing the line "Ubuntu 14.04.2 LTS \n \l" followed by a blank line.

In Zabbix, an item of type "Zabbix agent" has been added to the "Linux" Template as follow :

vfs.file.regexp[/etc/issue,"^(.*[0-9])(.*)$",,1,1,\1]

It is supposed to return "Ubuntu 14.04.2".

The correct value is returned for agents running on Debian Squeeze/Wheezy/Jessie, Red Hat Enterprise Linux 5/6, Oracle Linux 6, CentOS 6, Ubuntu Precise.

However, for Ubuntu Trusty there's an error "Start line parameter must not exceed end line".



 Comments   
Comment by Nicolas C. [ 2015 May 31 ]

Please note that the asterisk characters were deleted in the description of the bug. They are correctly displayed on the title. The correct item is :

vfs.file.regexp[/etc/issue,"^(.*[0-9])(.*)$",,1,1,\1]

asaveljevs Fixed.

Comment by Oleksii Zagorskyi [ 2015 Jun 01 ]

Agent version 2.4.5 on Debian 8/testing.

# cat /tmp/a
Ubuntu 14.04.2 LTS

I used a bit simpler regexp, see below.
Right after agent start it does NOT work for 100% attempts.
After requesting the key but without start line vfs.file.regexp[/tmp/a,Ubuntu,,] - it started to work for all attempts or do not work at all.
But a bit later it starts to work/not work randomly, see manual execution with intervals ~ 1-2 seconds:

 zabbix_get -s localhost -k 'vfs.file.regexp[/tmp/a,Ubuntu,,1]'
Ubuntu 14.04.2 LTS

 zabbix_get -s localhost -k 'vfs.file.regexp[/tmp/a,Ubuntu,,1]'
ZBX_NOTSUPPORTED: Start line parameter must not exceed end line.

 zabbix_get -s localhost -k 'vfs.file.regexp[/tmp/a,Ubuntu,,1]'
Ubuntu 14.04.2 LTS

 zabbix_get -s localhost -k 'vfs.file.regexp[/tmp/a,Ubuntu,,1]'
Ubuntu 14.04.2 LTS

 zabbix_get -s localhost -k 'vfs.file.regexp[/tmp/a,Ubuntu,,1]'
ZBX_NOTSUPPORTED: Start line parameter must not exceed end line.

So randomly reproducible.

An interesting detail - when agents responds with the error, in debug log I can see next , note - without responces:

 32436:20150601:093807.960 Requested [vfs.file.regexp[/tmp/a,Ubuntu,,1]]
 32436:20150601:093807.961 listener #2 [waiting for connection]
 32435:20150601:093808.528 listener #1 [processing request]
 32435:20150601:093808.528 Requested [vfs.file.regexp[/tmp/a,Ubuntu,,1]]
 32435:20150601:093808.529 listener #1 [waiting for connection]

while on success we see a response:

 32437:20150601:093803.783 listener #3 [processing request]
 32437:20150601:093803.783 Requested [vfs.file.regexp[/tmp/a,Ubuntu,,]]
 32437:20150601:093803.783 Sending back [Ubuntu 14.04.2 LTS]
 32437:20150601:093803.783 listener #3 [waiting for connection]

I tried agents 2.4.3, 2.4.4, 2.4.5 and restarted them ~10 times and could not notice strong differences.
Sometimes one version works, sometimes doesn't, sometimes randomly (of course after success get w/o starting_line param).

Any zabbix server was not available for the agent.

Running ./zabbix_agentd -t 'vfs.file.regexp[/tmp/a,Ubuntu,,]' looks like always working successfully.

CONFIRMED

Comment by Glebs Ivanovskis (Inactive) [ 2015 Jul 08 ]

Fixed in development branch svn://svn.zabbix.com/branches/dev/ZBX-9605-22

In VFS_FILE_REGEXP() and VFS_FILE_REGMATCH() (src/libs/zbxsysinfo/common/file.c) start_line and end_line variables used to be of type size_t which is 64 bit. Since is_uint32() is used to initialize these variables only first 32 bits are initialized correctly. Remaining 32 bits may contain non-zero bits which sometimes may lead to start_line > end_line and corresponding error message.

Now start_line and end_line are uint32_t and are initialized correctly.

Comment by Igors Homjakovs (Inactive) [ 2015 Jul 09 ]

Successfully tested.

Comment by Aleksandrs Saveljevs [ 2015 Jul 14 ]

Fixed in pre-2.2.10 r54391, pre-2.4.6 r54392, pre-2.5.0 (trunk) r54393.

Generated at Wed Apr 17 02:18:33 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.