Skip to content
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

Add missing LISTENING port states to the list of states reported in metrics #374

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion pkg/daemon/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ const (
MASTER
FAULTY
UNKNOWN
LISTENING
)

type masterOffsetInterface struct { // by slave iface with masked index
Expand Down Expand Up @@ -146,7 +147,7 @@ var (
Namespace: PTPNamespace,
Subsystem: PTPSubsystem,
Name: "interface_role",
Help: "0 = PASSIVE, 1 = SLAVE, 2 = MASTER, 3 = FAULTY, 4 = UNKNOWN",
Help: "0 = PASSIVE, 1 = SLAVE, 2 = MASTER, 3 = FAULTY, 4 = UNKNOWN, 5 = LISTENING",
}, []string{"process", "node", "iface"})

ProcessStatus = prometheus.NewGaugeVec(
Expand Down Expand Up @@ -665,6 +666,8 @@ func extractPTP4lEventState(output string) (portId int, role ptpPortRole) {
role = MASTER
} else if strings.Contains(output, "FAULT_DETECTED") || strings.Contains(output, "SYNCHRONIZATION_FAULT") {
role = FAULTY
} else if strings.Contains(output, "UNCALIBRATED to LISTENING") || strings.Contains(output, "SLAVE to LISTENING") {
role = LISTENING
} else {
portId = 0
}
Expand Down