#705 prosodyctl num-active-users

Reporter Dan
Owner Zash
Created
Updated
Stars ★ (1)  
Tags
  • Type-Enhancement
  • Priority-Medium
  • Status-Fixed
  1. Dan on

    Please support printing the number of active users with prosodyctl, comparable to how ejabberdctl does this: num-active-users [host] [days] Print number of users registered on the virtual host [host] who logged on the server at least once during the last days [days].

  2. Zash on

    There exists https://modules.prosody.im/mod_list_inactive.html which you should be easy to modify to suit your needs (s/inactive/active/, invert the condition, pipe output to wc -l).

  3. Dan on

    Thank you for the hint! Unfortunately the unmodified mod_list_inactive doesn't work on my setup: Failed to execute command: Error: /usr/local/lib/prosody modules/mod_list_inactive.lua:42: attempt to call a nil value stack traceback: /usr/lib/prosody/core/modulemanager.lua:29: in function '(for generator)' /usr/local/lib/prosody modules/mod_list_inactive.lua:42: in function </usr/local/lib/prosody modules/mod_list_inactive.lua:21> (tail call): ? [C]: in function 'xpcall' /usr/lib/prosody/core/modulemanager.lua:29: in function </usr/lib/prosody/core/modulemanager.lua:26> (tail call): ? /usr/bin/prosodyctl:809: in main chunk [C]: ? Is it only working with internal users and not with users from LDAP?

  4. Zash on

    It would work with the authentication modules that support listing users.

  5. Dan on

    I'm using cyrus as authentication mechanism, so unfortunately listing users doesn't seem to be supported

  6. Zash on

    This should do it: https://hg.prosody.im/prosody-modules/rev/39c39844cd4c

    Changes
    • tags Status-Fixed
    • owner Zash
  7. Dan on

    Great, thank you very much! There seems to be just one typo in line 45 of mod_list_active.lua: Instead of if last_active < max_age then it should be if last_active > max_age then After this edit it works as expected. Thank you!

  8. Zash on

    Right. https://hg.prosody.im/prosody-modules/rev/c06c59b99b3c

New comment