From 97da380acd8e3ba0c9a9618a99c4106eca1d1576 Mon Sep 17 00:00:00 2001 From: Evgeny Khramtsov Date: Wed, 8 Jan 2020 12:24:51 +0300 Subject: Generate ejabberd.yml.5 man page from source code directly Several documentation callbacks (doc/0 and mod_doc/0) are implemented and `ejabberdctl man` command is added to generate a man page. Note that the command requires a2x to be installed (which is a part of asciidoc package). --- src/mod_metrics.erl | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'src/mod_metrics.erl') diff --git a/src/mod_metrics.erl b/src/mod_metrics.erl index 297f3eeb5..ab6e214b1 100644 --- a/src/mod_metrics.erl +++ b/src/mod_metrics.erl @@ -30,9 +30,10 @@ -include("logger.hrl"). -include("xmpp.hrl"). +-include("translate.hrl"). -export([start/2, stop/1, mod_opt_type/1, mod_options/1, depends/2, reload/3]). --export([push/2]). +-export([push/2, mod_doc/0]). -export([offline_message_hook/1, sm_register_connection_hook/3, sm_remove_connection_hook/3, user_send_packet/1, user_receive_packet/1, @@ -188,3 +189,32 @@ mod_opt_type(port) -> mod_options(_) -> [{ip, {127,0,0,1}}, {port, 11111}]. + +mod_doc() -> + #{desc => + [?T("This module sends events to external backend " + "(by now only https://github.com/processone/grapherl" + "[grapherl] is supported). Supported events are:"), "", + "- sm_register_connection", "", + "- sm_remove_connection", "", + "- user_send_packet", "", + "- user_receive_packet", "", + "- s2s_send_packet", "", + "- s2s_receive_packet", "", + "- register_user", "", + "- remove_user", "", + "- offline_message", "", + ?T("When enabled, every call to these hooks triggers " + "a counter event to be sent to the external backend.")], + opts => + [{ip, + #{value => ?T("IPv4Address"), + desc => + ?T("IPv4 address where the backend is located. " + "The default value is '127.0.0.1'.")}}, + {port, + #{value => ?T("Port"), + desc => + ?T("An internet port number at which the backend " + "is listening for incoming connections/packets. " + "The default value is '11111'.")}}]}. -- cgit v1.2.3