Skip to content

Commit

Permalink
Updates in response to changes requested
Browse files Browse the repository at this point in the history
Meaningful name for BridgeRemote metrics
Remove HW specific redundancy role metric
  • Loading branch information
dwray authored and GreenRover committed Sep 12, 2024
1 parent fb11e36 commit bb43954
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 21 deletions.
16 changes: 8 additions & 8 deletions semp/getBridgeRemoteSemp1.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,14 @@ func (e *Semp) GetBridgeRemoteSemp1(ch chan<- PrometheusMetric, vpnFilter string
vpnName := bridge.LocalVpnName
remoteVpnName := bridge.ConnectedRemoteVpnName
remoteRouter := bridge.ConnectedRemoteRouterName
ch <- e.NewMetric(MetricDesc["BridgeRemote"]["bridge_r_admin_state"], prometheus.GaugeValue, encodeMetricMulti(bridge.AdminState, []string{"Enabled", "Disabled", "-", "N/A"}), vpnName, bridgeName, remoteVpnName, remoteRouter)
ch <- e.NewMetric(MetricDesc["BridgeRemote"]["bridge_r_connection_establisher"], prometheus.GaugeValue, encodeMetricMulti(bridge.ConnectionEstablisher, []string{"NotApplicable", "Local", "Remote", "Invalid"}), vpnName, bridgeName, remoteVpnName, remoteRouter)
ch <- e.NewMetric(MetricDesc["BridgeRemote"]["bridge_r_inbound_operational_state"], prometheus.GaugeValue, encodeMetricMulti(bridge.InboundOperationalState, opStates), vpnName, bridgeName, remoteVpnName, remoteRouter)
ch <- e.NewMetric(MetricDesc["BridgeRemote"]["bridge_r_inbound_operational_failure_reason"], prometheus.GaugeValue, encodeMetricMulti(bridge.InboundOperationalFailureReason, failReasons), vpnName, bridgeName, remoteVpnName, remoteRouter)
ch <- e.NewMetric(MetricDesc["BridgeRemote"]["bridge_r_outbound_operational_state"], prometheus.GaugeValue, encodeMetricMulti(bridge.OutboundOperationalState, opStates), vpnName, bridgeName, remoteVpnName, remoteRouter)
ch <- e.NewMetric(MetricDesc["BridgeRemote"]["bridge_r_queue_operational_state"], prometheus.GaugeValue, encodeMetricMulti(bridge.QueueOperationalState, []string{"NotApplicable", "Bound", "Unbound"}), vpnName, bridgeName, remoteVpnName, remoteRouter)
ch <- e.NewMetric(MetricDesc["BridgeRemote"]["bridge_r_redundancy"], prometheus.GaugeValue, encodeMetricMulti(bridge.Redundancy, []string{"NotApplicable", "auto", "primary", "backup", "static", "none"}), vpnName, bridgeName, remoteVpnName, remoteRouter)
ch <- e.NewMetric(MetricDesc["BridgeRemote"]["bridge_r_connection_uptime_in_seconds"], prometheus.GaugeValue, bridge.ConnectionUptimeInSeconds, vpnName, bridgeName, remoteVpnName, remoteRouter)
ch <- e.NewMetric(MetricDesc["BridgeRemote"]["bridge_remote_admin_state"], prometheus.GaugeValue, encodeMetricMulti(bridge.AdminState, []string{"Enabled", "Disabled", "-", "N/A"}), vpnName, bridgeName, remoteVpnName, remoteRouter)
ch <- e.NewMetric(MetricDesc["BridgeRemote"]["bridge_remote_connection_establisher"], prometheus.GaugeValue, encodeMetricMulti(bridge.ConnectionEstablisher, []string{"NotApplicable", "Local", "Remote", "Invalid"}), vpnName, bridgeName, remoteVpnName, remoteRouter)
ch <- e.NewMetric(MetricDesc["BridgeRemote"]["bridge_remote_inbound_operational_state"], prometheus.GaugeValue, encodeMetricMulti(bridge.InboundOperationalState, opStates), vpnName, bridgeName, remoteVpnName, remoteRouter)
ch <- e.NewMetric(MetricDesc["BridgeRemote"]["bridge_remote_inbound_operational_failure_reason"], prometheus.GaugeValue, encodeMetricMulti(bridge.InboundOperationalFailureReason, failReasons), vpnName, bridgeName, remoteVpnName, remoteRouter)
ch <- e.NewMetric(MetricDesc["BridgeRemote"]["bridge_remote_outbound_operational_state"], prometheus.GaugeValue, encodeMetricMulti(bridge.OutboundOperationalState, opStates), vpnName, bridgeName, remoteVpnName, remoteRouter)
ch <- e.NewMetric(MetricDesc["BridgeRemote"]["bridge_remote_queue_operational_state"], prometheus.GaugeValue, encodeMetricMulti(bridge.QueueOperationalState, []string{"NotApplicable", "Bound", "Unbound"}), vpnName, bridgeName, remoteVpnName, remoteRouter)
ch <- e.NewMetric(MetricDesc["BridgeRemote"]["bridge_remote_redundancy"], prometheus.GaugeValue, encodeMetricMulti(bridge.Redundancy, []string{"NotApplicable", "auto", "primary", "backup", "static", "none"}), vpnName, bridgeName, remoteVpnName, remoteRouter)
ch <- e.NewMetric(MetricDesc["BridgeRemote"]["bridge_remote_connection_uptime_in_seconds"], prometheus.GaugeValue, bridge.ConnectionUptimeInSeconds, vpnName, bridgeName, remoteVpnName, remoteRouter)
}
return 1, nil
}
6 changes: 2 additions & 4 deletions semp/getRedundancySemp1.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,8 @@ func (e *Semp) GetRedundancySemp1(ch chan<- PrometheusMetric) (ok float64, err e
mateRouterName := "" + target.RPC.Show.Red.MateRouterName
ch <- e.NewMetric(MetricDesc["Redundancy"]["system_redundancy_config"], prometheus.GaugeValue, encodeMetricMulti(target.RPC.Show.Red.ConfigStatus, []string{"Disabled", "Enabled", "Shutdown"}), mateRouterName)
ch <- e.NewMetric(MetricDesc["Redundancy"]["system_redundancy_up"], prometheus.GaugeValue, encodeMetricMulti(target.RPC.Show.Red.RedundancyStatus, []string{"Down", "Up"}), mateRouterName)
if !e.isHWBroker {
ch <- e.NewMetric(MetricDesc["Redundancy"]["system_redundancy_role"], prometheus.GaugeValue, encodeMetricMulti(target.RPC.Show.Red.ActiveStandbyRole, []string{"Backup", "Primary", "Monitor", "Undefined"}), mateRouterName)
} else {
ch <- e.NewMetric(MetricDesc["RedundancyHW"]["system_redundancy_hw_role"], prometheus.GaugeValue, encodeMetricMulti(target.RPC.Show.Red.ActiveStandbyRole, []string{"Backup", "Primary", "Undefined"}), mateRouterName)
ch <- e.NewMetric(MetricDesc["Redundancy"]["system_redundancy_role"], prometheus.GaugeValue, encodeMetricMulti(target.RPC.Show.Red.ActiveStandbyRole, []string{"Backup", "Primary", "Monitor", "Undefined"}), mateRouterName)
if e.isHWBroker {
ch <- e.NewMetric(MetricDesc["RedundancyHW"]["system_redundancy_hw_mode"], prometheus.GaugeValue, encodeMetricMulti(target.RPC.Show.Red.RedundancyMode, []string{"Active/Active", "Active/Standby"}), mateRouterName)
ch <- e.NewMetric(MetricDesc["RedundancyHW"]["system_redundancy_hw_adb_link"], prometheus.GaugeValue, encodeMetricBool(target.RPC.Show.Red.OperationalStatus.ADBLink), mateRouterName)
ch <- e.NewMetric(MetricDesc["RedundancyHW"]["system_redundancy_hw_adb_hello"], prometheus.GaugeValue, encodeMetricBool(target.RPC.Show.Red.OperationalStatus.ADBHello), mateRouterName)
Expand Down
17 changes: 8 additions & 9 deletions semp/metricDesc.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ var MetricDesc = map[string]Descriptions{
"system_redundancy_local_active": NewSemDesc("system_redundancy_local_active", NoSempV2Ready, "Is local node the active messaging node? (0-not active, 1-active).", variableLabelsRedundancy),
},
"RedundancyHW": {
"system_redundancy_hw_role": NewSemDesc("system_redundancy_hw_role", NoSempV2Ready, "Redundancy role (0=Backup, 1=Primary, 2-Undefined).", variableLabelsRedundancyHW),
"system_redundancy_hw_mode": NewSemDesc("system_redundancy_hw_mode", NoSempV2Ready, "Redundancy mode (0=Active/Active, 1=Active/Standby).", variableLabelsRedundancyHW),
"system_redundancy_hw_adb_link": NewSemDesc("system_redundancy_hw_adb_link", NoSempV2Ready, "Is adb link up? (0-no, 1-yes).", variableLabelsRedundancyHW),
"system_redundancy_hw_adb_hello": NewSemDesc("system_redundancy_hw_adb_hello", NoSempV2Ready, "Is adb link connected? (0-no, 1-yes).", variableLabelsRedundancyHW),
Expand Down Expand Up @@ -280,14 +279,14 @@ var MetricDesc = map[string]Descriptions{
"bridge_connection_uptime_in_seconds": NewSemDesc("bridge_connection_uptime_in_seconds", NoSempV2Ready, "Connection Uptime (s)", variableLabelsBridge),
},
"BridgeRemote": {
"bridge_r_admin_state": NewSemDesc("bridge_r_admin_state", NoSempV2Ready, "Bridge Administrative State (0-Enabled 1-Disabled, 2--, 3-N/A)", variableLabelsBridgeRemote),
"bridge_r_connection_establisher": NewSemDesc("bridge_r_connection_establisher", NoSempV2Ready, "Connection Establisher (0-NotApplicable, 1-Local, 2-Remote, 3-Invalid)", variableLabelsBridgeRemote),
"bridge_r_inbound_operational_state": NewSemDesc("bridge_r_inbound_operational_state", NoSempV2Ready, "Inbound Ops State (0-Init, 1-Shutdown, 2-NoShutdown, 3-Prepare, 4-Prepare-WaitToConnect, 5-Prepare-FetchingDNS, 6-NotReady, 7-NotReady-Connecting, 8-NotReady-Handshaking, 9-NotReady-WaitNext, 10-NotReady-WaitReuse, 11-NotRead-WaitBridgeVersionMismatch, 12-NotReady-WaitCleanup, 13-Ready, 14-Ready-Subscribing, 15-Ready-InSync, 16-NotApplicable, 17-Invalid)", variableLabelsBridgeRemote),
"bridge_r_inbound_operational_failure_reason": NewSemDesc("bridge_r_inbound_operational_failure_reason", NoSempV2Ready, "Inbound Ops Failure Reason (0-Bridge disabled ,1-No remote message-vpns configured, 2-SMF service is disabled, 3-Msg Backbone is disabled, 4-Local message-vpn is disabled, 5-Active-Standby Role Mismatch, 6-Invalid Active-Standby Role, 7-Redundancy Disabled, 8-Not active, 9-Replication standby, 10-Remote message-vpns disabled, 11-Enforce-trusted-common-name but empty trust-common-name list, 12-SSL transport used but cipher-suite list is empty, 13-Authentication Scheme is Client-Certificate but no certificate is configured, 14-Client-Certificate Authentication Scheme used but not all Remote Message VPNs use SSL, 15-Basic Authentication Scheme used but Basic Client Username not configured, 16-Cluster Down, 17-Cluster Link Down, 18-N/A)", variableLabelsBridgeRemote),
"bridge_r_outbound_operational_state": NewSemDesc("bridge_r_outbound_operational_state", NoSempV2Ready, "Outbound Ops State (0-Init, 1-Shutdown, 2-NoShutdown, 3-Prepare, 4-Prepare-WaitToConnect, 5-Prepare-FetchingDNS, 6-NotReady, 7-NotReady-Connecting, 8-NotReady-Handshaking, 9-NotReady-WaitNext, 10-NotReady-WaitReuse, 11-NotRead-WaitBridgeVersionMismatch, 12-NotReady-WaitCleanup, 13-Ready, 14-Ready-Subscribing, 15-Ready-InSync, 16-NotApplicable, 17-Invalid)", variableLabelsBridgeRemote),
"bridge_r_queue_operational_state": NewSemDesc("bridge_r_queue_operational_state", NoSempV2Ready, "Queue Ops State (0-NotApplicable, 1-Bound, 2-Unbound)", variableLabelsBridgeRemote),
"bridge_r_redundancy": NewSemDesc("bridge_r_redundancy", NoSempV2Ready, "Bridge Redundancy (0-NotApplicable, 1-auto, 2-primary, 3-backup, 4-static, 5-none)", variableLabelsBridgeRemote),
"bridge_r_connection_uptime_in_seconds": NewSemDesc("bridge_r_connection_uptime_in_seconds", NoSempV2Ready, "Connection Uptime (s)", variableLabelsBridgeRemote),
"bridge_remote_admin_state": NewSemDesc("bridge_remote_admin_state", NoSempV2Ready, "Bridge Administrative State (0-Enabled 1-Disabled, 2--, 3-N/A)", variableLabelsBridgeRemote),
"bridge_remote_connection_establisher": NewSemDesc("bridge_remote_connection_establisher", NoSempV2Ready, "Connection Establisher (0-NotApplicable, 1-Local, 2-Remote, 3-Invalid)", variableLabelsBridgeRemote),
"bridge_remote_inbound_operational_state": NewSemDesc("bridge_remote_inbound_operational_state", NoSempV2Ready, "Inbound Ops State (0-Init, 1-Shutdown, 2-NoShutdown, 3-Prepare, 4-Prepare-WaitToConnect, 5-Prepare-FetchingDNS, 6-NotReady, 7-NotReady-Connecting, 8-NotReady-Handshaking, 9-NotReady-WaitNext, 10-NotReady-WaitReuse, 11-NotRead-WaitBridgeVersionMismatch, 12-NotReady-WaitCleanup, 13-Ready, 14-Ready-Subscribing, 15-Ready-InSync, 16-NotApplicable, 17-Invalid)", variableLabelsBridgeRemote),
"bridge_remote_inbound_operational_failure_reason": NewSemDesc("bridge_remote_inbound_operational_failure_reason", NoSempV2Ready, "Inbound Ops Failure Reason (0-Bridge disabled ,1-No remote message-vpns configured, 2-SMF service is disabled, 3-Msg Backbone is disabled, 4-Local message-vpn is disabled, 5-Active-Standby Role Mismatch, 6-Invalid Active-Standby Role, 7-Redundancy Disabled, 8-Not active, 9-Replication standby, 10-Remote message-vpns disabled, 11-Enforce-trusted-common-name but empty trust-common-name list, 12-SSL transport used but cipher-suite list is empty, 13-Authentication Scheme is Client-Certificate but no certificate is configured, 14-Client-Certificate Authentication Scheme used but not all Remote Message VPNs use SSL, 15-Basic Authentication Scheme used but Basic Client Username not configured, 16-Cluster Down, 17-Cluster Link Down, 18-N/A)", variableLabelsBridgeRemote),
"bridge_remote_outbound_operational_state": NewSemDesc("bridge_remote_outbound_operational_state", NoSempV2Ready, "Outbound Ops State (0-Init, 1-Shutdown, 2-NoShutdown, 3-Prepare, 4-Prepare-WaitToConnect, 5-Prepare-FetchingDNS, 6-NotReady, 7-NotReady-Connecting, 8-NotReady-Handshaking, 9-NotReady-WaitNext, 10-NotReady-WaitReuse, 11-NotRead-WaitBridgeVersionMismatch, 12-NotReady-WaitCleanup, 13-Ready, 14-Ready-Subscribing, 15-Ready-InSync, 16-NotApplicable, 17-Invalid)", variableLabelsBridgeRemote),
"bridge_remote_queue_operational_state": NewSemDesc("bridge_remote_queue_operational_state", NoSempV2Ready, "Queue Ops State (0-NotApplicable, 1-Bound, 2-Unbound)", variableLabelsBridgeRemote),
"bridge_remote_redundancy": NewSemDesc("bridge_remote_redundancy", NoSempV2Ready, "Bridge Redundancy (0-NotApplicable, 1-auto, 2-primary, 3-backup, 4-static, 5-none)", variableLabelsBridgeRemote),
"bridge_remote_connection_uptime_in_seconds": NewSemDesc("bridge_remote_connection_uptime_in_seconds", NoSempV2Ready, "Connection Uptime (s)", variableLabelsBridgeRemote),
},
"VpnSpool": {
"vpn_spool_quota_bytes": NewSemDesc("vpn_spool_quota_bytes", NoSempV2Ready, "Spool configured max disk usage.", variableLabelsVpn),
Expand Down

0 comments on commit bb43954

Please sign in to comment.