Receivers are the event sinks associated to senlin clusters. When certain events (or alarms) are seen by a monitoring software, the software can notify the senlin clusters of those events (or alarms). When senlin receives those notifications, it can automatically trigger some predefined operations with preset parameter values.
To examine the list of receivers:
def list_receivers(conn):
print("List Receivers:")
for receiver in conn.clustering.receivers():
print(receiver.to_dict())
for receiver in conn.clustering.receivers(sort='name:asc'):
print(receiver.to_dict())
When listing receivers, you can specify the sorting option using the sort
parameter and you can do pagination using the limit
and marker
parameters.
Full example: manage receiver
When creating a receiver, you will provide a dictionary with keys and values according to the receiver type referenced.
def create_receiver(conn):
print("Create Receiver:")
# Build the receiver attributes and create the recever.
spec = {
"action": "CLUSTER_SCALE_OUT",
"cluster_id": CLUSTER_ID,
"name": FAKE_NAME,
"params": {
"count": "1"
},
"type": "webhook"
}
receiver = conn.clustering.create_receiver(**spec)
print(receiver.to_dict())
Optionally, you can specify a metadata
keyword argument that contains some
key-value pairs to be associated with the receiver.
Full example: manage receiver
To get a receiver based on its name or ID:
def get_receiver(conn):
print("Get Receiver:")
receiver = conn.clustering.get_receiver(FAKE_NAME)
print(receiver.to_dict())
Full example: manage receiver
To find a receiver based on its name or ID:
def find_receiver(conn):
print("Find Receiver:")
receiver = conn.clustering.find_receiver(FAKE_NAME)
print(receiver.to_dict())
Full example: manage receiver
After a receiver is created, most of its properties are immutable. Still, you
can update a receiver’s name
and/or params
.
def update_receiver(conn):
print("Update Receiver:")
spec = {
"name": "test_receiver2",
"params": {
"count": "2"
}
}
receiver = conn.clustering.update_receiver(FAKE_NAME, **spec)
print(receiver.to_dict())
Full example: manage receiver
A receiver can be deleted after creation, provided that it is not referenced by any active clusters. If you attempt to delete a receiver that is still in use, you will get an error message.
def delete_receiver(conn):
print("Delete Receiver:")
conn.clustering.delete_receiver(FAKE_NAME)
print("Receiver deleted.")
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.