add config option for instance name
This is needed if you have multiple instances of this package running side-by-side
This commit is contained in:
parent
3d9b6da706
commit
5af7fe2340
2 changed files with 15 additions and 2 deletions
|
@ -58,6 +58,13 @@
|
|||
[30, "30px"],
|
||||
[40, "40px"]
|
||||
]
|
||||
}, {
|
||||
"title": "instance name",
|
||||
"ui_width": 12,
|
||||
"name": "instance_name",
|
||||
"type": "string",
|
||||
"default": "icinga2",
|
||||
"hint": "Something to describe the displayed output, will be shown next to the update datum"
|
||||
}, {
|
||||
"title": "Connection to icinga2",
|
||||
"type": "section"
|
||||
|
|
10
node.lua
10
node.lua
|
@ -45,12 +45,18 @@ function node.render()
|
|||
end
|
||||
end
|
||||
|
||||
local time_width = CONFIG.font:width(services.prettytime, CONFIG.output_size)
|
||||
if CONFIG.instance_name ~= "" then
|
||||
titlebar = CONFIG.instance_name .. " - " .. services.prettytime
|
||||
else
|
||||
titlebar = servics.prettytime
|
||||
end
|
||||
|
||||
local title_width = CONFIG.font:width(titlebar, CONFIG.output_size)
|
||||
local host_width = 0
|
||||
|
||||
transform()
|
||||
CONFIG.background_color.clear()
|
||||
CONFIG.font:write(real_width/2-time_width/2, CONFIG.output_size*0.5, services.prettytime, CONFIG.output_size, 1,1,1,1)
|
||||
CONFIG.font:write(real_width/2-title_width/2, CONFIG.output_size*0.5, titlebar, CONFIG.output_size, 1,1,1,1)
|
||||
|
||||
for idx, service in ipairs(services.services) do
|
||||
host_width = math.max(host_width, CONFIG.font:width(service.host, CONFIG.header_size))
|
||||
|
|
Loading…
Reference in a new issue