#647 mod_statistics top unpractical and broken

Reporter Ge0rG
Owner Nobody
Created
Updated
Stars ★★ (2)
Tags
  • Status-New
  • Priority-Medium
  • Type-Defect
  • Component-Community
  1. Ge0rG on

    When running `prosodyctl mod_statistics top` on the command line, the admin expects a live view of the most-active JIDs, possibly with a way to sort by incoming/outgoing stanzas/packets. However, the current view is defective in multiple ways: 1. JIDs containing non-ASCII characters disturb the alignment of the columns and leave artifacts after screen updates. 2. The session lines contain the data of one second of activity, but remain on screen for 60 seconds. That makes comparing activity and finding flooders impossible, which is the #1 use case for the tool. (No, making updated records bold doesn't help) 3. S2S links often (always?) show up as two distinct entries for in and out, cluttering the interface. What I (as a service operator) would wish for is: 1. Allow switching the counter values between "total", "last hour", "last minute", "last second" (or something comparable, to allow looking for short-term as well as long-term usage). I would also be okay with differently scaled moving-weighted-averages a la Linux loadavg, even though nobody quite understands what the latter means. 2. Allow changing the sort order between "stanzas", "msg", "pres", "iq" and "bytes" as well as "in", "out" and "both". 3. Provide for a way to inspect the stanzas exchanged by a selected JID (either last-N or on-demand filters). 4. Implement a sortable tree view that allows collapsing and expanding elements as follows: domain --> user --> resource (SCNR). Thanks very much for considering these ideas.

  2. Zash on

    Changes
    • tags Component-Community
  3. Dan on

    after upgrading to prosody 0.11.1 `prosodyctl mod_statistics top` doesn't work anymore: Failed to execute command: Error: /usr/local/lib/prosody/modules/mod_statistics/stats.lib.lua:32: attempt to index global 'module' (a function value) stack traceback: /usr/local/lib/prosody/modules/mod_statistics/stats.lib.lua:32: in main chunk [C]: in function 'require' /usr/local/lib/prosody/modules/mod_statistics/top.lua:6: in main chunk [C]: in function 'require' .../local/lib/prosody/modules/mod_statistics/prosodytop.lua:7: in main chunk [C]: in function 'require' ...al/lib/prosody/modules/mod_statistics/mod_statistics.lua:134: in function <...al/lib/prosody/modules/mod_statistics/mod_statistics.lua:129> [C]: in function 'xpcall' /usr/lib/prosody/core/modulemanager.lua:320: in function 'call_module_method' /usr/bin/prosodyctl:1315: in function 'func' /usr/lib/prosody/util/async.lua:127: in function </usr/lib/prosody/util/async.lua:125>

  4. MattJ on

    Hi Dan, mod_statistics top was a prototype that will probably be replaced by something nicer in a future version of Prosody. As such, it isn't well maintained, and I wasn't aware anyone was actively using it! That said, I hopefully just pushed a fix for the issue you encountered. Hopefully it fixes the problem.

  5. Dan on

    HI Matt, thank you for giving the future perspective. I'm using it regularly! :-) And thank you for the fix. Unfortunately another error is thrown now: # prosodyctl mod_statistics top ...al/lib/prosody/modules/mod_statistics/prosodytop.lib.lua:79: attempt to call global 'setfenv' (a nil value) stack traceback: ...al/lib/prosody/modules/mod_statistics/prosodytop.lib.lua:79: in function 'handle_line' ...al/lib/prosody/modules/mod_statistics/prosodytop.lib.lua:96: in function <...al/lib/prosody/modules/mod_statistics/prosodytop.lib.lua:90> (...tail calls...) /usr/lib/prosody/net/server_select.lua:915: in function </usr/lib/prosody/net/server_select.lua:899> [C]: in function 'xpcall' ...al/lib/prosody/modules/mod_statistics/prosodytop.lib.lua:126: in function 'run' ...al/lib/prosody/modules/mod_statistics/mod_statistics.lua:135: in function <...al/lib/prosody/modules/mod_statistics/mod_statistics.lua:129> [C]: in function 'xpcall' /usr/lib/prosody/core/modulemanager.lua:320: in function 'call_module_method' /usr/bin/prosodyctl:1315: in function 'func' /usr/lib/prosody/util/async.lua:127: in function </usr/lib/prosody/util/async.lua:125> DONE

  6. MattJ on

    Hi Dan, This looks like some code that is designed for Lua 5.1. We have an alternative API in Prosody that supports both 5.1 and 5.2, so I changed the module to use that instead. See if the latest prosody-modules commit (8ea7d8f90d25) fixes the problem.

  7. Dan on

    Hi Matt, thank you for the latest commit! Unfortunately top still can't load: # prosodyctl mod_statistics top /usr/lib/prosody/util/envload.lua:31: bad argument #2 to 'load' (string expected, got table) stack traceback: [C]: in function 'load' /usr/lib/prosody/util/envload.lua:31: in function 'envload' ...al/lib/prosody/modules/mod_statistics/prosodytop.lib.lua:79: in function 'handle_line' ...al/lib/prosody/modules/mod_statistics/prosodytop.lib.lua:96: in function <...al/lib/prosody/modules/mod_statistics/prosodytop.lib.lua:90> (...tail calls...) /usr/lib/prosody/net/server_select.lua:915: in function </usr/lib/prosody/net/server_select.lua:899> [C]: in function 'xpcall' ...al/lib/prosody/modules/mod_statistics/prosodytop.lib.lua:126: in function 'run' ...al/lib/prosody/modules/mod_statistics/mod_statistics.lua:135: in function <...al/lib/prosody/modules/mod_statistics/mod_statistics.lua:129> [C]: in function 'xpcall' /usr/lib/prosody/core/modulemanager.lua:320: in function 'call_module_method' /usr/bin/prosodyctl:1315: in function 'func' /usr/lib/prosody/util/async.lua:127: in function </usr/lib/prosody/util/async.lua:125> DONE

  8. MattJ on

    Sorry, my fault for not testing, fix for this in 1962c94e2203.

  9. Dan on

    Thank you, it's working now!

  10. Dan on

    `prosodyctl mod_statistics top` is not compatible with prosody 0.12

New comment

Not published. Used for spam prevention and optional update notifications.