You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 4, 2022. It is now read-only.
Since this collector is intended to be deployed as a [marathon](https://mesosphere.github.io/marathon) app, it comes with a *lifetime* param. This defines how long the collector will run until it dies, so marathon will re-launch it, allowing easy allocation optimizations. Check the [marathon/](https://github.com/kpacha/mesos-influxdb-collector/tree/master/marathon) folder for more details on how to launch it.
6
+
Since this collector is intended to be deployed as a [marathon](https://mesosphere.github.io/marathon) app, it comes with a *lifetime* param. This defines how long the collector will run until it dies, so marathon will re-launch it, allowing easy allocation optimizations. Check the [fixtures/marathon/](https://github.com/kpacha/mesos-influxdb-collector/tree/master/fixtures/marathon) folder for more details on how to launch it.
7
+
8
+
# Goals
9
+
10
+
+ Discover the mesos cluster through `mesos-dns`
11
+
+ Collect the mesos leader stats
12
+
+ Collect the mesos master stats
13
+
+ Collect the mesos slave stats
14
+
+ Collect the marathon master stats
15
+
+ Collect the chronos task stats (TODO)
7
16
8
17
# Installing
9
18
@@ -19,27 +28,93 @@ Alternatively, if you have Go installed:
19
28
$ go get github.com/kpacha/mesos-influxdb-collector
20
29
```
21
30
22
-
# Running
31
+
# Integration with `mesos-dns`
32
+
33
+
The `mesos-influxdb-collector` is able to discover all your mesos nodes (masters and slaves) and the marathon master using the REST API exposed by the [mesos-dns](http://mesosphere.github.io/mesos-dns/) service. Check the next section for details.
34
+
35
+
# Configuration
23
36
24
37
The collector use these environmental vars:
25
38
26
-
+`INFLUXDB_DB`
27
-
+`INFLUXDB_HOST`
28
-
+`INFLUXDB_PORT`
29
39
+`INFLUXDB_USER`
30
40
+`INFLUXDB_PWD`
31
-
+`MESOS_MASTER_HOST`
32
-
+`MESOS_MASTER_PORT`
33
-
+`MESOS_SLAVE_HOST`
34
-
+`MESOS_SLAVE_PORT`
35
-
+`MARATHON_HOST`
36
-
+`MARATHON_PORT`
37
-
+`COLLECTOR_LAPSE`
38
-
+`COLLECTOR_LIFETIME`
41
+
42
+
It also requires a config file with the list of nodes to monitor or the details about the `mesos-dns` service among these other params:
43
+
44
+
+*Lapse*: time between consecutive collections. Default: 30 seconds
45
+
+*DieAfter*: duration of the running instance. Default: 1 hour
46
+
47
+
### MesosDNS
48
+
49
+
Optional. Add it if you have a `mesos-dns` service running in your mesos cluster.
50
+
51
+
```
52
+
mesosDNS {
53
+
domain = "mesos" // the domain used by the mesos-dns service
54
+
marathon = true // resolve marathon master
55
+
host = "master.mesos" // host of the mesos-dns service
56
+
port = 8123 // port of the REST API
57
+
}
58
+
```
59
+
60
+
### InfluxDB
61
+
62
+
Required.
63
+
64
+
```
65
+
influxdb {
66
+
host = "influxdb.marathon.mesos" // host of the influxdb instance
67
+
port = 8086 // port of the REST API
68
+
db = "mesos" // name of the database to use
69
+
checkLapse = 30 // ping frequency
70
+
}
71
+
```
72
+
73
+
### Mesos masters
74
+
75
+
For manual definition of some (or all) mesos masters, use the `Master` struct:
76
+
77
+
```
78
+
Master {
79
+
host = "localhost"
80
+
port = 5051
81
+
leader = true // optional
82
+
}
83
+
Master {
84
+
host = "localhost"
85
+
port = 5052
86
+
}
87
+
```
88
+
89
+
### Mesos slaves
90
+
91
+
For manual definition of some (or all) mesos slave, use the `Slave` struct:
92
+
93
+
```
94
+
Slave {
95
+
host = "localhost"
96
+
port = 5051
97
+
}
98
+
```
99
+
100
+
### Marathon instances
101
+
102
+
For manual definition of some (or all) marathon instances, use the `Marathon` struct:
103
+
104
+
```
105
+
Marathon {
106
+
host = "localhost"
107
+
port = 5052
108
+
}
109
+
```
110
+
111
+
Check [`config/configuration_test.go`](https://github.com/kpacha/mesos-influxdb-collector/blob/master/config/configuration_test.go) and [`conf.hcl`](https://github.com/kpacha/mesos-influxdb-collector/blob/master/conf.hcl) for examples.
112
+
113
+
# Running
39
114
40
115
## Dockerized version
41
116
42
-
Run the container with the default params (check the Dockerfile and overwrite whatever you need):
Tip: if you link your config file to `/go/src/github.com/kpacha/mesos-influxdb-collector/conf.hcl` you don't need to worry about that flag!
135
+
59
136
## Binary version
60
137
61
138
```
62
139
$ ./mesos-influxdb-collector -h
63
140
Usage of ./mesos-influxdb-collector:
64
-
-Id string
65
-
influxdb database (default "mesos")
66
-
-Ih string
67
-
influxdb host (default "localhost")
68
-
-Ip int
69
-
influxdb port (default 8086)
70
-
-Mmh string
71
-
mesos master host (default "localhost")
72
-
-Mmp int
73
-
mesos master port (default 5050)
74
-
-Msh string
75
-
mesos slave host (default "localhost")
76
-
-Msp int
77
-
mesos slave port (default 5051)
78
-
-d int
79
-
die after N seconds (default 300)
80
-
-l int
81
-
sleep time between collections in seconds (default 1)
82
-
-mh string
83
-
marathon host (default "localhost")
84
-
-mp int
85
-
marathon port (default 8080)
86
-
```
87
-
88
-
This is the relation between those params and the environmnetal variables listed above.
89
-
90
-
Flag | EnvVar
91
-
---- | ------
92
-
`Id` | `INFLUXDB_DB`
93
-
`Ih` | `INFLUXDB_HOST`
94
-
`Ip` | `INFLUXDB_PORT`
95
-
`Mmh` | `MESOS_MASTER_HOST`
96
-
`Mmp` | `MESOS_MASTER_PORT`
97
-
`Msh` | `MESOS_SLAVE_HOST`
98
-
`Msp` | `MESOS_SLAVE_PORT`
99
-
`mh` | `MARATHON_HOST`
100
-
`mp` | `MARATHON_PORT`
101
-
`d` | `COLLECTOR_LAPSE`
102
-
`l` | `COLLECTOR_LIFETIME`
141
+
-c string
142
+
path to the config file (default "conf.hcl")
143
+
```
103
144
104
145
The credentials for the influxdb database are accepted just as env_var (`INFLUXDB_USER` & `INFLUXDB_PWD`)
105
146
106
-
## Testing environment
107
-
108
-
In order to do a quick test of the collector, you can use one of the available mesos test environments: [playa-mesos](https://github.com/mesosphere/playa-mesos) & [mesoscope](https://github.com/schibsted/mesoscope). The other components can be deployed with public containers. Replace the `$DOCKER_IP` and `$MESOS_HOST` with the correct values. If you are running the mesoscope env, `MESOS_HOST=$DOCKER_IP`. For the playa-mesos option, `MESOS_HOST=10.141.141.10`.
109
-
110
-
```
111
-
$ docker run --name influxdb -p 8083:8083 -p 8086:8086 \
112
-
--expose 8090 --expose 8099 \
113
-
-d tutum/influxdb
114
-
$ docker run --name grafana -p 3000:3000 \
115
-
-e GF_SERVER_ROOT_URL="http://$DOCKER_IP" \
116
-
-e GF_SECURITY_ADMIN_PASSWORD=secret \
117
-
-d grafana/grafana
118
-
$ docker run --name mesos-influxdb-collector \
119
-
--link influxdb \
120
-
-e MESOS_HOST=$MESOS_HOST \
121
-
-it --rm kpacha/mesos-influxdb-collector
122
-
```
147
+
# Grafana dashboards
123
148
124
-
The `grafana` folder contains several grafana dashboard definitions. Go to the grafana website (`http://$DOCKER_IP:3000/) and, after configuring the influxdb datasource, import them and start monitoring your mesos cluster.
149
+
The `fixtures/grafana` folder contains several grafana dashboard definitions. Go to the grafana website and, after configuring the influxdb datasource, import them and start monitoring your mesos cluster.
0 commit comments