> ## Documentation Index
> Fetch the complete documentation index at: https://docs.futurex.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Advanced metrics with Prometheus and Grafana

> Step-by-step guide for integrating Prometheus and Grafana with VirtuCrypt for advanced monitoring.

This integration guide provides step-by-step instructions for setting up and configuring Prometheus and Grafana to monitor advanced metrics from the Futurex VirtuCrypt cloud-based cryptographic services. It covers the overall architecture, prerequisites, and CryptoTunnel configuration through the VirtuCrypt Intelligence Portal (VIP). The topics also include installation and setup of Prometheus and Grafana, metric references, and visualization techniques to enable real-time monitoring, alerting, and dashboarding for enhanced system reliability and compliance.

# Architecture

The overall architecture of this integration involves the following components:

* Customer Grafana
* Customer Prometheus
* CryptoTunnel Guardian
* Prometheus Proxy
* Futurex Prometheus

The following sections contain steps for
configuring each of these components.

## VirtuCrypt CryptoTunnels

In the VirtuCrypt world, trust is a two-way street. The CryptoTunnel uses three components to establish trust, starting with a private key local to your device. When you generate the PKI, which creates the private key, the system signs the key under a VirtuCrypt CA tree, the second component. The VirtuCrypt CA tree that signed the key is the authority that establishes trust between the server and the client. After the CA tree signs the private key, it becomes a signed certificate, the final component.

When you send the signed certificate through the CryptoTunnel, the server knows the certificate is signed under the VirtuCrypt CA tree and thus is authentic. That is how the server establishes trust in the application.

To establish trust in the opposite direction, from the application to the server, the server sends the server-side signed certificate to the application. The application client then validates the server identity, establishing the trusted relationship with mutual authentication.

After this handshake, you can encrypt all the data, satisfying PCS-DSS compliance requirements.

## Prometheus

Prometheus is an open-source systems monitoring and alerting toolkit. Originally developed by
SoundCloud in 2012, it is now a graduated project of the Cloud Native Computing Foundation, which is part of
the Linux Foundation and also hosts projects like Kubernetes and Fluentd.
The following list describes the main features of Prometheus:

1. **Multi-dimensional data model:** Prometheus stores all data as time series, and each time series is uniquely
   identified by its metric name and a set of key-value pairs, also known as labels.
2. **PromQL (Prometheus Query Language):** Prometheus provides a flexible query language to leverage its
   dimensional data model. PromQL allows you to select and aggregate time series data in real time.
3. **No reliance on distributed storage:** The Prometheus main unit of reliability is the individual node, which is
   fully standalone and does not depend on network storage or other remote services.
4. **Collection happens through a pull model:** Prometheus collects metrics from monitored targets by scraping HTTP
   endpoints on these targets. However, it also supports an intermediary gateway for scenarios where a pull
   model is unsuitable.
5. **Targets are discovered through service discovery or static configuration:** Prometheus employs various service discovery
   mechanisms to identify scrape targets dynamically.
6. **Multiple modes of graphing and dashboarding support:** While Prometheus provides a built-in
   expression browser for exploring metrics, it also seamlessly integrates with the graphical dashboard builder
   s such as Grafana for advanced visualization.
7. **Alerting functionality:** Prometheus has a highly flexible alerting system. It enables you to define alerting
   rules for your metrics, and if those conditions are met, it sends alert notifications through its Alertmanager
   component.

Designed for reliability, Prometheus can be the system you use during an outage to diagnose problems quickly. Many organizations use it to monitor their IT infrastructure, from microservices, containers, and Kubernetes at scale to IoT devices. It also supports a robust ecosystem of exporters for extending its monitoring capabilities.

## Grafana

Grafana is a popular open-source tool for visualizing large-scale measurement data. It provides a powerful and elegant way to create, explore, and share dashboards and data with your team and the world.

Grafana commonly helps visualize time series data for infrastructure and application analytics, but you also use it in other domains, including industrial sensors, home automation, weather, and process control. It supports various data sources, including but not limited to Prometheus, InfluxDB, Elasticsearch, AWS CloudWatch, MySQL, and PostgreSQL.

The following list describes some key features of Grafana:

1. **Dashboard and Visualizations:** Grafana provides a feature-rich data-modeling interface for creating dashboards. These dashboards can contain a variety of visualization widgets or panels (such as graphs, tables, single stats, gauges, maps, and so on). You can easily switch the visualization type to compare different visual formats of the same data.
2. **Data Source Support:** Grafana supports many databases and data sources, from time-series databases to relational databases and cloud services. You can create dashboards that pull data from multiple sources for a unified view.
3. **Alerting:** Grafana provides robust alerting functionality. You can define alert rules for your data and get notified via several channels when an alert is triggered.
4. **Annotations:** Grafana enables you to annotate graphs with rich events when something noteworthy happens. This function helps correlate the insights between different events and metrics.
5. **Dashboard Sharing:** You can share a dashboard as a link, a snapshot, a PDF, or by embedding it in other web pages. This makes it easy to collaborate with your team.
6. **Teams and Authentication:** Grafana supports user authentication, allowing you to control access to your dashboards. It also has a multi-tenant architecture, so you can set up and manage multiple independent organizations, each with its own users, dashboards, and data sources.
7. **Plugins:** Grafana features a plug-in architecture and offers various plugins that enable you to extend and customize the Grafana capabilities.

