This repo contains the sources and the configuation files to set the Timemap monitoring service up.
The official deployment for GN4-3 is available at https://timemap.geant.org
Go to sections
-[User guide](#User guide)
-[Admin guide](#Admin guide)
-[Customization guide](#Customize Timemap)
## Contacts
For information about the tool and the code, please write to gn4-3-wp6-t1-lola@lists.geant.org
## User guide
Timemap has a minimal interface. When the user logs into the service with her home institution credentials the
GÈANT topology graph appears, as shown in the following image.

Interactions on the GUI are done by selecting an element and right-clicking on it to have the context menu pop-up.
By selecting a link and opening the context menu, data visualizations on the collected metric are shown. Just drag the mouse
pointer on the chosen metric, a new browser tab with the related time-series will open.
Link metrics are collected using RPM SNMP probes.

In the same way, by right-clicking on a node the available metric visualizations will be shown. Node metrics are collected
using TWAMP data probes.

By right-clicking on the background of the topology, a menu showing information about Timemap and the overall link to the embedded
Grafana platform appeas.

Each metric collected by Timemap have a Grafana visualization that the user can navigate to get details.

Details on a specific time interval are visible by dragging with a mouse over a portion of the reported time range.

A finer control on the range shown by each visualization can be done using the time picker menu, as shown in the following image.

For more details on the actions that you can perform over the visualizations, please refer to the official [Grafana documentation](https://grafana.com/docs/grafana/latest)
## Admin guide
This section is on how to deploy Timemap central services and probes
### Timemap architecture
Timemap uses docker containers and Telegraf agents as building blocks.
Docker containers are used in the central service facility to deliver a data lake based on InfluxDB, a visualization tool with Grafana and additional features, for like federated authentication.
Telegraf is a common tool for telemetry data collection and transport. Timemap uses custom Python plugins to fetch data from Géant routers with SNMP and from Linux servers where PerfSonar twping tool is available.
The overall Timemap architecture is shown in the following figure.
Central services run as Docker containers orchestrated by a Docker-compose specification file. To run the Timemap data lake you need to install Docker and Docker-compose on you Operating System. Any Linux distribution will work.
You can find details on how to install Docker and Docker-compose at the following links:
Central services store and process data. For a production environment we recommend running Docker containers in a VM with the following characteristics:
- 4 vCPU
- 8 GB RAM
- 20 GB storage for the VM OS
- Additional storage for time series data may vary according to the size of your network, planned data retention, and sampling frequency. In general 20 to 40 GB will be fine for a few years of data.
Current setup on Géant collects data from 35 routers and about 55 links producing 3.6 MB/day with a retention of 1 year and 5 minutes sampling quantum.
This sums to about 1.4 GB/year. With the plan to increase the sample rate up to 1 measurement per minute, the expected data storage consumption grows to 6.4 GB/year.
### Custom Docker images building
Timemap relies on a custom Docker image for delivering HTML and Javascript contents supporting Federated Authentication. In addition, an auxiliary container for initializing InfluxDB and Grafana is provided.
To build these custom images run the following helper script
Docker instances are controlled at boot time using configuration files, passing environment variables from the host to the processes inside a container.
Move to the repository folder containing the docker-compose orchestration file.
[you@host <repo location>]$sudo systemctl status telegraf
```
To update Telegraf to newer versions just update your system as usual with yum/apt package managers.
## Customize Timemap
### How to adapt landing page look and feel, Cytoscape.js
The service landing page is delivered by the Apache web service that takes also care of the eduGAIN authentication.
The files that must be modified to customize the landing page and the topology graph look and feel are
- docker_images/timemap_proxy/src/index.html
- docker_images/timemap_proxy/src/wm-functions.js
respectively.
The graph visualization and interaction are implemented using Cytoscape.js, a Javascript library.
Refer to the [Cytoscape.js official documentation](https://js.cytoscape.org/) for details.
In particular, Timemap uses the [Context Menu Extension](https://github.com/cytoscape/cytoscape.js-cxtmenu) for pop-up menus.
### How to adapt the topology graph
GÈANT network topology is parsed automatically from GraphViz data provided by Géant operation and then converted to a Cytoscape-compliant JSON data structure.
The conversion is performed by the init_timemap Docker container at service boot time.
If you want to adapt the translation script, edit the file at
Cytoscape JSON contains an array of dictionaries representing the nodes with related metadata, followed by another array of dictionaries with information
about the links connecting pairs of nodes with additional metadata if needed. For details on how Cytoscape models graphs please refer to the [Cytoscape.js official documentation](https://js.cytoscape.org/)
### How to add Grafana dashboards
To add new dashboards in Grafana, just follow the official documentation at https://grafana.com/docs/grafana/latest