X-Git-Url: http://git.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=applications%2Fluci-statistics%2Fluasrc%2Fstatistics%2Frrdtool%2Fdefinitions%2Fnetlink.lua;h=9313952518e16ebd4c5798ac9cfbfa5e0b7b30ce;hp=3960b9c537edaa39bbf43ebcc192ca81c5ed8e1b;hb=e046455389f1030accf1341a6d75992c9b0a9447;hpb=3f09d369d679d3e4413849cf67f757c647a66965 diff --git a/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/netlink.lua b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/netlink.lua index 3960b9c537..9313952518 100644 --- a/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/netlink.lua +++ b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/netlink.lua @@ -1,180 +1,203 @@ -module("luci.statistics.rrdtool.definitions.netlink", package.seeall) +--[[ -function rrdargs( graph, host, plugin, plugin_instance ) +Luci statistics - netlink plugin diagram definition +(c) 2008 Freifunk Leipzig / Jo-Philipp Wich - local diagram_list = { } +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at - -- diagram names - local dtypes_names = { - "Verkehr", - "Pakete", - "Multicast-Pakete", - "Paketkollisionen", - "Paketfehler", - "RX-Fehler", - "TX-Fehler" - } + http://www.apache.org/licenses/LICENSE-2.0 + +$Id$ - -- diagram units - local dtypes_units = { - "Bytes/s", - "Pakete/s", - "Pakete/s", - "Kollisionen/s", - "Fehler/s", -- (?) - "Fehler/s", - "Fehler/s" +]]-- + +module("luci.statistics.rrdtool.definitions.netlink", package.seeall) + +function rrdargs( graph, plugin, plugin_instance ) + + -- + -- traffic diagram + -- + local traffic = { + title = "%H: Netlink - Transfer on %pi", + vlabel = "Bytes/s", + + -- diagram data description + data = { + -- defined sources for data types, if ommitted assume a single DS named "value" (optional) + sources = { + if_octets = { "tx", "rx" } + }, + + -- special options for single data lines + options = { + if_octets__tx = { + total = true, -- report total amount of bytes + color = "00ff00" -- tx is green + }, + + if_octets__rx = { + flip = true, -- flip rx line + total = true, -- report total amount of bytes + color = "0000ff" -- rx is blue + } + } + } } - -- data source overrides - local dtypes_sources = { - if_errors = { "tx", "rx" }, -- if_errors has tx and rx - if_octets = { "tx", "rx" }, -- if_octets has tx and rx - if_packets = { "tx", "rx" }, -- if_packets has tx and rx - if_dropped = { "tx", "rx" }, -- if_dopped has tx and rx + + -- + -- packet diagram + -- + local packets = { + title = "%H: Netlink - Packets on %pi", + vlabel = "Packets/s", detail = true, + + -- diagram data description + data = { + -- data type order + types = { "if_packets", "if_dropped", "if_errors" }, + + -- defined sources for data types + sources = { + if_packets = { "tx", "rx" }, + if_dropped = { "tx", "rx" }, + if_errors = { "tx", "rx" } + }, + + -- special options for single data lines + options = { + -- processed packets (tx DS) + if_packets__tx = { + overlay = true, -- don't summarize + total = true, -- report total amount of bytes + color = "00ff00" -- processed tx is green + }, + + -- processed packets (rx DS) + if_packets__rx = { + overlay = true, -- don't summarize + flip = true, -- flip rx line + total = true, -- report total amount of bytes + color = "0000ff" -- processed rx is blue + }, + + -- dropped packets (tx DS) + if_dropped__tx = { + overlay = true, -- don't summarize + total = true, -- report total amount of bytes + color = "660055" -- dropped tx is ... dunno ;) + }, + + -- dropped packets (rx DS) + if_dropped__rx = { + overlay = true, -- don't summarize + flip = true, -- flip rx line + total = true, -- report total amount of bytes + color = "440066" -- dropped rx is violett + }, + + -- packet errors (tx DS) + if_errors__tx = { + overlay = true, -- don't summarize + total = true, -- report total amount of packets + color = "ff5500" -- tx errors are orange + }, + + -- packet errors (rx DS) + if_errors__rx = { + overlay = true, -- don't summarize + flip = true, -- flip rx line + total = true, -- report total amount of packets + color = "ff0000" -- rx errors are red + } + } + } } - -- diagram data types - local dtypes_list = { - - -- diagram 1: interface traffic statistics - { - if_octets = { "" } -- bytes/s - }, - - -- diagram 2: combined interface packet statistics - { - if_dropped = { "" }, -- packets/s - if_packets = { "" } -- packets/s - }, - - -- diagram 3: multicast count - { - if_multicast = { "" } -- packets/s - }, - - -- diagram 4: interface collision statistics - { - if_collisions = { "" } -- collisions/s - }, - - -- diagram 5: interface error statistics - { - if_errors = { "" } -- errors/s (?) - }, - - -- diagram 6: interface rx error statistics - { - if_rx_errors = { -- errors/s - "length", "missed", "over", "crc", "fifo", "frame" + + -- + -- multicast diagram + -- + local multicast = { + title = "%H: Netlink - Multicast on %pi", + vlabel = "Packets/s", detail = true, + + -- diagram data description + data = { + -- data type order + types = { "if_multicast" }, + + -- special options for single data lines + options = { + -- multicast packets + if_multicast = { + total = true, -- report total amount of packets + color = "0000ff" -- multicast is blue + } } - }, + } + } + - -- diagram 7: interface tx error statistics - { - if_tx_errors = { -- errors/s - "aborted", "carrier", "fifo", "heartbeat", "window" + -- + -- collision diagram + -- + local collisions = { + title = "%H: Netlink - Collisions on %pi", + vlabel = "Collisions/s", detail = true, + + -- diagram data description + data = { + -- data type order + types = { "if_collisions" }, + + -- special options for single data lines + options = { + -- collision rate + if_collisions = { + total = true, -- report total amount of packets + color = "ff0000" -- collsions are red + } } } } - -- diagram colors - local dtypes_colors = { - - -- diagram 1 - { - if_octets__tx_ = "00ff00", - if_octets__rx_ = "0000ff" - }, - - -- diagram 2 - { - if_dropped__tx_ = "ff0000", - if_dropped__rx_ = "ff5500", - if_packets__tx_ = "00ff00", - if_packets__rx_ = "0000ff" - }, - - -- diagram 3 - { - if_multicast = "0000ff" - }, - - -- diagram 4 - { - if_collisions = "ff0000" - }, - - -- diagram 5 - { - if_errors__tx_ = "ff0000", - if_errors__rx_ = "ff5500" - }, - - -- diagram 6 - { - length = "0000ff", - missed = "ff5500", - over = "ff0066", - crc = "ff0000", - fifo = "00ff00", - frame = "ffff00" - }, - - -- diagram 7 - { - aborted = "ff0000", - carrier = "ffff00", - fifo = "00ff00", - heartbeat = "0000ff", - window = "8800ff" + + -- + -- error diagram + -- + local errors = { + title = "%H: Netlink - Errors on %pi", + vlabel = "Errors/s", detail = true, + + -- diagram data description + data = { + -- data type order + types = { "if_tx_errors", "if_rx_errors" }, + + -- data type instances + instances = { + if_tx_errors = { "aborted", "carrier", "fifo", "heartbeat", "window" }, + if_rx_errors = { "length", "missed", "over", "crc", "fifo", "frame" } + }, + + -- special options for single data lines + options = { -- XXX: fixme (define colors...) + if_tx_errors = { + total = true + }, + + if_rx_errors = { + flip = true, + total = true + } + } } } - for i, name in ipairs(dtypes_names) do - - local dtypes = dtypes_list[i] - local opts = { } - - opts.sources = { } - opts.image = graph:mkpngpath( host, plugin, plugin_instance, "netlink" .. i ) - opts.title = host .. ": Netlink Statistiken - " .. name .. " auf " .. plugin_instance - opts.rrd = { "-v", dtypes_units[i] } - opts.colors = dtypes_colors[i] - - for dtype, dinstances in pairs(dtypes) do - for i, inst in ipairs(dinstances) do - - local name = inst - if name:len() == 0 then name = dtype end - - -- check for data source override - if dtypes_sources[dtype] then - - -- has override - for i, ds in ipairs(dtypes_sources[dtype]) do - table.insert( opts.sources, { - ds = ds, -- override - name = name .. " (" .. ds .. ")", - rrd = graph:mkrrdpath( host, plugin, plugin_instance, dtype, inst ), - flip = ( ds == "rx" ), - total = ( ds == "rx" or ds == "tx" ) - } ) - end - else - -- no override, assume single "value" data source - table.insert( opts.sources, { - name = name, - rrd = graph:mkrrdpath( host, plugin, plugin_instance, dtype, inst ), - total = ( name == "if_multicast" ) - } ) - end - end - end - - table.insert( diagram_list, opts ) - end - - return diagram_list + return { traffic, packets, multicast, collisions, errors } end