You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123 lines
4.5 KiB

8 years ago
8 years ago
  1. # Tendermint monitor (tm-monitor)
  2. Tendermint monitor watches over one or more [Tendermint
  3. core](https://github.com/tendermint/tendermint) applications (nodes),
  4. collecting and providing various statistics to the user.
  5. * [QuickStart using Docker](#quickstart-using-docker)
  6. * [QuickStart using binaries](#quickstart-using-binaries)
  7. * [Usage](#usage)
  8. * [RPC UI](#rpc-ui)
  9. ## QuickStart using Docker
  10. ```
  11. docker run -it --rm -v "/tmp:/tendermint" tendermint/tendermint init
  12. docker run -it --rm -v "/tmp:/tendermint" -p "46657:46657" --name=tm tendermint/tendermint
  13. docker run -it --rm --link=tm tendermint/monitor tm:46657
  14. ```
  15. ## QuickStart using binaries
  16. Linux:
  17. ```
  18. curl -L https://s3-us-west-2.amazonaws.com/tendermint/0.8.0/tendermint_linux_amd64.zip && sudo unzip -d /usr/local/bin tendermint_linux_amd64.zip && sudo chmod +x tendermint
  19. tendermint init
  20. tendermint node --app_proxy=dummy
  21. tm-monitor localhost:46657
  22. ```
  23. Max OS:
  24. ```
  25. curl -L https://s3-us-west-2.amazonaws.com/tendermint/0.8.0/tendermint_darwin_amd64.zip && sudo unzip -d /usr/local/bin tendermint_darwin_amd64.zip && sudo chmod +x tendermint
  26. tendermint init
  27. tendermint node --app_proxy=dummy
  28. tm-monitor localhost:46657
  29. ```
  30. ## Usage
  31. ```
  32. tm-monitor [-v] [-no-ton] [-listen-addr="tcp://0.0.0.0:46670"] [endpoints]
  33. Examples:
  34. # monitor single instance
  35. tm-monitor localhost:46657
  36. # monitor a few instances by providing comma-separated list of RPC endpoints
  37. tm-monitor host1:46657,host2:46657
  38. Flags:
  39. -listen-addr string
  40. HTTP and Websocket server listen address (default "tcp://0.0.0.0:46670")
  41. -no-ton
  42. Do not show ton (table of nodes)
  43. -v verbose logging
  44. ```
  45. [![asciicast](https://asciinema.org/a/105974.png)](https://asciinema.org/a/105974)
  46. ### RPC UI
  47. Run `tm-monitor` and visit [http://localhost:46670](http://localhost:46670).
  48. You should see the list of the available RPC endpoints:
  49. ```
  50. http://localhost:46670/status
  51. http://localhost:46670/status/network
  52. http://localhost:46670/monitor?endpoint=_
  53. http://localhost:46670/status/node?name=_
  54. http://localhost:46670/unmonitor?endpoint=_
  55. ```
  56. The API is available as GET requests with URI encoded parameters, or as JSONRPC
  57. POST requests. The JSONRPC methods are also exposed over websocket.
  58. ### Ideas
  59. - currently we get IPs and dial, but should reverse so the nodes dial the
  60. netmon, both for node privacy and easier reconfig (validators changing
  61. ip/port). It would be good to have both. For testnets with others we def need
  62. them to dial the monitor. But I want to be able to run the monitor from my
  63. laptop without openning ports.
  64. If we don't want to open all the ports, maybe something like this would be a
  65. good fit for us: tm-monitor agent running on each node, collecting all the
  66. metrics. Each tm-monitor agent monitors local TM node and sends stats to a
  67. single master tm-monitor master. That way we'll only need to open a single
  68. port for UI on the node with tm-monitor master. And I believe it could be
  69. done with a single package with a few subcommands.
  70. ```
  71. # agent collecting metrics from localhost (default)
  72. tm-monitor agent --master="192.168.1.17:8888"
  73. # agent collecting metrics from another TM node (useful for testing, development)
  74. tm-monitor agent --master="192.168.1.17:8888" --node="192.168.1.18:46657"
  75. # master accepting stats from agents
  76. tm-monitor master [--ton] OR [--ui] (`--ui` mode by default)
  77. # display table of nodes in the terminal (useful for testing, development, playing with TM)
  78. # --nodes="localhost:46657" by default
  79. tm-monitor
  80. # display table of nodes in the terminal (useful for testing, development, playing with TM)
  81. tm-monitor --nodes="192.168.1.18:46657,192.168.1.19:46657"
  82. ```
  83. - uptime over last day, month, year. There are different meanings for uptime.
  84. One is to constantly ping the nodes and make sure they respond to eg.
  85. /status. A more fine-grained one is to check for votes in the block commits.
  86. - show network size + auto discovery. You can get a list of connected peers at
  87. /net_info. But no single one will be connected to the whole network, so need
  88. to tease out all the unique peers from calling /net_info on all of them.
  89. Unless you have some prior information about how many peers in the net ...
  90. More: we could add `-auto-discovery` option and try to connect to every node.
  91. - input plugin for https://github.com/influxdata/telegraf, so the user is able
  92. to get the metrics and send them whenever he wants to (grafana, prometheus,
  93. etc.).
  94. Feel free to vote on the ideas or add your own by saying hello on
  95. [Slack](http://forum.tendermint.com:3000/) or by opening an issue.