Grafana is a powerful tool for building visual dashboards to observe metrics in real-time  that various industries use widely.

## VirtuCrypt monitoring metric reference

This section provides a reference for VirtuCrypt metrics and mappings.

### V2 monitoring

The following table shows V2 monitoring metrics:

<table>
  <thead>
    <tr>
      <th>Metric Name</th>
      <th>Type</th>
      <th>Description</th>
      <th>Labels</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td><code>vc<em>ct</em>max\_connections</code></td>
      <td>Gauge int</td>
      <td><strong>CT Instance max allowed connections</strong></td>
      <td>tunnel\_id (str), company\_name (str), host (str), port (int), api\_type (str), port\_header (str), guardian\_host (str)</td>
    </tr>

    <tr>
      <td><code>vc<em>ct</em>connected\_clients</code></td>
      <td>Gauge int</td>
      <td><strong>CT Instance current connected client count</strong></td>
      <td>tunnel\_id (str), company\_name (str), host (str), port (int), api\_type (str), port\_header (str), guardian\_host (str)</td>
    </tr>

    <tr>
      <td><code>vc<em>ct</em>run\_status</code></td>
      <td>Gauge int</td>
      <td><strong>CT Instance run status</strong> ("status active" → 1 or "status inactive" → 0)</td>
      <td>tunnel\_id (str), company\_name (str), host (str), port (int), api\_type (str), port\_header (str), guardian\_host (str), status</td>
    </tr>

    <tr>
      <td><code>vc<em>ct</em>enabled\_status</code></td>
      <td>Gauge int</td>
      <td><strong>CT Instance enabled</strong> ("enabled" → 1 or "disabled" → 0)</td>
      <td>tunnel\_id (str), company\_name (str), host (str), port (int), api\_type (str), port\_header (str), guardian\_host (str)</td>
    </tr>

    <tr>
      <td><code>vc<em>ct</em>anonymous\_status</code></td>
      <td>Gauge int</td>
      <td><strong>CT Instance allows anonymous TLS</strong> ("allows anonymous" → 1 or "does not allow anonymous" → 0)</td>
      <td>tunnel\_id (str), company\_name (str), host (str), port (int), api\_type (str), port\_header (str), guardian\_host (str)</td>
    </tr>

    <tr>
      <td><code>vc<em>tls</em>cert\_expiry</code></td>
      <td>Gauge int (days)</td>
      <td><strong>CT Instance number of days until certificate expiry</strong></td>
      <td>tunnel\_id (str), company\_name (str), host (str), port (int), api\_type (str), port\_header (str), guardian\_host (str)</td>
    </tr>

    <tr>
      <td><code>vc<em>tls</em>version\_info</code></td>
      <td>Gauge float</td>
      <td><strong>CT Instance TLS version</strong> (e.g., 1.2, 1.1)</td>
      <td>tunnel\_id (str), company\_name (str), host (str), port (int), api\_type (str), port\_header (str), guardian\_host (str)</td>
    </tr>

    <tr>
      <td><code>vc<em>probe</em>success</code></td>
      <td>Gauge int</td>
      <td><strong>CT Instance port probe</strong> ("connection success" → 1 or "connection failed" → 0)</td>
      <td>tunnel\_id (str), company\_name (str), host (str), port (int), api\_type (str), port\_header (str), guardian\_host (str)</td>
    </tr>

    <tr>
      <td><code>vc<em>probe</em>duration\_seconds</code></td>
      <td>Gauge float (s)</td>
      <td><strong>CT Instance number of seconds required for connection creation</strong></td>
      <td>tunnel\_id (str), company\_name (str), host (str), port (int), api\_type (str), port\_header (str), guardian\_host (str)</td>
    </tr>

    <tr>
      <td><code>vc<em>echo</em>duration\_seconds</code></td>
      <td>Gauge float (s)</td>
      <td><strong>CT Instance echo latency in seconds</strong></td>
      <td>tunnel\_id (str), company\_name (str), host (str), port (int), api\_type (str), port\_header (str), guardian\_host (str), phase (str)</td>
    </tr>

    <tr>
      <td><code>vc<em>connection</em>error\_counter</code></td>
      <td>Gauge int</td>
      <td><strong>CT Instance connection errors</strong></td>
      <td>tunnel\_id (str), company\_name (str), host (str), port (int), api\_type (str), port\_header (str), guardian\_host (str), error\_type (str)</td>
    </tr>

    <tr>
      <td><code>vc<em>tls</em>handshake\_duration</code></td>
      <td>Gauge float (s)</td>
      <td><strong>CT Instance TLS Handshake Latency</strong></td>
      <td>tunnel\_id (str), company\_name (str), host (str), port (int), api\_type (str), port\_header (str), guardian\_host (str), error\_type (str), discovery\_error\_code (str), discovery\_error\_description (str), outgoing\_host (str), outgoing\_port (str)</td>
    </tr>
  </tbody>
