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

Ignored command line flags? #109

Closed
mtds opened this issue Jul 24, 2017 · 5 comments
Closed

Ignored command line flags? #109

mtds opened this issue Jul 24, 2017 · 5 comments

Comments

@mtds
Copy link

mtds commented Jul 24, 2017

Hi all.

It's surely possible I am misunderstanding something and doing some silly mistake
but it looks to me than whenever I specify the '-collector.*' options on the command
line those flags are ignored. I am using the latest sources from the master branch.

Example:

/usr/local/bin# ./lustre_exporter -collector.ost true
INFO[0000] Starting lustre_exporter (version=1.0.0-rc.1, branch=master, revision=35894131aa5bef1d01a94c8a0c64c37cdc5ffaaf)  source="lustre_exporter.go:129"
INFO[0000] Build context (go=go1.8.3, user=myuser@myhost, date=20170724-10:21:35)  source="lustre_exporter.go:130"
INFO[0000] Enabled sources:                              source="lustre_exporter.go:140"
INFO[0000]  - procfs                                     source="lustre_exporter.go:142"
INFO[0000]  - procsys                                    source="lustre_exporter.go:142"
INFO[0000] Listening on :9169                            source="lustre_exporter.go:163"

On the other hand, teh '-web.listen-address' works as expected:

/usr/local/bin# ./lustre_exporter -web.listen-address ":9168"
INFO[0000] Starting lustre_exporter (version=1.0.0-rc.1, branch=master, revision=35894131aa5bef1d01a94c8a0c64c37cdc5ffaaf)  source="lustre_exporter.go:129"
INFO[0000] Build context (go=go1.8.3, user=myuser@myhost, date=20170724-10:21:35)  source="lustre_exporter.go:130"
INFO[0000] Enabled sources:                              source="lustre_exporter.go:140"
INFO[0000]  - procfs                                     source="lustre_exporter.go:142"
INFO[0000]  - procsys                                    source="lustre_exporter.go:142"
INFO[0000] Listening on :9168                            source="lustre_exporter.go:163"

I'm no Golang export but looking into the lustre_exporter.go source code I saw the following
code (lines 129-145):

[...]
        log.Infoln("Starting lustre_exporter", version.Info())
        log.Infoln("Build context", version.BuildContext())
  
        //expand to include more sources eventually (CLI, other?)
       enabledSources := []string{"procfs", "procsys"}
       sourceList, err := loadSources(enabledSources)

        if err != nil {
                  log.Fatalf("Couldn't load sources: %q", err)
        }

        log.Infof("Enabled sources:")
        for s := range sourceList {
                   log.Infof(" - %s", s)
        } 
       prometheus.MustRegister(LustreSource{sourceList: sourceList})
[...]

It looks like sourcesList is set through enabledSources, which contains just "procfs" and "procsys"
(so no command line flags argument are taken into considerations).

Does it mean should I enable the options editing the source code and changing enabledSources
by hand?

Is that the meaning of the comment (expand to include more sources eventually (CLI, other))
or am I mistaken?

@roclark
Copy link
Contributor

roclark commented Jul 24, 2017

Thanks for reaching out @mtds! Do you mind providing a little more context on your question so that I can be of further assistance? More precisely, what were you expecting to happen when you enabled the ost flag? At present, no information is changed in the log statements when you use the collector* flags. The only changes are found in the actual metrics you see. For example, setting -collector.ost true enables collection of all of the OST metrics initialized in sources/procfs.go. Please note that all of the collector* flags are enabled by default, so setting one to true won't differ from the default behavior.

I am definitely open to changing the collector flag behavior if this is non-intuitive or if a more user-friendly method is desired.

@mtds
Copy link
Author

mtds commented Jul 24, 2017

Hi @roclark.

Thanks for your quick reply. Sorry, I guess I was too quick in open this issue: I was just expecting to see
the list of the enabled sources in the output of the exporter, once I have started it.

I have read that all those flags should be enabled by default but since I did not see any mention of the -collector.* in the output I thought something was wrong. Then I tried to get a list of the available metrics
from the command line but the exporter simply crashed (see issue #110).

Anyway, It would be great if you can add the list of all the enabled flags in the output but maybe it would just be a 'cosmetic' change, so nothing particularly important for this code base.

@joehandzik
Copy link
Contributor

@mtds, that's a reasonable ask. We can definitely list the active/enabled components out!

@roclark
Copy link
Contributor

roclark commented Jul 24, 2017

Thanks for the clarification! @joehandzik and I had an offline discussion of this as well and we agree. I see value in adding output to the log as well as updating the README to make this more clear.

@mtds
Copy link
Author

mtds commented Jul 24, 2017

Ok, thanks @roclark and @joehandzik !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants