The generate subcommand adds an option "fail-on-oid-notfound" default is "true". When "false", we print the "warn" or" error" log instead of exiting the program so that we can see all the missing oids.
example possible:
// Find all top-level nodes.
metricNodes := map[*Node]struct{}{}
for _, oid := range toWalk {
metricNode, oidType := getMetricNode(oid, node, nameToNode)
switch oidType {
case oidNotFound:
if *failOnOidNotFound {
return nil, fmt.Errorf("cannot find oid '%s' to walk", oid)
}
level.Warn(logger).Log("msg", " cannot find oid", "oid", oid)
continue
case oidSubtree:
needToWalk[oid] = struct{}{}
case oidInstance:
// Add a trailing period to the OID to indicate a "Get" instead of a "Walk".
needToWalk[oid+"."] = struct{}{}
// Save instance index for lookup.
index := strings.Replace(oid, metricNode.Oid, "", 1)
tableInstances[metricNode.Oid] = append(tableInstances[metricNode.Oid], index)
case oidScalar:
// Scalar OIDs must be accessed using index 0.
needToWalk[oid+".0."] = struct{}{}
}
metricNodes[metricNode] = struct{}{}
}