Skip to content

add missing pem metrics for qfx5220 and ex4300#9

Open
surprise30 wants to merge 8 commits intomainfrom
NET-1456
Open

add missing pem metrics for qfx5220 and ex4300#9
surprise30 wants to merge 8 commits intomainfrom
NET-1456

Conversation

@surprise30
Copy link
Copy Markdown
Collaborator

No description provided.

Comment thread pkg/features/environment/collector.go Outdated
func (c *environmentCollector) Collect(client collector.Client, ch chan<- prometheus.Metric, labelValues []string) error {
c.environmentItems(client, ch, labelValues)
c.environmentPEMItems(client, ch, labelValues)
var v showVersionResult
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please extract version determination into a separate function. I'm wondering if no other place exists, that needs this already?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will put it into a separate function now. Not sure what is a good way to check if something like this is already done in the project, but fast look through pkg/.... didn't find any other usage of show version
Screenshot from 2026-03-06 13-33-17

Comment thread pkg/features/environment/collector.go Outdated
Comment thread pkg/features/environment/collector.go Outdated
}

func (c *environmentCollector) environmentItemsQFX5220(client collector.Client, ch chan<- prometheus.Metric, labelValues []string) error {
x := environmentResultQFX5220{}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please come up with a better variable name.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the work Model to the variable name.

Original struct for the feature is called "multiEngineResult" so I am trying to follow this pattern

Comment thread pkg/features/environment/collector.go Outdated
Comment thread pkg/features/environment/collector.go Outdated
Comment thread pkg/features/environment/collector.go Outdated
func (c *environmentCollector) environmentPEMItemsQFX5220(client collector.Client, ch chan<- prometheus.Metric, labelValues []string) error {
x := environmentPEMResultQFX5220{}

stateValues := map[string]int{
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see above.

Comment thread pkg/features/environment/collector.go Outdated
Comment thread pkg/features/environment/collector.go Outdated
if err != nil {
return errors.Wrap(err, "failed to run command 'show version'")
}
// QFX5220 and EX4300 have a slightly different xml for environment information, so we need to check the product model before collecting environment metrics
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm really wondering if this is not an QFX vs. EX general thing. Unfortunately we don't have access to other EX and QFX models. Well, at least we have QFX5110! Please double check!

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like QFX5220 is different from QFX5110 and each of the is different from MX304
Screenshot from 2026-03-06 13-25-00

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants