Hey all, I was wondering if the kamctl stats output could be updated to provide a bit more parseable JSON? For instance: # kamctl stats shmem | jq . { "jsonrpc": "2.0", "result": [ "shmem:fragments = 18", "shmem:free_size = 467187808", "shmem:max_used_size = 69694104", "shmem:real_used_size = 69683104", "shmem:total_size = 536870912", "shmem:used_size = 41048984" ], "id": 4300 } I would hope would be more like this: { "jsonrpc":"2.0", "result":[ { "shmem":[ { "fragments":18, "free_size":467187808, "max_used_size":69694104, "real_used_size":69683104, "total_size":536870912, "used_size":41048984 } ] } ], "id":4300 } I apologize in advanced because I don’t have the skillset to contribute such a feature. Thanks! ~Noah
Hello, The jsonrpc-s module has a pretty_print option. Or is that not where you're dispatching this JSON output from? -- Alex -- Sent via mobile, please forgive typos and brevity.
Alex, This is how that output was generated: # kamctl stats shmem | jq . Thanks! ~Noah
On Sep 20, 2017, at 1:14 PM, Alex Balashov <abalashov@evaristesys.com> wrote:
Hello,
The jsonrpc-s module has a pretty_print option. Or is that not where you're dispatching this JSON output from?
-- Alex
-- Sent via mobile, please forgive typos and brevity.
_______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
You may want to consider an alternate and more streamlined method of pulling these. On September 20, 2017 1:16:49 PM EDT, Noah Mehl <noahmehl@gmail.com> wrote:
Alex,
This is how that output was generated:
# kamctl stats shmem | jq .
Thanks!
~Noah
On Sep 20, 2017, at 1:14 PM, Alex Balashov <abalashov@evaristesys.com> wrote:
Hello,
The jsonrpc-s module has a pretty_print option. Or is that not where you're dispatching this JSON output from?
-- Alex
-- Sent via mobile, please forgive typos and brevity.
_______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
_______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-- Alex -- Sent via mobile, please forgive typos and brevity.
Alex, We are using this for time series monitoring (e.g. Zabbix). It doesn’t make sense, at least to me, to implement jsonrpc-s just to get the kamctl stats output. I mean, currently I’m just chaining the output with cut and tr, and that’s fine. I just suggest utilizing JSON a bit better here. Thanks! ~Noah
On Sep 20, 2017, at 1:17 PM, Alex Balashov <abalashov@evaristesys.com> wrote:
You may want to consider an alternate and more streamlined method of pulling these.
On September 20, 2017 1:16:49 PM EDT, Noah Mehl <noahmehl@gmail.com> wrote:
Alex,
This is how that output was generated:
# kamctl stats shmem | jq .
Thanks!
~Noah
On Sep 20, 2017, at 1:14 PM, Alex Balashov <abalashov@evaristesys.com> wrote:
Hello,
The jsonrpc-s module has a pretty_print option. Or is that not where you're dispatching this JSON output from?
-- Alex
-- Sent via mobile, please forgive typos and brevity.
_______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
_______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-- Alex
-- Sent via mobile, please forgive typos and brevity.
_______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Hello, jsonrcps is the module required by kamctl starting with version 5.0 (being the module renamed from jsonrpc-s). Then, back to the main topic here -- the output for 'kamctl stats' was inherited from old times when MI (with no standard format in its output) was used to interact with kamailio and it was like a printed string in the form of "group.name = value" for each of the available statistics. As I also wanted for quite long time to get a more json friendly output for stats, this discussion brought it back in my attention and I just added the rpc command stats.fetch. This one returns a json structure like in next example for getting shared memory stats: # kamctl rpc stats.fetch shmem: { "jsonrpc": "2.0", "result": { "shmem.fragments": "1", "shmem.free_size": "64288976", "shmem.max_used_size": "2819888", "shmem.real_used_size": "2819888", "shmem.total_size": "67108864", "shmem.used_size": "2578288" }, "id": 44590 } I left the value as string in order to accommodate large numbers (as the rpc interface works usually with integers), but if people finds it inconvenient, I can look at seeing if large numbers are actually needed here. Cheers, Daniel On 20.09.17 19:34, Noah Mehl wrote:
Alex,
We are using this for time series monitoring (e.g. Zabbix). It doesn’t make sense, at least to me, to implement jsonrpc-s just to get the kamctl stats output. I mean, currently I’m just chaining the output with cut and tr, and that’s fine. I just suggest utilizing JSON a bit better here.
Thanks!
~Noah
On Sep 20, 2017, at 1:17 PM, Alex Balashov <abalashov@evaristesys.com> wrote:
You may want to consider an alternate and more streamlined method of pulling these.
On September 20, 2017 1:16:49 PM EDT, Noah Mehl <noahmehl@gmail.com> wrote:
Alex,
This is how that output was generated:
# kamctl stats shmem | jq .
Thanks!
~Noah
On Sep 20, 2017, at 1:14 PM, Alex Balashov <abalashov@evaristesys.com> wrote: Hello,
The jsonrpc-s module has a pretty_print option. Or is that not where you're dispatching this JSON output from?
-- Alex
-- Sent via mobile, please forgive typos and brevity.
_______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
_______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-- Alex
-- Sent via mobile, please forgive typos and brevity.
_______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
_______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-- Daniel-Constantin Mierla www.twitter.com/miconda -- www.linkedin.com/in/miconda Kamailio Advanced Training - www.asipto.com Kamailio World Conference - www.kamailioworld.com
Looking to get usrloc stats in pure json format. When trying to run from the example above: kamctl rpc stats.fetch shmem: I get a message of Method Not Found Was this command not released, or is there another way to do this? Thanks On Thu, Sep 21, 2017 at 10:53 AM, Daniel-Constantin Mierla < miconda@gmail.com> wrote:
Hello,
jsonrcps is the module required by kamctl starting with version 5.0 (being the module renamed from jsonrpc-s).
Then, back to the main topic here -- the output for 'kamctl stats' was inherited from old times when MI (with no standard format in its output) was used to interact with kamailio and it was like a printed string in the form of "group.name = value" for each of the available statistics.
As I also wanted for quite long time to get a more json friendly output for stats, this discussion brought it back in my attention and I just added the rpc command stats.fetch. This one returns a json structure like in next example for getting shared memory stats:
# kamctl rpc stats.fetch shmem: { "jsonrpc": "2.0", "result": { "shmem.fragments": "1", "shmem.free_size": "64288976", "shmem.max_used_size": "2819888", "shmem.real_used_size": "2819888", "shmem.total_size": "67108864", "shmem.used_size": "2578288" }, "id": 44590 }
I left the value as string in order to accommodate large numbers (as the rpc interface works usually with integers), but if people finds it inconvenient, I can look at seeing if large numbers are actually needed here.
Cheers, Daniel
On 20.09.17 19:34, Noah Mehl wrote:
Alex,
We are using this for time series monitoring (e.g. Zabbix). It doesn’t make sense, at least to me, to implement jsonrpc-s just to get the kamctl stats output. I mean, currently I’m just chaining the output with cut and tr, and that’s fine. I just suggest utilizing JSON a bit better here.
Thanks!
~Noah
On Sep 20, 2017, at 1:17 PM, Alex Balashov <abalashov@evaristesys.com> wrote:
You may want to consider an alternate and more streamlined method of pulling these.
On September 20, 2017 1:16:49 PM EDT, Noah Mehl <noahmehl@gmail.com> wrote:
Alex,
This is how that output was generated:
# kamctl stats shmem | jq .
Thanks!
~Noah
On Sep 20, 2017, at 1:14 PM, Alex Balashov <abalashov@evaristesys.com> wrote: Hello,
The jsonrpc-s module has a pretty_print option. Or is that not where you're dispatching this JSON output from?
-- Alex
-- Sent via mobile, please forgive typos and brevity.
_______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
_______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-- Alex
-- Sent via mobile, please forgive typos and brevity.
_______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
_______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-- Daniel-Constantin Mierla www.twitter.com/miconda -- www.linkedin.com/in/miconda Kamailio Advanced Training - www.asipto.com Kamailio World Conference - www.kamailioworld.com
_______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Am Montag, 6. August 2018, 19:23:33 CEST schrieb Daniel Greenwald:
Looking to get usrloc stats in pure json format.
When trying to run from the example above:
kamctl rpc stats.fetch shmem:
I get a message of Method Not Found
Was this command not released, or is there another way to do this? [..]
Hello, probably a stupid question, but do you tried to execute the command with ":" at the end? Do you get a result with kamctl rpc stats.fetch shmem? And why are you looking into the shmem stats for usrloc statistics? Best regards, Henning -- Henning Westerholt https://skalatan.de/blog/
Point was that kamctl rpc stats.fetch usrloc or kamctl rpc stats.fetch shmem both return { "jsonrpc": "2.0", "error": { "code": 500, "message": "Method Not Found" }, "id": 29575 } shmem was the specific example given by Daniel Constantin Mierla so I'm not sure why its not working. I ended up using "kamcmd stats.get_statistics all" and parsing the raw text returned there. On Mon, Aug 6, 2018 at 2:53 PM, Henning Westerholt <hw@kamailio.org> wrote:
Am Montag, 6. August 2018, 19:23:33 CEST schrieb Daniel Greenwald:
Looking to get usrloc stats in pure json format.
When trying to run from the example above:
kamctl rpc stats.fetch shmem:
I get a message of Method Not Found
Was this command not released, or is there another way to do this? [..]
Hello,
probably a stupid question, but do you tried to execute the command with ":" at the end? Do you get a result with kamctl rpc stats.fetch shmem?
And why are you looking into the shmem stats for usrloc statistics?
Best regards,
Henning
-- Henning Westerholt https://skalatan.de/blog/
participants (5)
-
Alex Balashov -
Daniel Greenwald -
Daniel-Constantin Mierla -
Henning Westerholt -
Noah Mehl