From d62365d7ab40b2b8cad5a96a1d4827c185f17856 Mon Sep 17 00:00:00 2001 From: Dani Louca <59848726+dloucasfx@users.noreply.github.com> Date: Fri, 7 Apr 2023 14:04:33 -0400 Subject: [PATCH] Fixing systemd metadata so sendLoadState, sendSubState and sendActiveState options work again (#2929) Signed-off-by: Dani Louca --- .../monitors/collectd/systemd/genmetadata.go | 60 ++++++++++++++----- .../monitors/collectd/systemd/metadata.yaml | 13 ++++ 2 files changed, 58 insertions(+), 15 deletions(-) diff --git a/pkg/signalfx-agent/pkg/monitors/collectd/systemd/genmetadata.go b/pkg/signalfx-agent/pkg/monitors/collectd/systemd/genmetadata.go index ddf9c407737..1c6b488fe6f 100644 --- a/pkg/signalfx-agent/pkg/monitors/collectd/systemd/genmetadata.go +++ b/pkg/signalfx-agent/pkg/monitors/collectd/systemd/genmetadata.go @@ -9,7 +9,17 @@ import ( const monitorType = "collectd/systemd" -var groupSet = map[string]bool{} +const ( + groupActiveState = "ActiveState" + groupLoadState = "LoadState" + groupSubState = "SubState" +) + +var groupSet = map[string]bool{ + groupActiveState: true, + groupLoadState: true, + groupSubState: true, +} const ( gaugeActiveStateActivating = "gauge.active_state.activating" @@ -29,19 +39,19 @@ const ( ) var metricSet = map[string]monitors.MetricInfo{ - gaugeActiveStateActivating: {Type: datapoint.Gauge}, - gaugeActiveStateActive: {Type: datapoint.Gauge}, - gaugeActiveStateDeactivating: {Type: datapoint.Gauge}, - gaugeActiveStateFailed: {Type: datapoint.Gauge}, - gaugeActiveStateInactive: {Type: datapoint.Gauge}, - gaugeActiveStateReloading: {Type: datapoint.Gauge}, - gaugeLoadStateError: {Type: datapoint.Gauge}, - gaugeLoadStateLoaded: {Type: datapoint.Gauge}, - gaugeLoadStateMasked: {Type: datapoint.Gauge}, - gaugeLoadStateNotFound: {Type: datapoint.Gauge}, - gaugeSubstateDead: {Type: datapoint.Gauge}, - gaugeSubstateExited: {Type: datapoint.Gauge}, - gaugeSubstateFailed: {Type: datapoint.Gauge}, + gaugeActiveStateActivating: {Type: datapoint.Gauge, Group: groupActiveState}, + gaugeActiveStateActive: {Type: datapoint.Gauge, Group: groupActiveState}, + gaugeActiveStateDeactivating: {Type: datapoint.Gauge, Group: groupActiveState}, + gaugeActiveStateFailed: {Type: datapoint.Gauge, Group: groupActiveState}, + gaugeActiveStateInactive: {Type: datapoint.Gauge, Group: groupActiveState}, + gaugeActiveStateReloading: {Type: datapoint.Gauge, Group: groupActiveState}, + gaugeLoadStateError: {Type: datapoint.Gauge, Group: groupLoadState}, + gaugeLoadStateLoaded: {Type: datapoint.Gauge, Group: groupLoadState}, + gaugeLoadStateMasked: {Type: datapoint.Gauge, Group: groupLoadState}, + gaugeLoadStateNotFound: {Type: datapoint.Gauge, Group: groupLoadState}, + gaugeSubstateDead: {Type: datapoint.Gauge, Group: groupSubState}, + gaugeSubstateExited: {Type: datapoint.Gauge, Group: groupSubState}, + gaugeSubstateFailed: {Type: datapoint.Gauge, Group: groupSubState}, gaugeSubstateRunning: {Type: datapoint.Gauge}, } @@ -49,7 +59,27 @@ var defaultMetrics = map[string]bool{ gaugeSubstateRunning: true, } -var groupMetricsMap = map[string][]string{} +var groupMetricsMap = map[string][]string{ + groupActiveState: { + gaugeActiveStateActivating, + gaugeActiveStateActive, + gaugeActiveStateDeactivating, + gaugeActiveStateFailed, + gaugeActiveStateInactive, + gaugeActiveStateReloading, + }, + groupLoadState: { + gaugeLoadStateError, + gaugeLoadStateLoaded, + gaugeLoadStateMasked, + gaugeLoadStateNotFound, + }, + groupSubState: { + gaugeSubstateDead, + gaugeSubstateExited, + gaugeSubstateFailed, + }, +} var monitorMetadata = monitors.Metadata{ MonitorType: "collectd/systemd", diff --git a/pkg/signalfx-agent/pkg/monitors/collectd/systemd/metadata.yaml b/pkg/signalfx-agent/pkg/monitors/collectd/systemd/metadata.yaml index eba550c2114..86743932147 100644 --- a/pkg/signalfx-agent/pkg/monitors/collectd/systemd/metadata.yaml +++ b/pkg/signalfx-agent/pkg/monitors/collectd/systemd/metadata.yaml @@ -60,31 +60,37 @@ monitors: description: Indicates that the systemd unit/service is active default: false type: gauge + group: ActiveState gauge.active_state.inactive: description: Indicates that the systemd unit/service is inactive and the previous run was successful or no previous run has taken place yet default: false type: gauge + group: ActiveState gauge.active_state.activating: description: Indicates that the systemd unit/service has previously been inactive but is currently in the process of entering an active state default: false type: gauge + group: ActiveState gauge.active_state.deactivating: description: Indicates that the systemd unit/service is currently in the process of deactivation default: false type: gauge + group: ActiveState gauge.active_state.reloading: description: Indicates that the systemd unit/service is active and currently reloading its configuration default: false type: gauge + group: ActiveState gauge.active_state.failed: description: Indicates that the systemd unit/service is inactive the previous run was not successful default: false type: gauge + group: ActiveState gauge.substate.running: description: Indicates that the systemd unit/service is running default: true @@ -93,32 +99,39 @@ monitors: description: Indicates that the systemd unit/service exited default: false type: gauge + group: SubState gauge.substate.failed: description: Indicates that the systemd unit/service failed default: false type: gauge + group: SubState gauge.substate.dead: description: Indicates that the systemd unit/service died default: false type: gauge + group: SubState gauge.load_state.loaded: description: Indicates that the systemd unit/service configuration was loaded and parsed successfully default: false type: gauge + group: LoadState gauge.load_state.not-found: description: Indicates that the systemd unit/service configuration was not found default: false type: gauge + group: LoadState gauge.load_state.error: description: Indicates that the systemd unit/service configuration failed to load default: false type: gauge + group: LoadState gauge.load_state.masked: description: Indicates that the systemd unit/service is currently masked out (i.e. symlinked to /dev/null etc) default: false type: gauge + group: LoadState monitorType: collectd/systemd properties: