Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
johnnnnnnnnnnnnnn opened this issue Jun 29, 2020 · 4 comments
Open
Labels
enhancement New feature or request

Comments

@johnnnnnnnnnnnnnn
Copy link

johnnnnnnnnnnnnnn commented Jun 29, 2020

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
@topine
Copy link
Owner

topine commented Jul 1, 2020

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

@topine
Copy link
Owner

topine commented Jul 1, 2020

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.

@johnnnnnnnnnnnnnn
Copy link
Author

johnnnnnnnnnnnnnn commented Jul 1, 2020

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!

@topine topine added the enhancement New feature or request label Jul 2, 2020
@topine topine changed the title Error parsing vaules Error parsing pool parameters values when locale is not in EN. Jul 2, 2020
@topine
Copy link
Owner

topine commented Jul 2, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants