osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[telemetry] Gnocchi: Aggregates Operation Syntax


Thanks Bernd,

now I understand the new aggregation syntax. J

 

In my setup max is not a valid aggregation method so I would use mean
instead.

 

Problem with my use case is that I don't want the actual used cpu NS, but
the reserved vcpus per hour.

Using the metric vcpus is no option, because it does not reflect the status
of the VM. When you shut down the VM it is recorded anyway.

So I decided to correlate the cpu with the vcpus metrics. For that I have to
write my own python scripts

 

Thanks again for your supportiv answer!

Merlin

 

Von: Bernd Bausch <berndbausch at gmail.com> 
Gesendet: Dienstag, 6. August 2019 07:49
An: openstack-discuss at lists.openstack.org
Betreff: Re: [telemetry] Gnocchi: Aggregates Operation Syntax

 

Yes, aggregate syntax documentation has room for improvement. However,
Gnocchi's API documentation has a rather useful list of supported operations
at https://gnocchi.xyz/rest.html#list-of-supported-operations
<https://urldefense.proofpoint.com/v2/url?u=https-3A__gnocchi.xyz_rest.html-
23list-2Dof-2Dsupported-2Doperations&d=DwMD-g&c=vo2ie5TPcLdcgWuLVH4y8lsbGPqI
ayH3XbK3gK82Oco&r=hTUN4-Trlb-8Fh11dR6m5VD1uYA15z7v9WL8kYigkr8&m=s9-jJlo7pCXA
4tDqYm7rnH9PmrmPxcPeNp3ldkJ3O5E&s=ZikNNpSMmr3eG3-z2HL8maF5zlpc4pyNFOLFy2R1-q
s&e=> . See also my recent issue
https://github.com/gnocchixyz/gnocchi/issues/1044
<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_gnocchixyz_
gnocchi_issues_1044&d=DwMD-g&c=vo2ie5TPcLdcgWuLVH4y8lsbGPqIayH3XbK3gK82Oco&r
=hTUN4-Trlb-8Fh11dR6m5VD1uYA15z7v9WL8kYigkr8&m=s9-jJlo7pCXA4tDqYm7rnH9PmrmPx
cPeNp3ldkJ3O5E&s=QSibXpyW3kfu6GWLdxb49Uzcny34vtChJaL4wNdHM3s&e=> , which
helped me understand how aggregation works in Gnocchi. 

Note that you can write an aggregate operation as a string using prefix
notation, or as a JSON structure. On the command line, the string version is
easier to use in my opinion.

Regarding your use case, allow me to focus on CPU. Ceilometer's cpu metric
accumulates the nanoseconds an instance consumes. Try max aggregation to
look at the CPU usage of a single instance:

    gnocchi measures show --aggregation max --resource-id SERVER_UUID cpu

which is equivalent to

    gnocchi aggregates '(metric cpu max)' id=SERVER_UUID

then use sum aggregation over all instances of a project:

    gnocchi aggregates '(aggregate sum (metric cpu max))'
project_id=PROJECT_UUID

You can even divide the figures by one billion, which converts nanoseconds
to seconds:

    gnocchi aggregates '(/ (aggregate sum (metric cpu max)) 1000000000)'
project_id=PROJECT_UUID

If that works, it should not be too hard to do something equivalent for
memory and storage.

Bernd.

On 8/5/2019 5:43 PM, Blom, Merlin, NMU-OI wrote:

Hey,

I would like to aggregate data from the gnocchi database by using the
gnocchi aggregates function of the CLI/API

The documentation does not cover the operations that are available nor the
syntax that has to be used:

 
<https://urldefense.proofpoint.com/v2/url?u=https-3A__gnocchi.xyz_gnocchicli
ent_shell.html-3Fhighlight-3Dreaggregation-23aggregates&d=DwMD-g&c=vo2ie5TPc
LdcgWuLVH4y8lsbGPqIayH3XbK3gK82Oco&r=hTUN4-Trlb-8Fh11dR6m5VD1uYA15z7v9WL8kYi
gkr8&m=s9-jJlo7pCXA4tDqYm7rnH9PmrmPxcPeNp3ldkJ3O5E&s=rBSJoFwYZ81qRuPWXModdF6
yty_dDg4r25vGRsmXedc&e=>
https://gnocchi.xyz/gnocchiclient/shell.html?highlight=reaggregation#aggrega
tes

 

Searching for more information I found a GitHub Issue:

 
<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_gnocchixyz_
gnocchi_issues_393&d=DwMD-g&c=vo2ie5TPcLdcgWuLVH4y8lsbGPqIayH3XbK3gK82Oco&r=
hTUN4-Trlb-8Fh11dR6m5VD1uYA15z7v9WL8kYigkr8&m=s9-jJlo7pCXA4tDqYm7rnH9PmrmPxc
PeNp3ldkJ3O5E&s=YNehDG_-fPl8zG4_leiUOiiAW_y8jxRFazvQqcpXVQs&e=>
https://github.com/gnocchixyz/gnocchi/issues/393

But I cannot use the syntax from that ether.

 

My use case:

I want to aggregate the vcpus hours per month, vram hours per month, . per
server or project.

-          when an instance is stopped only storage is counted

-          the exact usage is used e.g. 2 vcpus between 1st and 7th day
4vcpus between 8th and last month no mean calculations

 

Do you have detailed documentation about the gnocchi Aggregates Operation
Syntax?

Do you have complex examples for gnocchi aggregations? Especially when using
the python bindings:

conn_gnocchi.metric.aggregation(metrics="memory",  query=[XXXXXXXX],
resource_type='instance', groupby='original_resource_id') 

Can you give me advice regarding my use case? Do's and don'ts.

 

Thank you for your help in advance!

Merlin Blom

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-discuss/attachments/20190806/0729411b/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5195 bytes
Desc: not available
URL: <http://lists.openstack.org/pipermail/openstack-discuss/attachments/20190806/0729411b/attachment-0001.bin>