topine/ibm-spectrum-exporter

Error parsing pool parameters values when locale is not in EN.

johnnnnnnnnnnnnnn opened this issue · 4 comments

I'm getting a theese erors in my logs. It seem to have issues with collecting and/or publishing the metrics. Log entries like the one attached are generetated every time I access the published metrics. I am using your docker container with standard configs.

If I access the metrics with wget, as suggested in IBM's manual A typcial valeue will read:

"Total Volume Capacity": "821\u00a0272,08"

Parsing the metrics file with jq, the same value will be:

"Total Volume Capacity": "821 272,08",

My guess is that your code is not decoding '\u00a0' correctly.

ref: https://www.ibm.com/support/knowledgecenter/SS5R93_5.3.6/com.ibm.spectrum.sc.doc/mgr_rest_api_retrieving_cli.html

2020-06-29T06:01:05.252Z        ERROR   collector/pool.go:73    Error converting values.strconv.ParseFloat: parsing "98\u00a034340": invalid syntax
github.com/topine/ibm-spectrum-exporter/collector.(*poolCollector).Update
        /Users/apimenteldasilvatopi/github/ibm-spectrum-exporter/collector/pool.go:73
github.com/topine/ibm-spectrum-exporter/collector.(*IbmSpectrumCollector).Collect.func1
        /Users/apimenteldasilvatopi/github/ibm-spectrum-exporter/collector/collector.go:135
2020-06-29T06:01:05.252Z        ERROR   collector/pool.go:73    Error converting values.strconv.ParseFloat: parsing "241\u00a067021": invalid syntax
github.com/topine/ibm-spectrum-exporter/collector.(*poolCollector).Update
        /Users/apimenteldasilvatopi/github/ibm-spectrum-exporter/collector/pool.go:73
github.com/topine/ibm-spectrum-exporter/collector.(*IbmSpectrumCollector).Collect.func1
        /Users/apimenteldasilvatopi/github/ibm-spectrum-exporter/collector/collector.go:135
2020-06-29T06:01:05.252Z        ERROR   collector/pool.go:73    Error converting values.strconv.ParseFloat: parsing "340\u00a001361": invalid syntax
github.com/topine/ibm-spectrum-exporter/collector.(*poolCollector).Update
        /Users/apimenteldasilvatopi/github/ibm-spectrum-exporter/collector/pool.go:73
github.com/topine/ibm-spectrum-exporter/collector.(*IbmSpectrumCollector).Collect.func1
        /Users/apimenteldasilvatopi/github/ibm-spectrum-exporter/collector/collector.go:135
2020-06-29T06:01:05.252Z        ERROR   collector/pool.go:73    Error converting values.strconv.ParseFloat: parsing "382\u00a043104": invalid syntax
github.com/topine/ibm-spectrum-exporter/collector.(*poolCollector).Update
        /Users/apimenteldasilvatopi/github/ibm-spectrum-exporter/collector/pool.go:73
github.com/topine/ibm-spectrum-exporter/collector.(*IbmSpectrumCollector).Collect.func1
        /Users/apimenteldasilvatopi/github/ibm-spectrum-exporter/collector/collector.go:135
2020-06-29T06:01:05.252Z        ERROR   collector/pool.go:73    Error converting values.strconv.ParseFloat: parsing "116\u00a064281": invalid syntax
github.com/topine/ibm-spectrum-exporter/collector.(*poolCollector).Update
        /Users/apimenteldasilvatopi/github/ibm-spectrum-exporter/collector/pool.go:73
github.com/topine/ibm-spectrum-exporter/collector.(*IbmSpectrumCollector).Collect.func1
        /Users/apimenteldasilvatopi/github/ibm-spectrum-exporter/collector/collector.go:135
2020-06-29T06:01:05.252Z        ERROR   collector/pool.go:73    Error converting values.strconv.ParseFloat: parsing "223\u00a037080": invalid syntax
github.com/topine/ibm-spectrum-exporter/collector.(*poolCollector).Update
        /Users/apimenteldasilvatopi/github/ibm-spectrum-exporter/collector/pool.go:73
github.com/topine/ibm-spectrum-exporter/collector.(*IbmSpectrumCollector).Collect.func1
        /Users/apimenteldasilvatopi/github/ibm-spectrum-exporter/collector/collector.go:135
2020-06-29T06:01:05.252Z        ERROR   collector/pool.go:73    Error converting values.strconv.ParseFloat: parsing "340\u00a001361": invalid syntax
github.com/topine/ibm-spectrum-exporter/collector.(*poolCollector).Update
        /Users/apimenteldasilvatopi/github/ibm-spectrum-exporter/collector/pool.go:73
github.com/topine/ibm-spectrum-exporter/collector.(*IbmSpectrumCollector).Collect.func1
        /Users/apimenteldasilvatopi/github/ibm-spectrum-exporter/collector/collector.go:135
2020-06-29T06:01:05.252Z        ERROR   collector/pool.go:73    Error converting values.strconv.ParseFloat: parsing "438\u00a084104": invalid syntax

Hello @johnnnnnnnnnnnnnn , thanks for reporting the issue.

I will fix the parsing and release a new version.

This should not impact the other collectors, could you please confirm?

Thanks

IBM Spectrum is providing different format in this case, probably by the "locale" set in the server.

In my case I have :

"Total Volume Capacity": "424,960.00"

Not sure if we could force a locale in the API request otherwise need to find a way to parse from any format.

Our operating system has Swedish locale. I've changed the locale of the webserver in accordance with this solution: https://www.ibm.com/support/pages/node/4755507

It now works as expected.

Thanks for pointing me in the right direction!

Our operating system has Swedish locale. I've changed the locale of the webserver in accordance with this solution: https://www.ibm.com/support/pages/node/4755507

It now works as expected.

Thanks for pointing me in the right direction!

Hello,

Good that it solves the problem but anyway it would need to correctly parse the values in different formats.

Thanks