processone / ejabberd-contrib

Growing and curated ejabberd contributions repository - PR or ask to join !
http://ejabberd.im
248 stars 137 forks source link

how to enable additional stats from statsdx #306

Closed aditya-enthu closed 2 years ago

aditya-enthu commented 2 years ago

Hello All,

Learning ejabbered and trying to understand how to enable additional stats.

Let's say I would like to uncomment below line. How do I apply or what actions do I need to take to show these stats in web admin portal.

I tried multiple commands but it doesn't show up.

https://github.com/processone/ejabberd-contrib/blob/c2efdc19506b255f4b74cdc4c805eab6128c2173/mod_statsdx/src/mod_statsdx.erl#L1358-L1365

Can someone please guide with exact steps.

licaon-kter commented 2 years ago

And you added the module to .yml and reloaded or restarted, yes?

aditya-enthu commented 2 years ago

@licaon-kter thank you for quick response.

Nope, when I add module to /opt/ejabberd/conf/ejabberd.yml it crashes/error out.

mod_statsdx: {}
   hooks : true

But it runs fine when I install ejabberdctl module_install mod_statsdx

running ejabberd version - 21.07 on ubuntu 20.04

licaon-kter commented 2 years ago

You need to do both.

When it errors out, what's the .log message?

aditya-enthu commented 2 years ago

I found that the module is enabled in this file (not my change seems by defaullt), do I still need to enable at /opt/ejabberd/conf/ejabberd.yml

cat /opt/ejabberd/.ejabberd-modules/mod_statsdx/conf/mod_statsdx.yml
modules:
  mod_statsdx:
    hooks: true
  mod_stats2file:
    interval: 60
    type: txt
    split: true
    basefilename: "/var/www/stats"
    hosts:
      - "localhost"
licaon-kter commented 2 years ago

If that file is included in the main .yml maybe not.

Try in your main .yml as the Readme says.

aditya-enthu commented 2 years ago

@licaon-kter,

Thank you for your response. I am now able to see the uncomment stats.

what i did

Thank you again.

BTW, is there other ways to get real stats of the services. Just curious.

licaon-kter commented 2 years ago

Which stats do you want?

aditya-enthu commented 2 years ago

@licaon-kter thank you again.

We are looking for stats like:

badlop commented 2 years ago

I think I came here a little late, but anyway, some clarifications:

I tried multiple commands but it doesn't show up. module_uninstall mod_statsdx module_install mod_statsdx module_update spec

Usually it's preferable to update spec (that is, update the source code), then uninstall, and finally install (which compiles the new source code)

mod_statsdx: {} hooks : true

That's wrong syntax, don't put {} if you already provide options

I found that the module is enabled in this file (not my change seems by defaullt), do I still need to enable at /opt/ejabberd/conf/ejabberd.yml

You can enable the module in any of the two configuration files you prefer, but only enable in one of them!

BTW, is there other ways to get real stats of the services. Just curious

I am not aware of other modules that provide statistics. Of course, you can edit mod_statsdx.erl source code to add more statistics.

On the other hand, Erlang/OTP includes the "observer" application, it's GUI, so probably you can't run it in the server machine, but you can try to attach a remote erlang node to the ejabberd server node, and there run "observer:start()."

There was another erlang/otp app similar to "top", that can run in the erlang shell, but I don't remember its name.

licaon-kter commented 2 years ago

etop, it is part of erlang-observer on Debian.