I'll give that a try.  Two things I'd like to get away from:

1) having to specify the time window (just get point-in-time metrics)
2) having to specify the fields. Accord to

https://github.com/apache/ambari/blob/trunk/ambari-server/docs/api/v1/index.md#monitoring

I should be able to issue a query like this:

GET /clusters/c1/services/HDFS/components/DATANODE

and that will generate a response like this:

{
    "href" : 
"http://your.ambari.server/api/v1/clusters/c1/services/HDFS/components/DATANODE";,
    "metrics" : {
        "process" : {
          "proc_total" : 697.75,
          "proc_run" : 0.875
        },
        "rpc" : {
            ...
        },
        "ugi" : {
            ...
        },
        "dfs" : {
            "datanode" : {
            ...
            }
        },
        "disk" : {
            ...
        },
        "cpu" : {
            ...
        }
        ...
    },
    "ServiceComponentInfo" : {
        "cluster_name" : "c1",
        "component_name" : "DATANODE",
        "service_name" : "HDFS"
        "state" : "STARTED"
    },
    "host_components" : [
        {
            "href" : 
"http://your.ambari.server/api/v1/clusters/c1/hosts/host1/host_components/DATANODE";,
            "HostRoles" : {
                "cluster_name" : "c1",
                "component_name" : "DATANODE",
                "host_name" : "host1"
            }
        }
    ]
}

On Tuesday, February 23, 2016 22:04:54 Aravindan Vijayan wrote:
> Edit : The URL should be 
> 
> http:localhost:8080/api/v1/clusters/winchester/services/YARN/components/NODE
> MANAGER?fields=metrics/yarn/ContainersFailed._sum[1456261150,1456264750,15],
> metrics/yarn/ContainersCompleted._sum[1456261150,1456264750,15],metrics/yarn
> /ContainersLaunched._sum[1456261150,1456264750,15],metrics/yarn/ContainersIn
> iting._sum[1456261150,1456264750,15],metrics/yarn/ContainersKilled._sum[1456
> 261150,1456264750,15]
 
> 
> 
> 
> -- 
> Thanks and Regards,
> Aravindan Vijayan
> 
> 
> 
> 
> 
> 
> 
> 
> On 2/23/16, 2:03 PM, "Aravindan Vijayan" <[email protected]> wrote:
> 
> 
> >Hi Joshua,
> >
> >You can get metrics using the fields=metrics predicate. Can you try
> >something like this?
 
> >
> >https://hcube2-1n01.eng.hortonworks.com:8443/api/v1/clusters/winchester/ser
> >vices/YARN/components/NODEMANAGER?fields=metrics/yarn/ContainersFailed._sum
> >[1456261150,1456264750,15],metrics/yarn/ContainersCompleted._sum[1456261150
> >,1456264750,15],metrics/yarn/ContainersLaunched._sum[1456261150,1456264750,
> >15],metrics/yarn/ContainersIniting._sum[1456261150,1456264750,15],metrics/y
> >arn/ContainersKilled._sum[1456261150,1456264750,15]
 
> >
> >The metrics are defined in the metrics.json for the service. For example,
> >for YARN it will be at
> >/var/lib/ambari-server/resources/common-services/YARN/2.1.0.2.0/YARN_metri
> >cs.json.
 
> >
> >-- 
> >Thanks and Regards,
> >Aravindan Vijayan
> >
> >
> >
> >
> >
> >
> >
> >On 2/23/16, 1:47 PM, "Joshua J. Kugler" <[email protected]> wrote:
> >
> >
> >>FYI: The Ambari IRC channel is dead-ish. :)
> >>
> >>So, according to the docs here: 
> >>
> >>https://github.com/apache/ambari/blob/trunk/ambari-server/docs/api/v1/inde
> >>x.md 
 
> >>a call such as this:
> >>GET /clusters/c1/services/HDFS/components/DATANODE
> >>
> >>should return a bunch of metrics including rpc, disk, cpu, etc.  I'm
> >>issuing 
 this query against our Ambari server:
> >>
> >>http://localhost:8080/api/v1/clusters/data-torrent/services/YARN/component
> >>s/YARN_CLIENT
 
> >>but I'm not getting nearly as much information. I'm only getting this: 
> >>
> >>https://gist.github.com/jkugler/db42cf9839e805606016
> >>
> >>What is the best way to get metrics from the Ambari REST API?
> >>
> >>Thanks!
> >>
> >>j
> >>
> >>-- 
> >>Joshua J. Kugler - Fairbanks, Alaska
> >>Azariah Enterprises - Programming and Website Design
> >>[email protected] - Jabber: [email protected]
> >>PGP Key: http://pgp.mit.edu/  ID 0x73B13B6A
> >>

-- 
Joshua J. Kugler - Fairbanks, Alaska
Azariah Enterprises - Programming and Website Design
[email protected] - Jabber: [email protected]
PGP Key: http://pgp.mit.edu/  ID 0x73B13B6A

Reply via email to