Kapacitor will send alert to vitrage by using [ exec-handle ], send to message queue topic of vitrage. https://docs.influxdata.com/kapacitor/v1.5/working/alerts/
Copy the ‘https://raw.githubusercontent.com/openstack/vitrage/master/vitrage/datasources/kapacitor/auxiliary/kapacitor_vitrage.py’ script into the Kapacitor servers.
$ cp kapacitor_vitrage.py /etc/kapacitor/kapacitor_vitrage.py
$ chmod 755 /etc/kapacitor/kapacitor_vitrage.py
Define topic , which use for alert publish to. Create file forward_to_vitrage.yaml
:
topic: forward_to_vitrageid: forward_to_vitragekind: execoptions:prog: ‘/usr/bin/python’args: [‘/etc/kapacitor/kapacitor_vitrage.py’,’rabbit://<rabbit_user>:<rabbit_pass>@controller’]
Note: rabbit://<rabbit_user>:<rabbit_pass>@controller is Vitrage message bus url,rabbit_user:rabbit_pass
for devstack rabbitmq isstackrabbit/secret
Run command to define topic
$ kapacitor define-topic-handler ./forward_to_vitrage.yaml
Assign your Task to topic, in Tick script define that alert, add in “alert()” step:
…alert()….topic(‘forward_to_vitrage’)
In case your Task already in topic and you don’t want to add another, you only need to do: append ‘exec handler’ to TICK script which define it.
…alert()….exec(‘/usr/bin/python’, ‘/etc/kapacitor/kapacitor_vitrage.py’, ‘rabbit://<rabbit_user>:<rabbit_pass>@controller’)
Run command define your task:
$ kapacitor define <task_name> -tick <tick_script>
Vitrage configuration:
/etc/vitrage/vitrage.conf
[datasources]
types = kapacitor,zabbix,nova.host,nova.instance,nova.zone,static_physical,aodh,cinder.volume,neutron.network,neutron.port,heat.stack
/etc/vitrage/vitrage.conf
[kapacitor]
config_file = /etc/vitrage/kapacitor_conf.yaml
/etc/vitrage/kapacitor_conf.yaml
with this contentkapacitor:
- alert:
host: cloud.compute1 # hostname of host been raised alarm
vitrage_resource:
type: nova.host # resource type of enity vitrage
name: compute-1 # resource name of enity vitrage
- alert:
host: compute-(.*)
vitrage_resource:
type: nova.host
name: ${kapacitor_host}
- alert:
host: (.*)
vitrage_resource:
type: nova.instance
name: ${kapacitor_host}
In example: alarm on host have hostname cloud.compute1 will map to resource name compute-1,
alarm on host have hostname compute-99 will map to resource name compute-99
Another alarm, like alarm on instance will map with resource type nova.instance
and name equal with hostname of instance
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.