> On 07 Feb 2016, at 11:07, Tal Bar-Or <[email protected]> wrote:
>
> Hi All,
>  I am trying  to get metric value by metric name
>
> curl -k -s -u root:icinga 
> 'https://localhost:5665/v1/objects/services/VPLATS01-2012R2!ping4?attrs=last_check_result'
>  | python -m json.tool
>
> Using the command above i get this json, this is not good enough for me ,
> I would like to get the red text below by the metric name ("rta") is it 
> possible?
> of course i want it for any metric name

That’s not possible at the moment. Use it in a programmatic fashion, fetch the 
json, convert it to e.g. a Python dictionary and iterate over the results 
array, fetch the attrs and so on.

kind regards,
Michael

> Please advice
> Thanks
>
>     "results": [
>         {
>             "attrs": {
>                 "last_check_result": {
>                     "active": true,
>                     "check_source": "daletdasboard.local",
>                     "command": [
>                         "/usr/lib/nagios/plugins/check_ping",
>                         "-4",
>                         "-H",
>                         "172.18.11.87",
>                         "-c",
>                         "200,15%",
>                         "-w",
>                         "100,5%"
>                     ],
>                     "execution_end": 1454838460.188672,
>                     "execution_start": 1454838456.1804,
>                     "exit_status": 0.0,
>                     "output": "PING OK - Packet loss = 0%, RTA = 0.35 ms",
>                     "performance_data": [
>                         "rta=0.352000ms;100.000000;200.000000;0.000000",
>                         "pl=0%;5;15;0"
>                     ],
>                     "schedule_end": 1454838460.188818,
>                     "schedule_start": 1454838516.18,
>                     "state": 0.0,
>                     "type": "CheckResult",
>                     "vars_after": {
>                         "attempt": 1.0,
>                         "reachable": true,
>                         "state": 0.0,
>                         "state_type": 1.0
>                     },
>                     "vars_before": {
>                         "attempt": 1.0,
>                         "reachable": true,
>                         "state": 0.0,
>                         "state_type": 1.0
>                     }
>                 }
>             },
>             "joins": {},
>             "meta": {},
>             "name": "VPLATS01-2012R2!ping4",
>             "type": "Service"
>         }
>     ]
> }
>
>
>
>
> --
> Tal Bar-or
> _______________________________________________
> icinga-users mailing list
> [email protected]
> https://lists.icinga.org/mailman/listinfo/icinga-users


-- 
Michael Friedrich, DI (FH)
Senior Developer

NETWAYS GmbH | Deutschherrnstr. 15-19 | D-90429 Nuernberg
Tel: +49 911 92885-0 | Fax: +49 911 92885-77
CEO: Julian Hein, Bernd Erk | AG Nuernberg HRB18461
http://www.netways.de | [email protected]

** OSDC 2016 - April - netways.de/osdc **
** OSBConf 2016 - September - osbconf.org **
_______________________________________________
icinga-users mailing list
[email protected]
https://lists.icinga.org/mailman/listinfo/icinga-users

Reply via email to