How to register an SNMP device type

In the current setting, a type of device using SNMP is configured by uploading MIBs and defining a MeasurementDevice custom resource. The operator generates SNMP module config (snmp.yml) and triggers a reload of chantico-snmp. In our First use-case (see goal.md) this corresponds to the registerPDU phase.

  1. Upload the MIBS:
    1. If you have created the cluster using the local development setup howto, you can use make cluster-mibs to copy all the MIB files in the dev/mibs folder into the persistent volume claim.
    2. Otherwise, browse to the filebrowser. Either use the port-forward from the kind-config (if you have a KinD cluster) or use the port-forward command:
      kubectl port-forward -n chantico deployment/chantico-filebrowser 18888:80
    3. Login with (user: admin, password: admin)
    4. Upload your MIBS files in snmp/mibs
  2. Create the MeasurementDevice matching the required type of MeasurementDevice
    1. Create a measurement_device.yaml file

        apiVersion: chantico-project.github.io/v1alpha1
        kind: MeasurementDevice
        metadata:
          labels:
            app.kubernetes.io/name: chantico
            app.kubernetes.io/managed-by: kustomize
          name: example-measurement-device
          namespace: chantico
        spec:
          auth:
            community: public
            version: 2
          walks:
            - sdbDevInKWhTotal
    2. Apply the yaml file

      kubectl apply -f measurement_device.yaml
  3. Verify the new device setting
    1. Wait for the SNMP generator job to complete
      kubectl get jobs -n chantico | grep update-snmp
    2. The generated config is stored on the shared volume at snmp/yml/snmp.yml.
    3. Port-forward the SNMP exporter
      kubectl port-forward -n chantico deployment/chantico-snmp 9116:9116
    4. Check that the config (http://localhost:9116/config) include the registered device as a module