"Fossies" - the Fresh Open Source Software Archive

Member "sysdig-0.26.1/userspace/sysdig/chisels/fdbytes_by.lua" (24 May 2019, 1522 Bytes) of package /linux/misc/sysdig-0.26.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Lua source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 --[[
    2 Copyright (C) 2013-2018 Draios Inc dba Sysdig.
    3 
    4 This file is part of sysdig.
    5 
    6 Licensed under the Apache License, Version 2.0 (the "License");
    7 you may not use this file except in compliance with the License.
    8 You may obtain a copy of the License at
    9 
   10     http://www.apache.org/licenses/LICENSE-2.0
   11 
   12 Unless required by applicable law or agreed to in writing, software
   13 distributed under the License is distributed on an "AS IS" BASIS,
   14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   15 See the License for the specific language governing permissions and
   16 limitations under the License.
   17 
   18 --]]
   19 
   20 -- Chisel description
   21 description = "Groups FD activity based on the given filter field, and returns the key that generated the most input+output bytes. For example, this script can be used to list the processes or TCP ports that generated most traffic."
   22 short_description = "I/O bytes, aggregated by an arbitrary filter field"
   23 category = "I/O"
   24 
   25 -- Chisel argument list
   26 args = 
   27 {
   28     {
   29         name = "key", 
   30         description = "The filter field used for grouping", 
   31         argtype = "string"
   32     },
   33 }
   34 
   35 -- The number of items to show
   36 TOP_NUMBER = 30
   37 key_fld = ""
   38 
   39 -- Argument notification callback
   40 function on_set_arg(name, val)
   41     if name == "key" then
   42         key_fld = val
   43         return true
   44     end
   45 
   46     return false
   47 end
   48 
   49 -- Initialization callback
   50 function on_init()
   51     chisel.exec("table_generator",
   52         key_fld,
   53         key_fld,
   54         "evt.rawarg.res",
   55         "Bytes",
   56         "evt.is_io=true and evt.failed=false", 
   57         "" .. TOP_NUMBER,
   58         "bytes")
   59     return true
   60 end