# How to monitor Spring Cloud Task
The `task-demo-metrics-influx` project creates a sample Spring Cloud Task (and Spring Batch) with the monitoring infrastructure, so it can be monitored in Spring Cloud Data Flow.
## Create custom Spring Cloud Task
If you use the provided `task-demo-metrics-influx` source code you can skip this section.
Otherwise follow the instructions below to build your own `monitorable` Task from scratch.
Bootstrap by follow the [Task development instructions](https://docs.spring.io/spring-cloud-task/docs/2.0.0.RELEASE/reference/htmlsingle/#getting-started-developing-first-task) and then:
* Set the parent POM version of Boot to 2.2.1.RELEASE or latest
```xml
org.springframework.boot
spring-boot-starter-parent
2.2.1.RELEASE
```
* Make sure that `spring-cloud-dependencies` version `Hoxton.RC1` or newer are imported:
```xml
org.springframework.cloud
spring-cloud-dependencies
Hoxton.RC1
pom
import
```
* Add dependencies to enable the `Spring Cloud Task` (and optionally `Spring Task Batch`) functionality and to configure the jdbc dependencies for the task repository.
Use version `2.2.0.RC1` or newer!
```xml
org.springframework.cloud
spring-cloud-starter-task
2.2.0.RC1
org.springframework.cloud
spring-cloud-task-core
2.2.0.RC1
org.springframework.cloud
spring-cloud-task-batch
2.2.0.RC1
org.springframework.cloud
spring-cloud-task-stream
2.2.0.RC1
org.springframework.cloud
spring-cloud-task-dependencies
2.2.0.RC1
pom
import
```
* Add dependencies to configure the jdbc dependencies for the task repository:
```xml
org.springframework.boot
spring-boot-starter-jdbc
org.mariadb.jdbc
mariadb-java-client
runtime
```
* Add dependencies to configure Micrometer integration:
The Micrometer library uses the actuator internally:
```xml
org.springframework.boot
spring-boot-starter-actuator
```
To enable InfuxDB metrics add the following dependencies in place of the prometheus one:
```xml
io.micrometer
micrometer-registry-influx
```
## Build
Run
```
./mvnw clean install
```
Will produce `task-demo-metrics-influx-2.0.0-SNAPSHOT.jar` task application under the `target` folder.
## Spring Cloud Data FLow server
Follow the [Task Monitoring](https://dataflow.spring.io/docs/feature-guides/batch/monitoring) instructions to register, run and monitor the task sample using Influx or Prometheus on the desired platform.
## Docker images
Build and publish docker image
```
./mvnw clean install docker:build
./mvnw docker:push
```