Daniel-Constantin Mierla writes:
here is what mi_rpc modules does:
- it receives a rpc handler form the rpc interface in core
- reads first parameter and then lookups MI command, if not found then
returns error, if found:
- reads all parameters as string and build internal MI tree
ok, after andrei fixed some bug, i got stats working via mi_rpc and
xmlrpc module interface.
all stats except "tm:", which is now implemented using tm.stats command.
res = c.tm.stats()
provides this kind of result:
{'2xx': 0, 'created': 0, '5xx': 0, 'delayed_free': 0,
'current': 0, 'total_local': 0, 'waiting': 0, '6xx': 0,
'4xx': 0, '3xx': 0, 'total': 0, 'replied_locally': 0,
'freed': 0}
whereas mi based stat results look like this:
['200 OK\n', '+ :: core:rcv_requests = 3', '+ :: core:rcv_replies =
0', '+ :: core:fwd_requests = 0', '+ :: core:fwd_replies = 0', '+
:: core:drop_requests = 0', '+ :: core:drop_replies = 0', '+ ::
core:err_requests = 0', '+ :: core:err_replies = 0', '+ ::
core:bad_URIs_rcvd = 0', '+ :: core:unsupported_methods = 3', '+ ::
core:bad_msg_hdr = 0']
would it be possible to get the result in same (preferable the former)
format in both cases?
you can try implementing a new command in the mi_rpc modulem say 'mix'
(mi for xmlrpc) that will format the output as you want.
However would be good to get a single command, but I do not know if is
possible considering that MI reply trees have:
- name for nodes
- values for nodes - string or other nodes
- attributes for nodes - string
IIRC, Andrei proposed to put the value of the attributes in the value of
the node. Now, the formating looks a bit strange, as I did it to
regocnize the above elements, so:
+ means that the printed line corresponds to a node
- means that the printed line corresponds to an attribute of the last
printed node
Within a node line:
- what is before '::' is the name of node
- what is after '::' is the value of node
- tab indentation is used to show the depth of nodes and attributes
All these are taken from mi_fifo.
So, in case of statistics, the nodes have no name and the value has the
format "stat = value". I can say it is pretty weird, but it is the
current style with mi_fifo. As I am not a xmlrpc user, with mi_datagram
I did text parsing.
Cheers,
Daniel