Open pixelrebel opened 1 year ago
Hi @pixelrebel,
Interesting., this is the very first time I receive a report about the collector failing to return data that way.
It is hard to say why it behaves like that. Do lmstat
changed the behaviour with some recent versions? Did you researched that?
TBH, I don't remember why I split those output here, but it should be related with some weird text parsing corner-case.
The only fear I have is that we could brake something for other users with other configurations. My 2 cents.
Guess this fixed the issue of "nothing happening", but now I'm back to the error I was getting in #76
ts=2023-11-02T19:48:39.799Z caller=flexlm_exporter.go:199 level=info msg="Starting flexlm_exporter" version="(version=, branch=non-git, revision=non-git)"
ts=2023-11-02T19:48:39.799Z caller=flexlm_exporter.go:200 level=info msg="Build context" build_context="(go=go1.20.7, platform=linux/amd64, user=myuser@0b22db3c634c, date=20231101-17:37:13, tags=netgo static_build)"
ts=2023-11-02T19:48:39.799Z caller=flexlm_exporter.go:123 level=info msg="Enabled collectors"
ts=2023-11-02T19:48:39.799Z caller=flexlm_exporter.go:134 level=info collector=lmstat
ts=2023-11-02T19:48:39.799Z caller=flexlm_exporter.go:134 level=info collector=lmstat_feature_exp
ts=2023-11-02T19:48:39.799Z caller=config.go:48 level=info msg="Loading license config file:"
ts=2023-11-02T19:48:39.799Z caller=config.go:49 level=info -=/home/myuser/config/licenses.yml
ts=2023-11-02T19:48:39.800Z caller=tls_config.go:274 level=info msg="Listening on" address=[::]:9319
ts=2023-11-02T19:48:39.800Z caller=tls_config.go:277 level=info msg="TLS is disabled." http2=false address=[::]:9319
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0x8adc72]
goroutine 68 [running]:
github.com/mjtrangoni/flexlm_exporter/collector.parseLmstatLicenseInfoServer({0xc000966000, 0x25a, 0x8000?})
/home/myuser/app/collector/lmstat.go:233 +0x232
github.com/mjtrangoni/flexlm_exporter/collector.(*lmstatCollector).collect(0xc000206730, 0xc00060bf78, 0xc0001cecc0?)
/home/myuser/app/collector/lmstat.go:426 +0x25c
github.com/mjtrangoni/flexlm_exporter/collector.(*lmstatCollector).getLmstatLicensesInfo.func1({{0xc000226834, 0x5}, {0x0, 0x0}, {0xc000238258, 0x16}, {0x0, 0x0}, {0x0, 0x0}, ...})
/home/myuser/app/collector/lmstat.go:388 +0x85
created by github.com/mjtrangoni/flexlm_exporter/collector.(*lmstatCollector).getLmstatLicensesInfo
/home/myuser/app/collector/lmstat.go:385 +0xa9
@cloudrck I guess you are missing issues up. This is not related to #80, let talk further there.
lmstat_feature_exp collector uses
lmstat -i
to gather feature expiration data. However, in my environment at least, this returns an empty result.lmstat -a -i
actually returns the desired result. It's redundant to the main lmstat collector, but it works without breaking existing functionality. I haven't submitted a PR, because this introduces a larger question: why have separate collectors? In any case here's my changes. Please let me know your thoughts.https://github.com/mjtrangoni/flexlm_exporter/compare/main...pixelrebel:flexlm_exporter:fix-feature_exp