mirror of
https://github.com/novatiq/packages.git
synced 2026-04-29 06:58:39 +01:00
prometheus-node-exporter-lua: close io.popen files to reap zombies
Signed-off-by: Leonid Evdokimov <leon@darkk.net.ru>
This commit is contained in:
+5
-1
@@ -1,12 +1,16 @@
|
||||
local uname_fd = io.popen("uname -m")
|
||||
|
||||
local labels = {
|
||||
domainname = "",
|
||||
nodename = "",
|
||||
release = string.sub(get_contents("/proc/sys/kernel/osrelease"), 1, -2),
|
||||
sysname = string.sub(get_contents("/proc/sys/kernel/ostype"), 1, -2),
|
||||
version = string.sub(get_contents("/proc/sys/kernel/version"), 1, -2),
|
||||
machine = string.sub(io.popen("uname -m"):read("*a"), 1, -2)
|
||||
machine = string.sub(uname_fd:read("*a"), 1, -2)
|
||||
}
|
||||
|
||||
uname_fd:close()
|
||||
|
||||
local function scrape()
|
||||
labels["domainname"] = string.sub(get_contents("/proc/sys/kernel/domainname"), 1, -2)
|
||||
labels["nodename"] = string.sub(get_contents("/proc/sys/kernel/hostname"), 1, -2)
|
||||
|
||||
Reference in New Issue
Block a user