Monitoring vHSM with Grafana
Learn to monitor the performance and usage of vHSM server with Grafana.
You can gain insights into vHSM's performance and usage to support proactive incident response and understand business workloads. Operators and security teams must monitor for conditions that may impact performance or signal security issues requiring immediate attention.
Monitoring vHSM with Grafana involves these steps:
Monitor in Grafana
Prerequisites
Install Docker
Set the environment variable for
ENCLAIVE_LICENCEDownload the vHSM docker image
Download the vHSM CLl
Configure your local system for Docker
Create the required directories and set the environment variable for these paths.
mkdir -p ~/learn-vhsm-monitoring/{vhsm-config,vhsm-data} \
~/learn-vhsm-monitoring/grafana-config \
~/learn-vhsm-monitoring/prometheus-config && \
export LEARN_VHSM=~/learn-vhsm-monitoringCreate a Docker network named
learn-vhsmthat is used by all containers.
Set the environment variable for
ENCLAIVE_LICENCE.
Install vHSM server
Create a
config.jsonfile in$LEARN_VHSM/vhsm-config/that provides the configuration for the vHSM server . This config starts the vHSM server with a non-TLS TCP listener on port 8200, stores data in/vhsm/data, and enables Prometheus telemetry with 12h retention and no hostname.
Start the vHSM server in a Docker container
Install Prometheus
Define Prometheus ACL Policy
The
/sys/metricsendpoint in vHSM requires authentication. To let Prometheus access it, create aprometheus-metricsACL policy with read access to the endpoint.
The output is:
Create a token with the
prometheus-metricspolicy for Prometheus to access vHSM metrics, and save its ID to theprometheus-tokenfile in the Prometheus config directory.
Create
prometheus.ymlin$LEARN_VHSM/prometheus-config/to define avhsmscrape job with the vHSM API endpoint, token path, and server IP with port.
Pull the Prometheus image.
Start the Prometheus container using volume mounts that point to the configuration file and token file.
Verify that Prometheus is ready to receive requests.
The log should contain an entry like this one.
Install Grafana
Create a Grafana config datasource.yml file in $LEARN_VHSM/grafana-config/to set Prometheus as the data source.
Pull the latest Grafana image.
Start the Grafana container.
Verify that the Grafana container is ready.
The log should contain an entry similar to:
You can also optionally check once more to verify that all containers are up and running.
The output should resemble this example:
Monitor in Grafana
To monitor your vHSM server in Grafana UI you need to download the vhsm-test.json example file.
Open your browser and go to: http://localhost:3000
Login to Grafana with the Username:
adminand Password:admin
In the Dashboards page select New → Import
Choose one of the following:
Upload JSON file (click Upload JSON file and select your
vhsm-test.jsonfile), orPaste JSON content into the textbox.
Select the Prometheus data source when prompted.
Click Import.
You will be redirected to the imported dashboard where you can now:
View the vHSM cluster health
Monitor Audit Logs
Last updated
Was this helpful?