Skip to content

Commit

Permalink
Merge pull request #113 from HewlettPackard/wip-print-enabled-sources
Browse files Browse the repository at this point in the history
Log to stdout what sub-components are enabled
  • Loading branch information
roclark authored Jul 26, 2017
2 parents 5d8f47b + 8d3c93f commit 6fc81e6
Showing 1 changed file with 31 additions and 10 deletions.
41 changes: 31 additions & 10 deletions lustre_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,6 @@ func main() {
)
flag.Parse()

sources.OstEnabled = *ostEnabled
sources.MdtEnabled = *mdtEnabled
sources.MgsEnabled = *mgsEnabled
sources.MdsEnabled = *mdsEnabled
sources.ClientEnabled = *clientEnabled
sources.GenericEnabled = *genericEnabled
sources.LnetEnabled = *lnetEnabled

if *showVersion {
num, err := fmt.Fprintln(os.Stdout, version.Print("lustre_exporter"))
if err != nil {
Expand All @@ -129,15 +121,44 @@ func main() {
log.Infoln("Starting lustre_exporter", version.Info())
log.Infoln("Build context", version.BuildContext())

//expand to include more sources eventually (CLI, other?)
log.Infof("Enabled Components:")
sources.OstEnabled = *ostEnabled
if sources.OstEnabled {
log.Infof(" - OST Enabled")
}
sources.MdtEnabled = *mdtEnabled
if sources.MdtEnabled {
log.Infof(" - MDT Enabled")
}
sources.MgsEnabled = *mgsEnabled
if sources.MgsEnabled {
log.Infof(" - MGS Enabled")
}
sources.MdsEnabled = *mdsEnabled
if sources.MdsEnabled {
log.Infof(" - MDS Enabled")
}
sources.ClientEnabled = *clientEnabled
if sources.ClientEnabled {
log.Infof(" - Client Enabled")
}
sources.GenericEnabled = *genericEnabled
if sources.GenericEnabled {
log.Infof(" - Generic Enabled")
}
sources.LnetEnabled = *lnetEnabled
if sources.LnetEnabled {
log.Infof(" - Lnet Enabled")
}

enabledSources := []string{"procfs", "procsys"}

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

log.Infof("Enabled sources:")
log.Infof("Available sources:")
for s := range sourceList {
log.Infof(" - %s", s)
}
Expand Down

0 comments on commit 6fc81e6

Please sign in to comment.