Mercurial > prosody-modules
comparison mod_munin/mod_munin.lua @ 1676:accbf0db0246
mod_munin: Exclude ignored stats even if they happen to be included in data
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Thu, 23 Apr 2015 16:58:57 +0200 |
| parents | 648ce9087902 |
| children | 44ddec97ad82 |
comparison
equal
deleted
inserted
replaced
| 1675:116488cced16 | 1676:accbf0db0246 |
|---|---|
| 56 if not stat then conn:write("# Unknown service\n.\n"); return end | 56 if not stat then conn:write("# Unknown service\n.\n"); return end |
| 57 for _, _, k, value in meta:iter(stat, "", nil) do | 57 for _, _, k, value in meta:iter(stat, "", nil) do |
| 58 conn:write(s_format("%s %s\n", k, value)); | 58 conn:write(s_format("%s %s\n", k, value)); |
| 59 end | 59 end |
| 60 for _, name, k, value in meta:iter(stat, nil, nil) do | 60 for _, name, k, value in meta:iter(stat, nil, nil) do |
| 61 if name ~= "" then | 61 if name ~= "" and not ignore_stats:contains(name) then |
| 62 conn:write(s_format("%s.%s %s\n", name, k, value)); | 62 conn:write(s_format("%s.%s %s\n", name, k, value)); |
| 63 end | 63 end |
| 64 end | 64 end |
| 65 conn:write(".\n"); | 65 conn:write(".\n"); |
| 66 end | 66 end |
| 67 | 67 |
| 68 function munin_commands.fetch(conn, line) | 68 function munin_commands.fetch(conn, line) |
| 69 local stat = line:match("%s(%S+)"); | 69 local stat = line:match("%s(%S+)"); |
| 70 if not stat then conn:write("# Unknown service\n.\n"); return end | 70 if not stat then conn:write("# Unknown service\n.\n"); return end |
| 71 for _, name, value in data:iter(stat, nil) do | 71 for _, name, value in data:iter(stat, nil) do |
| 72 conn:write(s_format("%s.value %s\n", name, tostring(value))); | 72 if not ignore_stats:contains(name) then |
| 73 conn:write(s_format("%s.value %s\n", name, tostring(value))); | |
| 74 end | |
| 73 end | 75 end |
| 74 conn:write(".\n"); | 76 conn:write(".\n"); |
| 75 end | 77 end |
| 76 | 78 |
| 77 function munin_commands.quit(conn) | 79 function munin_commands.quit(conn) |
