Skip to content
This repository has been archived by the owner on Nov 9, 2024. It is now read-only.

Added label: vlanid to system_interface.go #279

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jseifeddine
Copy link

@jseifeddine jseifeddine commented Feb 9, 2024

Feature add for issue #249

@bluecmd please review 🔢

We have this tested and working in our environment for the last ~6 months, no issues to date.

@@ -64,6 +64,7 @@ func probeSystemInterface(c http.FortiHTTP, meta *TargetMetadata) ([]prometheus.
RxBytes float64 `json:"rx_bytes"`
TxErrors float64 `json:"tx_errors"`
RxErrors float64 `json:"rx_errors"`
VlanID int `json:"vlanid"`
Copy link
Author

@jseifeddine jseifeddine Feb 9, 2024

Choose a reason for hiding this comment

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

json:"vlanid" is an int, I tried keeping as string (for Prometheus metric label), but:

Error: json: cannot unmarshal number into Go struct field ifResult.Results.vlanid of type string

m = append(m, prometheus.MustNewConstMetric(mRxB, prometheus.CounterValue, ir.RxBytes, v.VDOM, ir.Name, ir.Alias, ir.Interface))
m = append(m, prometheus.MustNewConstMetric(mTxErr, prometheus.CounterValue, ir.TxErrors, v.VDOM, ir.Name, ir.Alias, ir.Interface))
m = append(m, prometheus.MustNewConstMetric(mRxErr, prometheus.CounterValue, ir.RxErrors, v.VDOM, ir.Name, ir.Alias, ir.Interface))
vlan_string := strconv.Itoa(ir.VlanID)
Copy link
Author

@jseifeddine jseifeddine Feb 9, 2024

Choose a reason for hiding this comment

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

Prometheus label must be a string, so we convert it before adding to the metric

Copy link
Author

@jseifeddine jseifeddine left a comment

Choose a reason for hiding this comment

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

Added notes

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

Successfully merging this pull request may close these issues.

1 participant