</table>

### Metric usage

The following table shows metric usage metrics:

**Format**: `example_metric{label_1=0, label_2=us-east}`

<table>
  <thead>
    <tr>
      <th>Metric Name</th>
      <th>Type</th>
      <th>Description</th>
      <th>Labels</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td><code>ct<em>instance</em>port\_status</code></td>
      <td>Gauge int</td>
      <td><strong>CT Instance Port Status</strong> (open -> 1 or closed -> 0)</td>
      <td>company\_name (str), host (str), region (str), tunnel\_name (str)</td>
    </tr>

    <tr>
      <td><code>ct<em>instance</em>api\_type</code></td>
      <td>Gauge int</td>
      <td><strong>CT Instance API Type</strong> (refer to API Type Mappings table below)</td>
      <td>company\_name (str), host (str), region (str), tunnel\_name (str)</td>
    </tr>

    <tr>
      <td><code>ct<em>instance</em>service\_enabled</code></td>
      <td>Gauge int</td>
      <td><strong>CT Instance Service Enabled</strong> (True -> 1, False -> 0)</td>
      <td>company\_name (str), host (str), region (str), tunnel\_name (str)</td>
    </tr>

    <tr>
      <td><code>ct<em>instance</em>service<em>latency</em>ms</code></td>
      <td>Gauge int</td>
      <td><strong>CT Instance Service Latency in ms</strong></td>
      <td>company\_name (str), host (str), region (str), tunnel\_name (str)</td>
    </tr>

    <tr>
      <td><code>ct<em>instance</em>accepting\_connections</code></td>
      <td>Gauge int</td>
      <td><strong>CT Instance Accepting Connections</strong> (True -> 1, False -> 0)</td>
      <td>company\_name (str), host (str), region (str), tunnel\_name (str)</td>
    </tr>

    <tr>
      <td><code>ct<em>instance</em>certificate\_validity</code></td>
      <td>Gauge int</td>
      <td><strong>CT Instance Certificate Validity</strong> (refer to Certificate Validity Mappings table below)</td>
      <td>company\_name (str), host (str), region (str), tunnel\_name (str)</td>
    </tr>

    <tr>
      <td><code>ct<em>instance</em>clients<em>connected</em>total</code></td>
      <td>Gauge int</td>
      <td><strong>Total clients connected to CT instance</strong></td>
      <td>company\_name (str), host (str), region (str), \`tunnel\_name (str)</td>
    </tr>
  </tbody>
</table>

### API-type mappings

The following table shows API-type mappings:

<table>
  <thead>
    <tr>
      <th>Value</th>
      <th>Mapping</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>0</td>
      <td>"None"</td>
    </tr>

    <tr>
      <td>1</td>
      <td>"International"</td>
    </tr>

    <tr>
      <td>2</td>
      <td>"Excrypt"</td>
    </tr>

    <tr>
      <td>3</td>
      <td>"JSON"</td>
    </tr>
  </tbody>
</table>

### Certificate validity mappings

The following table shows certificate validity mappings:

<table>
  <thead>
    <tr>
      <th>Value</th>
      <th>Mapping</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>1</td>
      <td>"Max Validity"</td>
    </tr>

    <tr>
      <td>2</td>
      <td>"Under 90 Days"</td>
    </tr>

    <tr>
      <td>3</td>
      <td>"Under 60 Days"</td>
    </tr>

    <tr>
      <td>4</td>
      <td>"Under 30 Days"</td>
    </tr>

    <tr>
      <td>5</td>
      <td>"Under 7 Days"</td>
    </tr>

    <tr>
      <td>6</td>
      <td>"Expired"</td>
    </tr>
  </tbody>
</table>


## Related topics

- [VirtuCrypt integration guides overview](/Integrations/VirtuCrypt/Overview/VirtuCrypt_integration_guides_overview.md)
- [Install and configure Grafana](/Integrations/VirtuCrypt/Advanced_metrics_with_Prometheus_and_Grafana/Install_and_configure_Grafana.md)
- [Install and configure Prometheus](/Integrations/VirtuCrypt/Advanced_metrics_with_Prometheus_and_Grafana/Install_and_configure_Prometheus.md)
- [Configure the VirtuCrypt Intelligence Portal](/Integrations/VirtuCrypt/Advanced_metrics_with_Prometheus_and_Grafana/Configure_the_VirtuCrypt_Intelligence_Portal.md)
- [Before you start](/Integrations/VirtuCrypt/Advanced_metrics_with_Prometheus_and_Grafana/Before_you_start.md)
