One want to expose Harbor metrics, needed for operators and administrators to monitor how your Harbor instance is running in real time
Operation manager v3.x
Harbor tile v2.x
VMware Tanzu Kubernetes Grid Integrated Edition v1.x
Follow below steps to enable/expose metrics on harbor:-
a) If Internet is enabled on jumpbox where we can run bosh command then you can run below command directly to upload release:-
bosh upload-release https://bosh.io/d/github.com/cloudfoundry/os-conf-release?v=22.2.1 --sha1 daf34e35f1ac678ba05db3496c4226064b99b3e4
b) If no internet then you have to download the release from https://bosh.io/releases/github.com/cloudfoundry/os-conf-release?all=1 and upload the tar file.
bosh upload-release <PATH_OF_THE_TAR_FILE>
Then create runtime-config file with name "runtime.yml" . Update the harbor deployment name under "deployments" in below config file.
releases:
- name: "os-conf"
version: "22.1.3"
addons:
- name: os-configuration
jobs:
- name: pre-start-script
release: os-conf
properties:
script: |-
#!/bin/bash
harbor_config="/var/vcap/jobs/harbor/config/harbor.yml"
static_port=9090
if [ -f "${harbor_config}" ]; then
if [ grep -q $static_port $harbor_config ] ; then
echo "metric parameter is already present"
else
echo -e "\nmetric:\n "enabled: true"\n "port: 9090"\n "path: /metrics"" >> ${harbor_config}
fi
fi
include:
deployments: harbor-container-registry-XXXXXXXXX # you can define which deployments would be applied this runtime config.
bosh update-runtime-config runtime.yml
metric:
enabled: true
port: 9090
path: /metrics
curl -v -k http://<HARBOR_IP>:9090/metrics