@@ -37,7 +37,6 @@ local function createOptions(item)
3737 options .host = item .host
3838 options .port = item .port
3939 options .wait_for_end = true
40- options .source = item .source -- @vitiwari source name
4140 return options
4241end
4342
@@ -90,11 +89,11 @@ local function createPollers(params)
9089 return pollers
9190end
9291
93- local function clusterStatsExtractor (data , item , source )
92+ local function clusterStatsExtractor (data , item )
9493 local result = {}
9594 local metric = function (...) ipack (result , ... ) end
9695
97- local src = notEmpty (source ,data .cluster_name )
96+ local src = notEmpty (item . source ,data .cluster_name )
9897
9998 if data .status ~= nil then
10099 if data .status == ' green' then
@@ -158,10 +157,10 @@ local function clusterStatsExtractor (data, item, source)
158157 return result
159158end
160159
161- local function clusterHealthExtractor (data , item , source )
160+ local function clusterHealthExtractor (data , item )
162161 local result = {}
163162 local metric = function (...) ipack (result , ... ) end
164- local src = notEmpty (source ,data .cluster_name )
163+ local src = notEmpty (item . source ,data .cluster_name )
165164
166165
167166 metric (' ELASTIC_SEARCH_NO_OF_NODES' ,data .number_of_nodes ,nil ,src )
@@ -174,12 +173,12 @@ local function clusterHealthExtractor (data, item,source)
174173 return result
175174end
176175
177- local function nodesStatsExtractor (data , item , source )
176+ local function nodesStatsExtractor (data , item )
178177 local result = {}
179178 local metric = function (...) ipack (result , ... ) end
180179
181180 for _ ,node in pairs (data .nodes ) do
182- local src = notEmpty (source ,data .cluster_name ) .. " .Node-" .. node .name
181+ local src = notEmpty (item . source ,data .cluster_name ) .. " .Node-" .. node .name
183182 metric (' ELASTIC_SEARCH_JVM_UPTIME_IN_MILLIS' ,node .jvm .uptime_in_millis ,nil ,src )
184183 metric (' ELASTIC_SEARCH_JVM_MEM_HEAP_USED_PERCENT' ,(node .jvm .mem .heap_used_percent / 100 ),nil ,src )
185184 metric (' ELASTIC_SEARCH_PROCESS_OPEN_FILE_DESCRIPTORS' ,node .process .open_file_descriptors ,nil ,src )
@@ -217,7 +216,7 @@ function plugin:onParseValues(data, extra)
217216
218217 local key , item = unpack (extra .info )
219218 local extractor = extractors_map [key ]
220- return extractor (data , item , extra . source )
219+ return extractor (data , item )
221220
222221end
223222
0 commit comments