<commit_before># mesos-task-exporter

Export metrics of tasks running on [Apache Mesos](http://mesos.apache.org/) to [Prometheus](http://prometheus.io/).

## Features

* Auto-discover of new slaves
* Auto-discover of new tasks
* Stateless - can run anywhere
* Framework-independent

## Metrics

### Exported metrics

* `mesos_task_cpus_system_time_seconds`
* `mesos_task_cpus_system_usage`
* `mesos_task_cpus_total_usage`
* `mesos_task_cpus_user_time_seconds`
* `mesos_task_cpus_user_usage`
* `mesos_task_mem_limit_bytes`
* `mesos_task_mem_rss_bytes`

Metrics with the suffix `_usage` are calculated in the same way as done by the Mesos WebUI.

### Labels

Every metric has the following labels attached to it:

* `executor_id` - The unique ID of the executor
* `framework` - The name of the framework that spawned the task
* `slave_pid` - The PID of the Mesos slave that the task is running on as exposed by the `/master/state.json` endpoint of the Mesos master
* `task` - The name of the task

#### [Chronos](https://github.com/mesos/chronos) example

```
mesos_task_cpus_system_time_seconds{executor_id="ct:1426247880000:0:examplejob:",framework="chronos-2.3.2_mesos-0.20.1-SNAPSHOT",slave_pid="slave(1)@10.168.1.11:5051",task="ChronosTask:examplejob"} 0.02
```

#### [Marathon](https://github.com/mesosphere/marathon) example

```
mesos_task_cpus_system_time_seconds{executor_id="com_example_redis.b8f17462-c96c-11e4-b9ff-56847afe9799",framework="marathon",slave_pid="slave(1)@10.168.1.11:5051",task="redis.example.com"} 10.71
```

## Configuration

```
$ ./mesos-task-exporter -h
Usage of ./mesos-task-exporter:
  -exporter.address=":55555": Address of the exporter
  -exporter.endpoint="/metrics": Path where metrics are served
  -log.level="info": Log level
  -mesos.master-pollinterval=15s: Interval to poll the Mesos master leader for new slaves
  -mesos.masters="http://localhost:5050": A list of Mesos masters separated by commas
  -mesos.slave-pollinterval=15s: Interval to poll a Mesos slave for stats of tasks
```

## Deployment


<commit_msg>Add 'Deployment' and example of prometheus.conf<commit_after># mesos-task-exporter

Export metrics of tasks running on [Apache Mesos](http://mesos.apache.org/) for [Prometheus](http://prometheus.io/) consumption.

## Features

* Auto-discover of new slaves
* Auto-discover of new tasks
* Stateless - can run anywhere
* Framework-independent

## Metrics

### Exported metrics

* `mesos_task_cpus_system_time_seconds`
* `mesos_task_cpus_system_usage`
* `mesos_task_cpus_total_usage`
* `mesos_task_cpus_user_time_seconds`
* `mesos_task_cpus_user_usage`
* `mesos_task_mem_limit_bytes`
* `mesos_task_mem_rss_bytes`

Metrics with the suffix `_usage` are calculated in the same way as done by the Mesos WebUI.

### Labels

Every metric has the following labels attached to it:

* `executor_id` - The unique ID of the executor
* `framework` - The name of the framework that spawned the task
* `slave_pid` - The PID of the Mesos slave that the task is running on as exposed by the `/master/state.json` endpoint of the Mesos master
* `task` - The name of the task

#### [Chronos](https://github.com/mesos/chronos) labels example

```
mesos_task_cpus_system_time_seconds{executor_id="ct:1426247880000:0:examplejob:",framework="chronos-2.3.2_mesos-0.20.1-SNAPSHOT",slave_pid="slave(1)@10.168.1.11:5051",task="ChronosTask:examplejob"} 0.02
```

#### [Marathon](https://github.com/mesosphere/marathon) labels example

```
mesos_task_cpus_system_time_seconds{executor_id="com_example_redis.b8f17462-c96c-11e4-b9ff-56847afe9799",framework="marathon",slave_pid="slave(1)@10.168.1.11:5051",task="redis.example.com"} 10.71
```

## Configuration

```
$ ./mesos-task-exporter -h
Usage of ./mesos-task-exporter:
  -exporter.address=":55555": Address of the exporter
  -exporter.endpoint="/metrics": Path where metrics are served
  -log.level="info": Log level
  -mesos.master-pollinterval=15s: Interval to poll the Mesos master leader for new slaves
  -mesos.masters="http://localhost:5050": A list of Mesos masters separated by commas
  -mesos.slave-pollinterval=15s: Interval to poll a Mesos slave for stats of tasks
```

```
# prometheus.conf
job: {
  name: "mesos_task_exporter"
  scrape_interval: "15s"

  target_group: {
    target: "http://localhost:55555/metrics"
  }
}
```

## Deployment

Run `mesos-task-exporter` as a Docker container:

```
docker run -p 55555:55555 -e "MESOS_MASTERS=..." wandhydrant/mesos-task-exporter
```

{'fraction_non_alphanumeric': 0.1283542039355993, 'fraction_numerical': 0.04315742397137746, 'mean_word_length': 5.362731152204836, 'pattern_counts': {'":': 10, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4566102', 'n_tokens_mistral': 1716, 'n_tokens_neox': 1583, 'n_words': 368}