kamailio_exporter icon indicating copy to clipboard operation
kamailio_exporter copied to clipboard

Feature: add rpc methods with parameters

Open fnurglewitz opened this issue 5 years ago • 4 comments

Hi, would it be possible to add rpc methods which need parameters?

Adding methods without parameters is quite easy but I'm not sure how I should proceed (I suppose some changes on the binrpc library are needed)

fnurglewitz avatar Mar 04 '19 07:03 fnurglewitz

Hello!

Could you give me an example of RPC method with parameters so I can make some tests?

Best

florentchauveau avatar Mar 04 '19 11:03 florentchauveau

hello, here's an example:

mod.stats core shm

Thank you

fnurglewitz avatar Mar 04 '19 11:03 fnurglewitz

Below case is in particular useful where you can scrape any specific (group) statistics listed in kamcmd stats. For example: kamcmd stats.get_statistics <statistics_name> kamcmd stats.get_statistics <group:>

vishal-yadav avatar Apr 11 '19 14:04 vishal-yadav

Hello guys,

The binrpc package can already handle this, command args need to be appended to the WritePacket function.

Like this:

cookie, err := binrpc.WritePacket(conn, "stats.fetch", "current_opened_connections")

Implementing this in the exporter would be trivial, we could split a command by " "(space) in the fetchBINRPC function.

However, it would be interesting to have a more dynamic list of commands I think. Or maybe we just need to implement stats.fetch all that is available since Kamailio 5.X.

florentchauveau avatar Aug 13 '19 20:08 florentchauveau