@@ -22,6 +22,7 @@ local PollerCollection = framework.PollerCollection
2222local isHttpSuccess = framework .util .isHttpSuccess
2323local ipack = framework .util .ipack
2424local parseJson = framework .util .parseJson
25+ local notEmpty = framework .string .notEmpty
2526
2627-- Getting the parameters from params.json.
2728local params = framework .params
@@ -36,7 +37,6 @@ local function createOptions(item)
3637 options .host = item .host
3738 options .port = item .port
3839 options .wait_for_end = true
39-
4040 return options
4141end
4242
@@ -93,7 +93,7 @@ local function clusterStatsExtractor (data, item)
9393 local result = {}
9494 local metric = function (...) ipack (result , ... ) end
9595
96- local src = data .cluster_name
96+ local src = notEmpty ( item . source , data .cluster_name )
9797
9898 if data .status ~= nil then
9999 if data .status == ' green' then
160160local function clusterHealthExtractor (data , item )
161161 local result = {}
162162 local metric = function (...) ipack (result , ... ) end
163- local src = data .cluster_name
163+ local src = notEmpty ( item . source , data .cluster_name )
164164
165165
166166 metric (' ELASTIC_SEARCH_NO_OF_NODES' ,data .number_of_nodes ,nil ,src )
@@ -178,7 +178,7 @@ local function nodesStatsExtractor (data, item)
178178 local metric = function (...) ipack (result , ... ) end
179179
180180 for _ ,node in pairs (data .nodes ) do
181- local src = data .cluster_name .. " .Node-" .. node .name
181+ local src = notEmpty ( item . source , data .cluster_name ) .. " .Node-" .. node .name
182182 metric (' ELASTIC_SEARCH_JVM_UPTIME_IN_MILLIS' ,node .jvm .uptime_in_millis ,nil ,src )
183183 metric (' ELASTIC_SEARCH_JVM_MEM_HEAP_USED_PERCENT' ,(node .jvm .mem .heap_used_percent / 100 ),nil ,src )
184184 metric (' ELASTIC_SEARCH_PROCESS_OPEN_FILE_DESCRIPTORS' ,node .process .open_file_descriptors ,nil ,src )
0 commit comments