Skip to content

canonical/snap-node-cert-exporter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Snap Node Cert Exporter

The snap-node-cert-exporter is a snap for the node-cert-exporter.

Getting Started

Install the snap from snap store and start the exporter:

$ snap install node-cert-exporter

By default, the exporter listening on port 9117. You can check the metric by running:

$ curl localhost:9117/metrics

(Optional) If the system-files interface is not connected automatically, you can connect the system-files interface manually, this will allow the snap to have read access to some directories in your host's /etc (/etc/ovn and /etc/neutron in particular), which is needed for the exporter to read your certificates:

$ snap connect node-cert-exporter:etc-ovn
$ snap connect node-cert-exporter:etc-neutron

Snap Configuration

By default, the snap will read and expose the expiration information of the certificates reside in /etc/ovn and /etc/neutron with the extension of [".pem", ".crt", ".cert", ".cer", ".pfx"] to Prometheus as metrics. However, you can still fine-tune what certificates (within /etc/ovn and /etc/neutron) to be included of the exporter via the snap configuration.

You can get a list of supported snap configuration via

$ snap get node-cert-exporter

You can change the default configuration by running snap set node-cert-exporter <key>=<value>. For example, you can include the certificates without the appropriate extensions:

$ snap set node-cert-exporter include-glob="/etc/ovn/cert_host"

You can also revert to the default vaule by running snap unset node-cert-exporter <key>. For example, you can revert the include-glob option.

$ snap unset node-cert-exporter include-glob

Local Build and Testing

You need snapcraft to build the snap:

$ sudo snap install snapcraft --classic

Snapcraft also requires backend to create isolated build environment, you can choose the following two backends:

  • LXD, which creates container image build instances. It can be used inside virtual machines.
  • Multipass, which creates virtual machine build instances. It cannot be reliably used on platforms that do not support nested virtualization. For instance, Multipass will most likely not run inside a virtual machine itself.

To build the snap:

$ make build

To try the snap that was built, you can install it locally:

$ make install

To clean up, you can run:

$ make uninstall
$ make clean