-
Notifications
You must be signed in to change notification settings - Fork 83
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
Added label: vlanid to system_interface.go #279
base: master
Are you sure you want to change the base?
Conversation
c8ceb13
to
3714c6d
Compare
@@ -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"` |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added notes
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.