LMacPhail / zabbix-history-influxdb

A loadable module for zabbix which will export history data to an InfluxDB repository.
GNU General Public License v2.0
44 stars 15 forks source link

Fix resolving of positional macros in item name in case of MySQL #15

Closed i-ky closed 2 years ago

i-ky commented 4 years ago

According to documentation:

SUBSTRINGINDEX(str,delim,count_)

Returns the substring from string str before count occurrences of the delimiter delim.

Therefore substring_index() is not equivalent to PostgreSQL's split_part(). To get similar behaviour Internet suggests suggests to "double wrap" string in substring_index():

mysql> SELECT SUBSTRING_INDEX(SUBSTRING_INDEX('www.mysql.com', '.', 2), '.', -1);
        -> 'mysql'

This is exactly what this PR does. Hopefully this resolves #13.

i-ky commented 2 years ago

@LMacPhail, could you please provide some feedback?

LMacPhail commented 2 years ago

Hi @i-ky , thanks so much for contributing! Apologies for the delayed response on my part. This looks great, happy to resolve.