创建命令:
[root@controller ~]# ceilometer alarm-threshold-create --name test --description 'test' --meter-name cpu_util --threshold 10.0 --comparison-operator gt --statistic avg --period 100 --evaluation-periods 3 --alarm-action 'log://' --query resource_id=03d9ccd4-cf42-4dbe-b391-469e086cfc83
参数解析:
ceilometer alarm-threshold-create
--name test #告警名字
--description 'test' #描述
--meter-name cpu_util #测量值名称(监控的项目)
--threshold 10.0 #阈值
--comparison-operator gt #比对方式:大于
--statistic avg #统计方式:平均值
--period 100 #周期:100秒
--evaluation-periods 3 周期内统计次数:3
--alarm-action 'log://' #转为告警状态时提交的url
--query resource_id=insecure_id #资源ID;云主机ID
告警列表:
[root@controller ~]# ceilometer alarm-list
+--------------------------------------+----------+-------------------+----------+---------+------------+---------------------------------------+------------------+
| Alarm ID | Name | State | Severity | Enabled | Continuous | Alarm condition | Time constraints |
+--------------------------------------+----------+-------------------+----------+---------+------------+---------------------------------------+------------------+
| 5017937d-a813-4847-9542-cf1d4d834e2b | mem_test | insufficient data | low | True | False | avg(memory) > 4096.0 during 10 x 100s | None |
| 671606f1-d49c-4413-8697-ca5444ea00dd | test | insufficient data | low | True | False | avg(cpu_util) > 10.0 during 3 x 100s | None |
+--------------------------------------+----------+-------------------+----------+---------+------------+---------------------------------------+------------------+
附:
[root@controller ~]# ceilometer alarm-threshold-create
usage: ceilometer alarm-threshold-create --name <NAME>
[--project-id <ALARM_PROJECT_ID>]
[--user-id <ALARM_USER_ID>]
[--description <DESCRIPTION>]
[--state <STATE>]
[--severity <SEVERITY>]
[--enabled {True|False}]
[--alarm-action <Webhook URL>]
[--ok-action <Webhook URL>]
[--insufficient-data-action <Webhook URL>]
[--time-constraint <Time Constraint>]
[--repeat-actions {True|False}] -m
<METRIC> [--period <PERIOD>]
[--evaluation-periods <COUNT>]
[--statistic <STATISTIC>]
[--comparison-operator <OPERATOR>]
--threshold <THRESHOLD> [-q <QUERY>]
ceilometer alarm-threshold-create: error: argument --name is required