2015-01-16 22:46:42 +00:00
|
|
|
-- Copyright 2008 Freifunk Leipzig / Jo-Philipp Wich <jow@openwrt.org>
|
2015-01-16 22:38:38 +00:00
|
|
|
-- Licensed to the public under the Apache License 2.0.
|
2008-06-03 23:15:16 +00:00
|
|
|
|
2011-11-28 03:26:59 +00:00
|
|
|
module("luci.statistics.rrdtool.definitions.df", package.seeall)
|
2008-05-30 00:26:18 +00:00
|
|
|
|
2019-03-07 13:50:17 +00:00
|
|
|
function item()
|
|
|
|
return luci.i18n.translate("Disk Space Usage")
|
|
|
|
end
|
|
|
|
|
2008-05-30 00:26:18 +00:00
|
|
|
function rrdargs( graph, plugin, plugin_instance, dtype )
|
|
|
|
|
2019-03-07 09:26:12 +00:00
|
|
|
local df_complex = {
|
2016-08-10 20:09:32 +00:00
|
|
|
title = "%H: Disk space usage on %pi",
|
2011-11-28 03:26:59 +00:00
|
|
|
vlabel = "Bytes",
|
|
|
|
number_format = "%5.1lf%sB",
|
2008-05-30 00:26:18 +00:00
|
|
|
|
|
|
|
data = {
|
2016-03-25 08:04:58 +00:00
|
|
|
instances = {
|
|
|
|
df_complex = { "free", "used", "reserved" }
|
2008-05-30 00:26:18 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
options = {
|
2016-03-25 08:04:58 +00:00
|
|
|
df_complex_free = {
|
2011-11-28 03:26:59 +00:00
|
|
|
color = "00ff00",
|
|
|
|
overlay = false,
|
|
|
|
title = "free"
|
2008-05-30 00:26:18 +00:00
|
|
|
},
|
|
|
|
|
2016-03-25 08:04:58 +00:00
|
|
|
df_complex_used = {
|
2008-05-30 00:26:18 +00:00
|
|
|
color = "ff0000",
|
2011-11-28 03:26:59 +00:00
|
|
|
overlay = false,
|
|
|
|
title = "used"
|
2016-03-25 08:04:58 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
df_complex_reserved = {
|
|
|
|
color = "0000ff",
|
|
|
|
overlay = false,
|
|
|
|
title = "reserved"
|
2008-05-30 00:26:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-03-07 09:26:12 +00:00
|
|
|
|
|
|
|
local percent_bytes = {
|
|
|
|
title = "%H: Disk space usage on %pi",
|
|
|
|
vlabel = "Percent",
|
|
|
|
number_format = "%5.2lf %%",
|
|
|
|
|
|
|
|
data = {
|
|
|
|
instances = {
|
|
|
|
percent_bytes = { "free", "used", "reserved" }
|
|
|
|
},
|
|
|
|
|
|
|
|
options = {
|
|
|
|
percent_bytes_free = {
|
|
|
|
color = "00ff00",
|
|
|
|
overlay = false,
|
|
|
|
title = "free"
|
|
|
|
},
|
|
|
|
|
|
|
|
percent_bytes_used = {
|
|
|
|
color = "ff0000",
|
|
|
|
overlay = false,
|
|
|
|
title = "used"
|
|
|
|
},
|
|
|
|
|
|
|
|
percent_bytes_reserved = {
|
|
|
|
color = "0000ff",
|
|
|
|
overlay = false,
|
|
|
|
title = "reserved"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
local types = graph.tree:data_types( plugin, plugin_instance )
|
|
|
|
|
|
|
|
local p = {}
|
|
|
|
for _, t in ipairs(types) do
|
|
|
|
if t == "percent_bytes" then
|
|
|
|
p[#p+1] = percent_bytes
|
|
|
|
end
|
|
|
|
|
|
|
|
if t == "df_complex" then
|
|
|
|
p[#p+1] = df_complex
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
return p
|
2008-05-30 00:26:18 +00:00
|
|
|
end
|