ulranh / sapnwrfc_exporter

sapnwrfc_exporter - SAP NWRFC Exporter for Prometheus
Apache License 2.0
31 stars 6 forks source link

Cannot run exporter #5

Closed damianw2 closed 3 years ago

damianw2 commented 3 years ago

When running an exporter, i'm getting this error:

# ./sapnwrfc_exporter web
panic: interface conversion: interface {} is nil, not string

goroutine 27 [running]:
github.com/ulranh/sapnwrfc_exporter/cmd.fieldInfo.metricData(0xc0001707e0, 0x3, 0x3, 0xc000200060, 0xc0000a9078, 0x3, 0xc0000a90a8, 0x4, 0xfe1458, 0x0, ...)
        /root/sapnwrfc_exporter/cmd/exporter.go:307 +0x944
github.com/ulranh/sapnwrfc_exporter/cmd.(*Config).getRfcData(0xc000166000, 0x1, 0x0, 0xc0000a9078, 0x3, 0xc000170c00, 0x0, 0x0, 0x1)
        /root/sapnwrfc_exporter/cmd/exporter.go:256 +0x401
github.com/ulranh/sapnwrfc_exporter/cmd.(*Config).collectServersMetric.func1(0xc0000a9f44, 0xc0000ad200, 0xc000166000, 0x1, 0x0, 0xc0000a9078, 0x3, 0xc000170c00)
        /root/sapnwrfc_exporter/cmd/exporter.go:209 +0x9e
created by github.com/ulranh/sapnwrfc_exporter/cmd.(*Config).collectServersMetric
        /root/sapnwrfc_exporter/cmd/exporter.go:207 +0x166

i set the password using pw command. Config file in /root/sapnwrfc_exporter.toml:

[[Systems]]
  Name = "SMD"
  Usage = "test"
  Tags = []
  User = "ddic"
  Lang = "en"
  Client = "001"
  Server = "10.22.1.9"
  Sysnr = "00"

[[TableMetrics]]
  Name = "sap_processes"
  Help = "Number of sm50 processes"
  MetricType = "gauge"
  TagFilter = []
  AllServers = true
  FunctionModule = "TH_WPINFO"
  Table = "WPLIST"
  [TableMetrics.Params]
    SRVNAME = ""
  [TableMetrics.RowCount]
    WP_TABLE = ["dbvm", "dbvl", "ma61v", "mdup"]
    WP_TYP = ["dia", "bgd", "upd", "upd2", "spo"]
  [TableMetrics.RowFilter]
    WP_STATUS = ["on hold", "running"]

[[FieldMetrics]]
  Name = "sap_kernel_info"
  Help = "SAP kernel and db client info"
  MetricType = "gauge"
  TagFilter = []
  AllServers = true
  FunctionModule = "TH_SAPREL2"
  FieldLabels = ["kern_rel", "kern_dblib", "kern_patchlevel"]
ChernykhAN commented 3 years ago

I am getting the same error.

ulranh commented 3 years ago

When I copy the config above, I get no error and everything works fine. But I only have a Linux system to test - did you get the error with Windows or MacOs? Can you please try it without the FieldMetrics entry.

I also added a type check and updated the master branch.

ChernykhAN commented 3 years ago

I'v tested on Linux.

The error still occurs. I tryed with TableMetrics and FieldMetrics only.

sapnwrfrc_exporter]$ ./sapnwrfc_exporter web -config ./sapnwrfc_exporter.toml
panic: interface conversion: interface {} is nil, not []interface {}
goroutine 34 [running]:
github.com/ulranh/sapnwrfc_exporter/cmd.(*Config).getSrvInfo(0xc0000de000, 0x0, 0x0, 0xc0000fc360, 0x1, 0x1)
        /usr/local/sap/sapnwrfrc_exporter/cmd/exporter.go:356 +0xb8f
github.com/ulranh/sapnwrfc_exporter/cmd.(*Config).collectSystemsMetric.func1(0xc0000de000, 0x0, 0xc000200060, 0x0)
        /usr/local/sap/sapnwrfrc_exporter/cmd/exporter.go:167 +0xea
created by github.com/ulranh/sapnwrfc_exporter/cmd.(*Config).collectSystemsMetric
        /usr/local/sap/sapnwrfrc_exporter/cmd/exporter.go:162 +0x185
ulranh commented 3 years ago

I added another type check. Please check what happens now on your side.

ChernykhAN commented 3 years ago

There is no errors getting now. But host:9663 returns: 404 page not found.

ulranh commented 3 years ago

You have to run http://host:9663/metrics

ChernykhAN commented 3 years ago

Now it's working fine. Thank's