net: add operational state support
This commit is contained in:
parent
8674c919d6
commit
d91266357a
14
README
14
README
|
@ -167,8 +167,8 @@ vicious.widgets.fs
|
||||||
|
|
||||||
vicious.widgets.dio
|
vicious.widgets.dio
|
||||||
- provides I/O statistics for requested storage devices
|
- provides I/O statistics for requested storage devices
|
||||||
- takes the disk as an argument, i.e. "sda" (or specific partition,
|
- takes the disk as an argument, i.e. "sda" (or a specific
|
||||||
i.e. "sda/sda5")
|
partition, i.e. "sda/sda2")
|
||||||
- returns a table with string keys: {total_s}, {total_kb}, {total_mb},
|
- returns a table with string keys: {total_s}, {total_kb}, {total_mb},
|
||||||
{read_s}, {read_kb}, {read_mb}, {write_s}, {write_kb}, {write_mb}
|
{read_s}, {read_kb}, {read_mb}, {write_s}, {write_kb}, {write_mb}
|
||||||
and {sched}
|
and {sched}
|
||||||
|
@ -187,12 +187,12 @@ vicious.widgets.hddtemp
|
||||||
{/dev/sda} and {/dev/sdc} for example
|
{/dev/sda} and {/dev/sdc} for example
|
||||||
|
|
||||||
vicious.widgets.net
|
vicious.widgets.net
|
||||||
- provides usage statistics for all network interfaces
|
- provides state and usage statistics of all network interfaces
|
||||||
- returns a table with string keys, using net interfaces as a base:
|
- returns a table with string keys, using net interfaces as a base:
|
||||||
{eth0 rx_b}, {eth0 tx_b}, {eth0 rx_kb}, {eth0 tx_kb}, {eth0 rx_mb},
|
{eth0 carrier}, {eth0 rx_b}, {eth0 tx_b}, {eth0 rx_kb}, {eth0 tx_kb},
|
||||||
{eth0 tx_mb}, {eth0 rx_gb}, {eth0 tx_gb}, {eth0 down_b}, {eth0 up_b},
|
{eth0 rx_mb}, {eth0 tx_mb}, {eth0 rx_gb}, {eth0 tx_gb}, {eth0 down_b},
|
||||||
{eth0 down_kb}, {eth0 up_kb}, {eth0 down_mb}, {eth0 up_mb},
|
{eth0 up_b}, {eth0 down_kb}, {eth0 up_kb}, {eth0 down_mb},
|
||||||
{eth0 down_gb}, {eth0 up_gb}, {eth1 rx_b} etc.
|
{eth0 up_mb}, {eth0 down_gb}, {eth0 up_gb}, {eth1 rx_b} etc.
|
||||||
|
|
||||||
vicious.widgets.wifi
|
vicious.widgets.wifi
|
||||||
- provides wireless information for a requested interface
|
- provides wireless information for a requested interface
|
||||||
|
|
1
TODO
1
TODO
|
@ -5,7 +5,6 @@
|
||||||
|
|
||||||
|
|
||||||
* Vicious
|
* Vicious
|
||||||
** TODO Import NET carrier detection from contrib
|
|
||||||
** TODO Consider including this code in format helper
|
** TODO Consider including this code in format helper
|
||||||
- return format and format:gsub("${[^}]+}", "")
|
- return format and format:gsub("${[^}]+}", "")
|
||||||
- Note: We should then also replace just $1/$2...
|
- Note: We should then also replace just $1/$2...
|
||||||
|
|
|
@ -14,7 +14,7 @@ local helpers = require("vicious.helpers")
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
|
|
||||||
-- Net: provides usage statistics for all network interfaces
|
-- Net: provides state and usage statistics of all network interfaces
|
||||||
module("vicious.widgets.net")
|
module("vicious.widgets.net")
|
||||||
|
|
||||||
|
|
||||||
|
@ -43,6 +43,10 @@ local function worker(format)
|
||||||
helpers.uformat(args, name .. " rx", recv, unit)
|
helpers.uformat(args, name .. " rx", recv, unit)
|
||||||
helpers.uformat(args, name .. " tx", send, unit)
|
helpers.uformat(args, name .. " tx", send, unit)
|
||||||
|
|
||||||
|
-- Operational state and carrier detection
|
||||||
|
local sysnet = helpers.pathtotable("/sys/class/net/" .. name)
|
||||||
|
args["{"..name.." carrier}"] = tonumber(sysnet.carrier) or 0
|
||||||
|
|
||||||
if nets[name] == nil then
|
if nets[name] == nil then
|
||||||
-- Default values on the first run
|
-- Default values on the first run
|
||||||
nets[name] = {}
|
nets[name] = {}
|
||||||
|
|
Loading…
Reference in New Issue