1
0

metrics-howto.rst 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. How to monitor Synapse metrics using Prometheus
  2. ===============================================
  3. 1: Install prometheus:
  4. Follow instructions at http://prometheus.io/docs/introduction/install/
  5. 2: Enable synapse metrics:
  6. Simply setting a (local) port number will enable it. Pick a port.
  7. prometheus itself defaults to 9090, so starting just above that for
  8. locally monitored services seems reasonable. E.g. 9092:
  9. Add to homeserver.yaml
  10. metrics_port: 9092
  11. Restart synapse
  12. 3: Check out synapse-prometheus-config
  13. https://github.com/matrix-org/synapse-prometheus-config
  14. 4: Add ``synapse.html`` and ``synapse.rules``
  15. The ``.html`` file needs to appear in prometheus's ``consoles`` directory,
  16. and the ``.rules`` file needs to be invoked somewhere in the main config
  17. file. A symlink to each from the git checkout into the prometheus directory
  18. might be easiest to ensure ``git pull`` keeps it updated.
  19. 5: Add a prometheus target for synapse
  20. This is easiest if prometheus runs on the same machine as synapse, as it can
  21. then just use localhost::
  22. global: {
  23. rule_file: "synapse.rules"
  24. }
  25. job: {
  26. name: "synapse"
  27. target_group: {
  28. target: "http://localhost:9092/"
  29. }
  30. }
  31. 6: Start prometheus::
  32. ./prometheus -config.file=prometheus.conf
  33. 7: Wait a few seconds for it to start and perform the first scrape,
  34. then visit the console:
  35. http://server-where-prometheus-runs:9090/consoles/synapse.html