[Openstack] [Ceilometer] Example "create alarm" via REST API
m.channappa.negalur at accenture.com
m.channappa.negalur at accenture.com
Tue Apr 1 13:20:22 UTC 2014
Hello Eoghan,
Please find the details,
1. What version are you using?
root at Tcontroller:/var/log/heat# dpkg --list | grep -i ceilometer
ii ceilometer-agent-central 2013.2-0ubuntu1~cloud0 ceilometer central agent
ii ceilometer-api 2013.2-0ubuntu1~cloud0 ceilometer api service
ii ceilometer-collector 2013.2-0ubuntu1~cloud0 ceilometer collector service
ii ceilometer-common 2013.2-0ubuntu1~cloud0 ceilometer common files
ii python-ceilometer 2013.2-0ubuntu1~cloud0 ceilometer python libraries
ii python-ceilometerclient 1.0.5-0ubuntu1~cloud0 Client library for Openstack ceilometer server.
root at Tcontroller:/var/log/heat# cat /etc/issue
Ubuntu 12.04.3 LTS \n \l
====================================================================================
2. $ ceilometer statistics -m cpu_util -q resource=$INSTANCE_ID
root at Tcontroller:/var/log/heat# nova list
+--------------------------------------+--------------------------------------------+--------+------------+-------------+-----------------------------------------+
| ID | Name | Status | Task State | Power State | Networks |
+--------------------------------------+--------------------------------------------+--------+------------+-------------+-----------------------------------------+
| 8c020529-19c9-4aba-8503-a515bfec342e | m1-WebSG-bchzbkobf632-WebSG-0-yui6jp43bbmb | ACTIVE | None | Running | net_proj_one=50.50.x.x |
| c45fcc9b-f362-4086-a08c-dd7d0c762380 | teststack-WikiDatabase-uehgllv7kmsh | ACTIVE | None | Running | net_proj_one=50.50.x.x,|
+--------------------------------------+--------------------------------------------+--------+------------+-------------+-----------------------------------------+
root at Tcontroller:/var/log/heat# ceilometer statistics -m cpu_util -q resource=8c020529-19c9-4aba-8503-a515bfec342e
root at Tcontroller:/var/log/heat# ceilometer statistics -m cpu_util -q resource=8c020529-19c9-4aba-8503-a515bfec342e
========================================================================================================
root at Tcontroller:/var/log/heat#
-----Original Message-----
From: Eoghan Glynn [mailto:eglynn at redhat.com]
Sent: Friday, March 28, 2014 5:03 PM
To: Channappa Negalur, M.
Cc: mavlcek at cisco.com; openstack at lists.openstack.org
Subject: Re: [Openstack] [Ceilometer] Example "create alarm" via REST API
> Hello Eoghan,
>
> Thanks for the steps..
>
> when I launched my stack(autoscaling), Alarms are created but not
> generating, showing insufficient data. In the log I found below error
>
> I have found something from my log .
>
> ==> ceilometer-collector.log <==
> 2014-03-25 05:40:56.308 1047 ERROR stevedore.extension [-] error
> calling
> 'port': 'tenant_id'
> 2014-03-25 05:40:56.308 1047 ERROR stevedore.extension [-] 'tenant_id'
> 2014-03-25 05:40:56.308 1047 TRACE stevedore.extension Traceback
> (most recent call last):
> 2014-03-25 05:40:56.308 1047 TRACE stevedore.extension File
> "/usr/lib/python2.7/dist-packages/stevedore/extension.py", line 145,
> in _invoke_one_plugin
> 2014-03-25 05:40:56.308 1047 TRACE stevedore.extension
> response_callback(func(e, *args, **kwds))
> 2014-03-25 05:40:56.308 1047 TRACE stevedore.extension File
> "/usr/lib/python2.7/dist-packages/ceilometer/collector/service.py",
> line 293, in _process_notification_for_ext
> 2014-03-25 05:40:56.308 1047 TRACE stevedore.extension
> p(list(ext.obj.to_samples(notification)))
> 2014-03-25 05:40:56.308 1047 TRACE stevedore.extension File
> "/usr/lib/python2.7/dist-packages/ceilometer/network/notifications.py"
> ,
> line 89, in process_notification
> 2014-03-25 05:40:56.308 1047 TRACE stevedore.extension
> project_id=message['payload']['tenant_id'],
> 2014-03-25 05:40:56.308 1047 TRACE stevedore.extension KeyError: 'tenant_id'
> 2014-03-25 05:40:56.308 1047 TRACE stevedore.extension
What version are you using?
That's an issue with incoming neutron notification, shouldn't impact on cpu_util gathering.
Do you have visibility on the stats related to the instance? e.g.
$ ceilometer statistics -m cpu_util -q resource=$INSTANCE_ID
/Eoghan
> refer:
> https://bugs.launchpad.net/ceilometer/+bug/1276761
>
> I am not sure its a bug or I am doing something wrong ..?
>
> Please let me know
>
> -----Original Message-----
> From: Eoghan Glynn [mailto:eglynn at redhat.com]
> Sent: Friday, March 28, 2014 3:31 PM
> To: Mark Vlcek (mavlcek)
> Cc: openstack
> Subject: Re: [Openstack] [Ceilometer] Example "create alarm" via REST
> API
>
>
>
> > Hi All,
> >
> > Can somebody give me an example of how I’d create an alarm via the
> > Telemetry (aka Ceilometer) REST API? I can’t for the life of me find
> > a simple example online, say for example, how to set an alarm for
> > when cpu_util > 80% for a given running instance.
>
> See this little RDO getting-started guide I wrote a while back:
>
> http://openstack.redhat.com/CeilometerQuickStart
>
> there's an example therein of creating an alarm via the CLI:
>
> $ ceilometer alarm-threshold-create --name cpu_high --description 'instance
> running hot' \
> --meter-name cpu_util --threshold 70.0 --comparison-operator gt
> --statistic avg \
> --period 600 --evaluation-periods 3 \
> --alarm-action 'log://' \
> --query resource_id=INSTANCE_ID
>
> Just modify the period, evaluation-periods, threshold to suit your use-case.
>
> To see the actual JSON payload, simply use the --debug option:
>
> $ ceilometer --debug alarm-threshold-create ...
> ...
> curl -i -X POST -H 'X-Auth-Token: TOKEN' -H 'Content-Type:
> application/json' -H 'Accept: application/json' -H 'User-Agent:
> python-ceilometerclient' -d '{"alarm_actions": ["log://"], "description":
> "instance running hot", "threshold_rule": {"meter_name": "cpu_util",
> "evaluation_periods": 3, "period": 600, "statistic": "avg", "threshold":
> 70.0, "query": [{"field": "resource_id", "type": "", "value":
> "INSTANCE_ID", "op": "eq"}], "comparison_operator": "gt"},
> "repeat_actions": false, "type": "threshold", "name": "cpu_high"}'
> http://IP_ADDR:8777/v2/alarms
>
> You could also look at the official project API docco here:
>
> http://docs.openstack.org/developer/ceilometer/webapi/v2.html
>
> Cheers,
> Eoghan
>
>
> >
> > I saw this example in a presentation somewhere, but it’s not exactly
> > self-explanatory.
> >
> > POST /v2/alarms
> >
> > {
> > "alarm_actions": [
> > "http://site:8000/alarm"
> > ],
> > "insufficient_data_actions": [
> > "http://site:8000/nodata"
> > ],
> > "ok_actions": [
> > "http://site:8000/ok"
> > ],
> > "comparison_operator": "gt",
> > "description": "An alarm",
> > "evaluation_periods": 2,
> > "matching_metadata": {
> > "key_name": "key_value"
> > },
> > "meter_name": "storage.objects",
> > "name": "SwiftObjectAlarm",
> > "period": 240,
> > "statistic": "avg",
> > "threshold": 200
> > }
> >
> > Thanks,
> > Mark
> >
> > _______________________________________________
> > Mailing list: http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
> > Post to : openstack at lists.openstack.org
> > Unsubscribe :
> > http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
> >
>
> _______________________________________________
> Mailing list: http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
> Post to : openstack at lists.openstack.org
> Unsubscribe :
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
>
> ________________________________
>
> This message is for the designated recipient only and may contain
> privileged, proprietary, or otherwise confidential information. If you
> have received it in error, please notify the sender immediately and
> delete the original. Any other use of the e-mail by you is prohibited.
> Where allowed by local law, electronic communications with Accenture
> and its affiliates, including e-mail and instant messaging (including
> content), may be scanned by our systems for the purposes of
> information security and assessment of internal compliance with Accenture policy.
> ______________________________________________________________________
> ________________
>
> www.accenture.com
>
________________________________
This message is for the designated recipient only and may contain privileged, proprietary, or otherwise confidential information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the e-mail by you is prohibited. Where allowed by local law, electronic communications with Accenture and its affiliates, including e-mail and instant messaging (including content), may be scanned by our systems for the purposes of information security and assessment of internal compliance with Accenture policy.
______________________________________________________________________________________
www.accenture.com
More information about the Openstack
mailing list