diff options
| author | Cerberus <matt.dietz@rackspace.com> | 2011-05-10 15:42:00 -0500 |
|---|---|---|
| committer | Cerberus <matt.dietz@rackspace.com> | 2011-05-10 15:42:00 -0500 |
| commit | 3d756a8343845acfead201621a6d658c8ac616fb (patch) | |
| tree | 4a2f4ced59036d400f3dfa866f95a7868284c654 | |
| parent | 6edd5ef387783c13a66a61717d73542d0769d618 (diff) | |
Add example
| -rw-r--r-- | nova/notifier/__init__.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/nova/notifier/__init__.py b/nova/notifier/__init__.py index e6a4a0165..aacbf8ac3 100644 --- a/nova/notifier/__init__.py +++ b/nova/notifier/__init__.py @@ -48,11 +48,20 @@ def notify(event_name, publisher_id, event_type, priority, payload): The payload will be constructed as a dictionary of the above attributes, and converted into a JSON dump, which will then be sent via the transport mechanism defined by the driver. + + Message example: + + { 'publisher_id': 'compute.host1', + 'timestamp': '2011-05-09 22:00:14.621831', + 'priority': 'WARN', + 'event_type': 'compute.create_instance', + 'payload': {'instance_id': 12, ... }} + """ driver = utils.import_class(FLAGS.notification_driver)() message = dict(publisher_id=publisher_id, event_type=event_type, priority=priority, payload=payload, - time=datetime.datetime.utcnow()) + time=str(datetime.datetime.utcnow())) driver.notify(json.dumps(message)) |
