Wobserver
Web based metrics, monitoring, and observer
Install / Use
/learn @shinyscorpion/WobserverREADME
Wobserver
Web based metrics, monitoring, and observer.
We are talking about :wobserver at ElixirConf 2017. Check out the presentation and samples and our other talk about Task Bunny.
<a href="http://imgur.com/a/44TR5" target="_blank"><img src="http://i.imgur.com/9rybvU2.gif" alt="Click to see more images." width="210" height="250" /></a>
Functionality:
- Drop-in monitoring though web interface.
- Metrics endpoint (
/metrics) for system monitoring. (Default: Prometheus) - Monitoring automation through JSON API.
- Node management and discovery behind firewalls and load balancers.
- Easy to extend:
- Add custom metrics and pages for your project, just by adding them in the config.
- Just 3 lines of code to add pages/metrics for your library, when users have
:wobserverinstalled. (See how.)
Table of contents
- wobserver
- Table of contents
- Installation
- Usage
- Configuration
- Library Integration
- Improvements
- Contributors
- license
Installation
Hex
Add Wobserver as a dependency to your mix.exs file:
def deps do
[{:wobserver, "~> 0.1"}]
end
and add it to your list of applications:
def application do
[applications: [:wobserver]]
end
Then run mix deps.get in your shell to fetch the dependencies.
Note: Check out plug mode to integrate with a Phoenix or other web application. (Prevents startup of separate web server.)
Build manually
Run the following commands to build the project:
$ npm install
$ mix deps.get
$ mix build
Note: Use the package generated by mix build if you want to include the local wobserver in your application.
(Unpack in your deps.)
Github
Wobserver does not support being included directly from github. The required assets are not included in the repo in build form and can therefore not be used. It is possible to build locally and use the generated package. (See Build manually for more information.)
Usage
Browser
To view the web interface just enter http://<host>[:<port>]/ in the browser and it should show the :wobserver interface.
The default port is 4001, but the port can be changed in the configuration.
A sample interface can be viewed here.
API
The API can be accessed by calling http://<host>[:<port>]/api/.
The index will return 404, but specific endpoints should return results.
<a name="remote-nodes"></a> Remote nodes
The API provides a list of remote nodes by calling http://<host>[:<port>]/api/nodes.
The API of remote nodes can be accessed by calling the API endpoint and prefixing the node name, host, or host:port.
For example considering the following node list:
[
{
"port": 4001,
"name": "node_prime",
"local?": true,
"host": "192.168.5.55"
},
{
"port": 80,
"name": "remote",
"local?": false,
"host": "80.23.1.165"
}
]
The following calls would all work for the first node:
(local is a reserved name that always points to the local node.)
http://<host>[:<port>]/api/local/system
http://<host>[:<port>]/api/node_prime/system
http://<host>[:<port>]/api/192.168.5.55/system
http://<host>[:<port>]/api/192.168.5.55:4001/system
And these calls would work for the second node:
http://<host>[:<port>]/api/remote/system
http://<host>[:<port>]/api/80.23.1.165/system
http://<host>[:<port>]/api/80.23.1.165:80/system
<a name="system"></a> System
The API provides a list of system information by calling http://<host>[:<port>]/api/system.
The scheduler is a list of load values (0-1) for each scheduler.
Example:
{
"statistics": {
"uptime": 459876,
"process_total": 122,
"process_running": 0,
"process_max": 262144,
"output": 1259201,
"input": 12945380
},
"scheduler": [
0.0037370416873916392,
0.0003088661849770247,
0.0003072993680801981,
0.00030274231847091137,
0.0004706952361156354,
0.00028556537348788645,
0.00025471141618606366,
0.0002522242536713918
],
"memory": {
"total": 30275576,
"process": 5242800,
"ets": 886544,
"code": 13635797,
"binary": 288744,
"atom": 594561
},
"cpu": {
"schedulers_online": 8,
"schedulers_available": 8,
"schedulers": 8,
"logical_processors_online": 8,
"logical_processors_available": "unknown",
"logical_processors": 8
},
"architecture": {
"wordsize_internal": 8,
"wordsize_external": 8,
"threads": true,
"thread_pool_size": 10,
"system_architecture": "x86_64-apple-darwin15.6.0",
"smp_support": true,
"otp_release": "19",
"kernel_poll": false,
"erts_version": "8.2",
"elixir_version": "1.4.0"
}
}
<a name="allocators"></a> Allocators
The API provides a list of allocators and their size by calling http://<host>[:<port>]/api/allocators.
Example:
[
{
"type": "sl_alloc",
"carrier": 294912,
"block": 664
},
{
"type": "std_alloc",
"carrier": 1081344,
"block": 498184
},
{
"type": "ll_alloc",
"carrier": 35913728,
"block": 26080144
},
{
"type": "eheap_alloc",
"carrier": 9830400,
"block": 2634720
},
{
"type": "ets_alloc",
"carrier": 3178496,
"block": 890880
},
...
]
<a name="application"></a> Application
The API provides a list of applications and their descriptions by calling http://<host>[:<port>]/api/application.
The information for a specific application, including the process hierarchy can be found by calling http://<host>[:<port>]/api/application/<application-name>.
Example:
http://localhost:4001/api/application
[
{
"version": "0.1.0",
"name": "wobserver",
"description": "Web based metrics, monitoring, and observer."
},
{
"version": "1.3.0",
"name": "plug",
"description": "A specification and conveniences for composable modules between web applications"
},
{
"version": "1.1.0",
"name": "cowboy",
"description": "Small, fast, modular HTTP server."
},
{
"version": "1.2.1",
"name": "ranch",
"description": "Socket acceptor pool for TCP protocols."
},
{
"version": "0.6.1",
"name": "credo",
"description": "A static code analysis tool for the Elixir language with a focus on code consistency and teaching."
},
{
"version": "0.2.0",
"name": "bunt",
"description": "256 color ANSI coloring in the terminal"
},
{
"version": "1.6.5",
"name": "hackney",
"description": "simple HTTP client"
},
{
"version": "1.4.0",
"name": "logger",
"description": "logger"
},
...
]
http://localhost:4001/api/application/elixir
{
"pid": "#PID<0.59.0>",
"name": "<0.59.0>",
"meta": {
"status": "waiting",
"init": "proc_lib.init_p/5",
"current": "application_master.main_loop/2",
"class": "application"
},
"children": [
{
"pid": "#PID<0.60.0>",
"name": "<0.60.0>",
"meta": {
"status": "waiting",
"init": "application_master.start_it/4",
"current": "application_master.loop_it/4",
"class": "unknown"
},
"children": [
{
"pid": "#PID<0.61.0>",
"name": "elixir_sup",
"meta": {
"status": "waiting",
"init": "proc_lib.init_p/5",
"current": "gen_server.loop/6",
"class": "supervisor"
},
"children": [
{
"pid": "#PID<0.62.0>",
"name": "elixir_config",
"meta": {
"status": "waiting",
"init": "proc_lib.init_p/5",
"current": "gen_server.loop/6",
"class": "gen_server"
},
"children": []
},
{
"pid": "#PID<0.63.0>",
"name": "elixir_code_server",
"meta": {
"status": "waiting",
"init": "proc_lib.init_p/5",
