---
# System prepended metadata

title: Compte rendu de tp TSDB

---

# Compte rendu de tp TSDB
## *Théo Bérard & Anthime Huchet*

### *Open the InfluxDB 2.0 OSS Metrics dashboard and determine how many buckets are defined in the system.*
There are 3 buckets, the one we created named `local`, and 2 default system buckets : `_monitoring` and `_tasks`.

### *What is the influx command that allows you to list the available buckets?*
`./influx bucket list`
Still lists 3 buckets as we saw previousely.
```
ID			Name		Retention	Shard group duration	Organization ID	Schema Type
21a49d647294ffb9	_monitoring	168h0m0s	24h0m0s			56c65d95919bd673	implicit
3323c1b046a8bd0a	_tasks		72h0m0s		24h0m0s			56c65d95919bd673	implicit
b42529bccb4411a7	local		infinite	168h0m0s		56c65d95919bd673	implicit
```

### *What are the names of the available buckets?*
The 3 buckets are named `_monitoring`, `_tasks` and `local`. (see the output above)

Every data point has a 6 minutes interval.

### *Give the command-line used to import the data.*
```query
./influx write \
> --bucket noaa \
> --file ../NOAA_data.txt \
> --precision s
```

### *What is the beginning date of measurements? Note: you will need this information in the next questions*
The starting date is 2019/08/17

### *What is the end date of measurements?*
The ending date is 2019/09/17

### *What measurements are present in the noaa bucket?*
```
schema.measurements(bucket: "noaa")'
Result: _result
Table: keys: []
         _value:string
----------------------
              h2o_feet
                h2o_pH
           h2o_quality
       h2o_temperature
```
`h2o_feet`, `h2o_pH`, `h2o_quality` and `h2o_temperature` are the measurements in the buckets.

### *What are the fields defined in the h2o_feet measurements ?*
```
----------------------
     level description
           water_level
```

### *What are the tags keys defined in the h2o_feet measurements?*
```
----------------------
                _start
                 _stop
                _field
          _measurement
              location
```

### *What are the different values for the location tag in h2o_feet measurements?*
```  Table: keys: [location]
       location:string           _value:string
----------------------  ----------------------
          coyote_creek            coyote_creek
Table: keys: [location]
       location:string           _value:string
----------------------  ----------------------
          santa_monica            santa_monica
```


### *How many measurement points of water level are there in the h2o_feet measurement for each location?*
```
Table: keys: [_start, _stop, location]
                   _start:time                      _stop:time         location:string                  _value:int
------------------------------  ------------------------------  ----------------------  --------------------------
2018-01-01T00:00:00.000000000Z  2022-10-19T14:59:35.140641474Z            coyote_creek                       15208
Table: keys: [_start, _stop, location]
                   _start:time                      _stop:time         location:string                  _value:int
------------------------------  ------------------------------  ----------------------  --------------------------
2018-01-01T00:00:00.000000000Z  2022-10-19T14:59:35.140641474Z            santa_monica                       15308
```
We have close to 15k measurements for each location

### *Convert the h2o_feet measurement into a new h2o_meter measurement by converting the water_level values to meters.*
```query
./influx query 'from (bucket: "noaa") 
    |> range(start: 2018-01-01)
    |> filter(fn: (r)=>r.field=="water_level") 
    |> map(fn: (r) => ({r with _value: r._value * 0.3048})) 
    |> set(key: "_measurement", value: "h2o_meter")
    |> to(bucket: "noaa", org: "tp")'
```


### *Display the h2o_temperature graph. Its values are in Farenheit degrees, do a conversion to get a display in celsius degrees. Give the used query.*
```query
./influx query 'from (bucket: "noaa")
    |> range(start: 2018-01-01)
    |> filter(fn: (r)=>r.field=="degrees")
    |> map(fn: (r) => ({r with _value: (r._value - 32) * 5/9 }))
    |> set(key: "_measurement", value: "h2o_temperature_c") 
    |> to(bucket: "noaa", org: "tp")'
```

### *Screenshot of visualisation*
![](https://i.imgur.com/ui35tau.png)
