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