Comparison

plugins/mod_admin_shell.lua @ 11991:bef2a59b00d1

mod_admin_shell: List periodic tasks in module:info
author Kim Alvefur <zash@zash.se>
date Mon, 22 Nov 2021 19:07:56 +0100
parent 11954:b963ac00c967
child 12012:71d799a8638f
comparison
equal deleted inserted replaced
11990:6f4790b8deec 11991:bef2a59b00d1
439 ["http-provider"] = "HTTP services", 439 ["http-provider"] = "HTTP services",
440 ["net-provider"] = "Network service", 440 ["net-provider"] = "Network service",
441 ["storage-provider"] = "Storage driver", 441 ["storage-provider"] = "Storage driver",
442 ["measure"] = "Legacy metrics", 442 ["measure"] = "Legacy metrics",
443 ["metric"] = "Metrics", 443 ["metric"] = "Metrics",
444 ["task"] = "Periodic task",
444 }; 445 };
445 local item_formatters = { 446 local item_formatters = {
446 ["feature"] = tostring, 447 ["feature"] = tostring,
447 ["identity"] = function(ident) return ident.type .. "/" .. ident.category; end, 448 ["identity"] = function(ident) return ident.type .. "/" .. ident.category; end,
448 ["adhoc-provider"] = item_name, 449 ["adhoc-provider"] = item_name,
452 ["net-provider"] = item_name, 453 ["net-provider"] = item_name,
453 ["measure"] = function(item) return item.name .. " (" .. suf(item.conf and item.conf.unit, " ") .. item.type .. ")"; end, 454 ["measure"] = function(item) return item.name .. " (" .. suf(item.conf and item.conf.unit, " ") .. item.type .. ")"; end,
454 ["metric"] = function(item) 455 ["metric"] = function(item)
455 return ("%s (%s%s)%s"):format(item.name, suf(item.mf.unit, " "), item.mf.type_, pre(": ", item.mf.description)); 456 return ("%s (%s%s)%s"):format(item.name, suf(item.mf.unit, " "), item.mf.type_, pre(": ", item.mf.description));
456 end, 457 end,
458 ["task"] = function (item) return string.format("%s (%s)", item.name or item.id, item.when); end
457 }; 459 };
458 460
459 for host in hosts do 461 for host in hosts do
460 local mod = modulemanager.get_module(host, name); 462 local mod = modulemanager.get_module(host, name);
461 if mod.module.host == "*" then 463 if mod.module.host == "*" then