|
| 1 | +================== |
| 2 | + Monitoring Guide |
| 3 | +================== |
| 4 | + |
| 5 | +.. contents:: |
| 6 | + :local: |
| 7 | + |
| 8 | +Events |
| 9 | +====== |
| 10 | + |
| 11 | +Describe events |
| 12 | + |
| 13 | + |
| 14 | +Snapshots |
| 15 | +--------- |
| 16 | + |
| 17 | +Describe snapshots |
| 18 | + |
| 19 | + |
| 20 | +Custom Camera |
| 21 | +~~~~~~~~~~~~~ |
| 22 | + |
| 23 | +.. code-block:: python |
| 24 | +
|
| 25 | + from pprint import pformat |
| 26 | +
|
| 27 | + from celery.events.snapshot import Polaroid |
| 28 | +
|
| 29 | + class DumpCam(Polaroid): |
| 30 | +
|
| 31 | + def shutter(self, state): |
| 32 | + if not state.event_count: |
| 33 | + # No new events since last snapshot. |
| 34 | + return |
| 35 | + print("Workers: %s" % (pformat(state.workers, indent=4), )) |
| 36 | + print("Tasks: %s" % (pformat(state.tasks, indent=4), )) |
| 37 | + print("Total: %s events, %s tasks" % ( |
| 38 | + state.event_count, state.task_count)) |
| 39 | +
|
| 40 | +Now you can use this cam with ``celeryev`` by specifying |
| 41 | +it with the ``-c`` option:: |
| 42 | + |
| 43 | + $ celeryev -c myapp.DumpCam --frequency=2.0 |
| 44 | + |
| 45 | +Or you can use it programatically like this:: |
| 46 | + |
| 47 | + from celery.events import EventReceiver |
| 48 | + from celery.messaging import establish_connection |
| 49 | + from celery.events.state import State |
| 50 | + from myapp import DumpCam |
| 51 | + |
| 52 | + def main(): |
| 53 | + state = State() |
| 54 | + with establish_connection() as connection: |
| 55 | + recv = EventReceiver(connection, handlers={"*": state.event}) |
| 56 | + with DumpCam(state, freq=1.0): |
| 57 | + recv.capture(limit=None, timeout=None) |
| 58 | + |
| 59 | + if __name__ == "__main__": |
| 60 | + main() |
| 61 | + |
| 62 | + |
| 63 | + |
| 64 | + |
| 65 | +Tools |
| 66 | +===== |
| 67 | + |
| 68 | +celerymon |
| 69 | +========= |
| 70 | + |
| 71 | +Describe celerymon |
| 72 | + |
| 73 | +celeryev |
| 74 | +======== |
| 75 | + |
| 76 | +Describe celeryev |
| 77 | + |
| 78 | +RabbitMQ |
| 79 | +======== |
| 80 | + |
| 81 | +Describe rabbitmq tools. rabbitmqctl, Alice, etc... |
| 82 | + |
| 83 | +Django Admin |
| 84 | +============ |
| 85 | + |
| 86 | +Describe the snapshot camera django-celery ships with. |
| 87 | + |
| 88 | +Munin |
| 89 | +===== |
| 90 | + |
| 91 | +Maintain a list of related munin plugins |
0 commit comments