karimra / srl-prometheus-exporter

Prometheus exporter for Nokia SR Linux running as a native NDK App
7 stars 1 forks source link

SRL 24.x compatibility: gNMI paths and clab example #74

Open sacckth opened 4 months ago

sacckth commented 4 months ago

on app/server.go following change needs to happen:

--- a/app/server.go
+++ b/app/server.go
@@ -37,7 +37,7 @@ const (
        metricNameRegex      = "[^a-zA-Z0-9_]+"
        serviceName          = "srl-prometheus-exporter"
        retryInterval        = 2 * time.Second
-       gnmiServerUnixSocket = "unix:///opt/srlinux/var/run/sr_gnmi_server"
+       gnmiServerUnixSocket = "unix:///opt/srlinux/var/run/sr_grpc_server_insecure-mgmt"
 )

Some of the acls need to be changed for this to work on 24 release:

updates:

- path: /system/grpc-server[name=insecure-mgmt]
  encoding: json_ietf
  value:
    admin-state: enable
    metadata-authentication: false
    services:
      - gnmi

- path: /acl/acl-filter[name=cpm][type=ipv4]/entry[sequence-id=281]
  encoding: json_ietf
  value:
    action:
      accept: {}
    match:
      ipv4:
        protocol: tcp
      transport:  
        destination-port:
          range:
            start: 8000
            end: 9999

- path: /acl/acl-filter[name=cpm][type=ipv4]/entry[sequence-id=282]
  encoding: json_ietf
  value:
    action:
      accept: {}
    match:
      ipv4:
        protocol: tcp
      transport:  
        source-port:
          range:
            start: 8000
            end: 9999
sacckth commented 4 months ago

Also the chassis-mac address path:

--- a/app/server.go
+++ b/app/server.go
@@ -726,7 +726,7 @@ START:
                                if strings.Contains(p, "platform/chassis/type") {
                                        sysInfo.ChassisType = u.GetVal().GetStringVal()
                                }
-                               if strings.Contains(p, "platform/chassis/mac-address") {
+                               if strings.Contains(p, "platform/chassis/hw-mac-address") {
                                        sysInfo.ChassisMacAddress = u.GetVal().GetStringVal()
sacckth commented 4 months ago

Also system hostname:

@@ -717,7 +717,7 @@ START:
                                                sysInfo.IPAddrV6 = strings.Split(ip, "/")[0]
                                        }
                                }
-                               if strings.Contains(p, "system/name") {
+                               if strings.Contains(p, "system/name/host-name") {
                                        sysInfo.Name = u.GetVal().GetStringVal()
                                }
sacckth commented 4 months ago

And some metrics under app/metric.go