---
description: >-
  Lens AI server is used for monitoring the data and model drift and access the
  sampled data.
---

# Step 3: Monitoring the Metrics on the Lens AI Server.

<figure><img src="https://1293874244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaBxpe4kLU8KyHMlQtPS1%2Fuploads%2FY3hY5nXKsLMT5WFzTf2f%2FScreenshot%202024-07-06%20at%2011.48.05.png?alt=media&#x26;token=5ba904b0-696a-47f4-a7a2-882db95b0a3d" alt=""><figcaption></figcaption></figure>

### Lens AI monitoring server Components

The Lens AI Server comprises five major components:

1. Lens AI Sensor Data Handler: Manages sensor HTTP requests and stores incoming sensor data.
2. Lens AI Workers: Aggregates, transforms, and extracts metric data from sensor inputs for analysis.
3. Lens AI GraphQL Server: Provides a GraphQL endpoint to fetch the aggregated metrics, enabling flexible and efficient data retrieval.
4. Lens AI Monitoring Server: Uses Grafana to build interactive dashboards for monitoring key metrics.
5. Lens AI Database: Utilizes MongoDB to store sensor data and metrics for persistent and scalable storage.

### **Lens AI Usage**

```
git clone https://github.com/lens-ai/lensai_server
```

#### Server Configuration

```
nano config.ini 
```

#### Build the docker containers

```
docker-compose up --build -d 
```

### Lens AI server Configuration

Adjust the config file based on the proejct requirements mainly . Please don't change the DB collection names.

* \[DEFAULT]
* PROJECT\_ID = your project id
* SLEEP\_INTERVAL = 10 (Sleep interv of the workers)
* NUM\_WORKERS = 1 (Number of worker threads)
* \[paths]
* BASE\_PATH = /tmp (Base path is the path under which the data is mounted on the container)

### Lens AI sensor data handler&#x20;

The sensor data handler runs on port 8000 and can be accessed at [http://localhost:8000](http://localhost:8000/) on the host machine. To change the host port, modify the docker-compose.yml file to your preferred port.

### Lens AI Dashboard:

The Lens AI Dashboard is accessible on port 3000 on the host machine. Access it via [http://localhost:3000](http://localhost:3000/).

#### Screenshots of the Dashboard

<figure><img src="https://1293874244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaBxpe4kLU8KyHMlQtPS1%2Fuploads%2F4lvGyOW99xitIoG27ovL%2FDashboard_1.png?alt=media&#x26;token=cfd5b288-7ffe-4754-b92d-8dea7307283d" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1293874244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaBxpe4kLU8KyHMlQtPS1%2Fuploads%2FsZiyl6da0cZAvQoO39by%2FDashboard_3.png?alt=media&#x26;token=dac8f5fc-eea6-42d1-a0ee-401159c2f022" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1293874244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaBxpe4kLU8KyHMlQtPS1%2Fuploads%2FcLpgZcQKWIUfHwxRFVmk%2FDashboard_2.png?alt=media&#x26;token=999b654d-88fd-4b05-af21-37b196d525fe" alt=""><figcaption></figcaption></figure>

