Skip to content

Commit f59bc21

Browse files
authored
Merge pull request #18 from vitiwari/master
Pull Request for issue PLUG-170
2 parents ae705b7 + 7dc2fef commit f59bc21

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

init.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ local PollerCollection = framework.PollerCollection
2222
local isHttpSuccess = framework.util.isHttpSuccess
2323
local ipack = framework.util.ipack
2424
local parseJson = framework.util.parseJson
25+
local notEmpty = framework.string.notEmpty
2526

2627
--Getting the parameters from params.json.
2728
local 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
4141
end
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
@@ -160,7 +160,7 @@ end
160160
local 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

Comments
 (0)