From 30cc80064da236f5c1fd4eae8d7f3e0166521bd5 Mon Sep 17 00:00:00 2001 From: Andrey Burtasov <76874959+aburtasov@users.noreply.github.com> Date: Sat, 21 Sep 2024 11:15:48 +0300 Subject: [PATCH] add jabber metrics (#29) --- README.md | 8 ++++++++ config.yml | 8 ++++++++ counters.go | 18 ++++++++++++++++++ go.sum | 5 +++-- parameters.go | 47 ++++++++++++++++++++++++++++++++++++++++++++--- 5 files changed, 81 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index fb91290..3962730 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,14 @@ metrics: mtpResourceActive: false mtpResourceAvailable: false mtpResourceTotal: true + registeredBOTJabberMRA: false + registeredBOTJabberNonMRA: false + registeredCSFJabberMRA: false + registeredCSFJabberNonMRA: false + registeredTABJabberMRA: false + registeredTABJabberNonMRA: false + registeredTCTJabberMRA: false + registeredTCTJabberNonMRA: false swConferenceActive: false swConferenceCompleted: false swConferenceOutOfResources: false diff --git a/config.yml b/config.yml index dce0ed9..743f580 100644 --- a/config.yml +++ b/config.yml @@ -43,6 +43,14 @@ metrics: registeredAnalogAccess: false registeredMGCPGateway: false registeredOtherStationDevices: false + registeredBOTJabberMRA: false + registeredBOTJabberNonMRA: false + registeredCSFJabberMRA: false + registeredCSFJabberNonMRA: false + registeredTABJabberMRA: false + registeredTABJabberNonMRA: false + registeredTCTJabberMRA: false + registeredTCTJabberNonMRA: false sipLineServerAuthorizationChallenges: false sipLineServerAuthorizationFailures: false sipTrunkApplicationAuthorizationFailures: false diff --git a/counters.go b/counters.go index 0f97062..327f5e3 100644 --- a/counters.go +++ b/counters.go @@ -87,6 +87,15 @@ const ( MTPResourceAvailable = "MTPResourceAvailable" MTPResourceTotal = "MTPResourceTotal" + RegisteredBOTJabberMRA = "RegisteredBOTJabberMRA" + RegisteredBOTJabberNonMRA = "RegisteredBOTJabberNonMRA" + RegisteredCSFJabberMRA = "RegisteredCSFJabberMRA" + RegisteredCSFJabberNonMRA = "RegisteredCSFJabberNonMRA" + RegisteredTABJabberMRA = "RegisteredTABJabberMRA" + RegisteredTABJabberNonMRA = "RegisteredTABJabberNonMRA" + RegisteredTCTJabberMRA = "RegisteredTCTJabberMRA" + RegisteredTCTJabberNonMRA = "RegisteredTCTJabberNonMRA" + // SIPLineServerAuthorizationChallenges SIP SIPLineServerAuthorizationChallenges = "SIPLineServerAuthorizationChallenges" SIPLineServerAuthorizationFailures = "SIPLineServerAuthorizationFailures" @@ -184,6 +193,15 @@ var ( {allowedCounterName: VideoOnHoldOutOfResources, prometheusName: "cucm_video_on_hold_out_of_resources", defaultEnabled: false}, {allowedCounterName: VideoOnHoldResourceActive, prometheusName: "cucm_video_on_hold_resource_active", defaultEnabled: false}, {allowedCounterName: VideoOutOfResources, prometheusName: "cucm_video_out_of_resources", defaultEnabled: false}, + // jabber + {allowedCounterName: RegisteredBOTJabberMRA, prometheusName: "cucm_registered_bot_jabber_mra", defaultEnabled: false}, + {allowedCounterName: RegisteredBOTJabberNonMRA, prometheusName: "cucm_registered_bot_jabber_non_mra", defaultEnabled: false}, + {allowedCounterName: RegisteredCSFJabberMRA, prometheusName: "cucm_registered_csf_jabber_mra", defaultEnabled: false}, + {allowedCounterName: RegisteredCSFJabberNonMRA, prometheusName: "cucm_registered_csf_jabber_non_mra", defaultEnabled: false}, + {allowedCounterName: RegisteredTABJabberMRA, prometheusName: "cucm_registered_tab_jabber_mra", defaultEnabled: false}, + {allowedCounterName: RegisteredTABJabberNonMRA, prometheusName: "cucm_registered_tab_jabber_non_mra", defaultEnabled: false}, + {allowedCounterName: RegisteredTCTJabberMRA, prometheusName: "cucm_registered_tct_jabber_mra", defaultEnabled: false}, + {allowedCounterName: RegisteredTCTJabberNonMRA, prometheusName: "cucm_registered_tct_jabber_non_mra", defaultEnabled: false}, // cisco recording {allowedCounterName: GatewayRegistrationFailures, prometheusName: "cucm_gateway_registration_failures", defaultEnabled: false}, {allowedCounterName: GatewaysInService, prometheusName: "cucm_gateways_in_service", defaultEnabled: false}, diff --git a/go.sum b/go.sum index 32ced27..f96c4ea 100644 --- a/go.sum +++ b/go.sum @@ -40,8 +40,9 @@ github.com/xhit/go-str2duration/v2 v2.1.0/go.mod h1:ohY8p+0f07DiV6Em5LKB0s2YpLtX golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= -google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= diff --git a/parameters.go b/parameters.go index d4aa8d0..549313d 100644 --- a/parameters.go +++ b/parameters.go @@ -4,13 +4,14 @@ import ( "encoding/json" "errors" "fmt" - "github.com/alecthomas/kingpin/v2" - log "github.com/sirupsen/logrus" - "gopkg.in/yaml.v2" "os" "path" "regexp" "strings" + + "github.com/alecthomas/kingpin/v2" + log "github.com/sirupsen/logrus" + "gopkg.in/yaml.v2" ) type Config struct { @@ -71,6 +72,14 @@ type MetricsEnabled struct { RegisteredAnalogAccess bool `yaml:"registeredAnalogAccess" json:"registeredAnalogAccess"` RegisteredMGCPGateway bool `yaml:"registeredMGCPGateway" json:"registeredMGCPGateway"` RegisteredOtherStationDevices bool `yaml:"registeredOtherStationDevices" json:"registeredOtherStationDevices"` + RegisteredBOTJabberMRA bool `yaml:"registeredBOTJabberMRA" json:"registeredBOTJabberMRA"` + RegisteredBOTJabberNonMRA bool `yaml:"registeredBOTJabberNonMRA" json:"registeredBOTJabberNonMRA"` + RegisteredCSFJabberMRA bool `yaml:"registeredCSFJabberMRA" json:"registeredCSFJabberMRA"` + RegisteredCSFJabberNonMRA bool `yaml:"registeredCSFJabberNonMRA" json:"registeredCSFJabberNonMRA"` + RegisteredTABJabberMRA bool `yaml:"registeredTABJabberMRA" json:"registeredTABJabberMRA"` + RegisteredTABJabberNonMRA bool `yaml:"registeredTABJabberNonMRA" json:"registeredTABJabberNonMRA"` + RegisteredTCTJabberMRA bool `yaml:"registeredTCTJabberMRA" json:"registeredTCTJabberMRA"` + RegisteredTCTJabberNonMRA bool `yaml:"registeredTCTJabberNonMRA" json:"registeredTCTJabberNonMRA"` SIPLineServerAuthorizationChallenges bool `yaml:"sipLineServerAuthorizationChallenges" json:"sipLineServerAuthorizationChallenges"` SIPLineServerAuthorizationFailures bool `yaml:"sipLineServerAuthorizationFailures" json:"sipLineServerAuthorizationFailures"` SIPTrunkApplicationAuthorizationFailures bool `yaml:"sipTrunkApplicationAuthorizationFailures" json:"sipTrunkApplicationAuthorizationFailures"` @@ -170,6 +179,14 @@ var ( RegisteredAnalogAccess: false, RegisteredMGCPGateway: false, RegisteredOtherStationDevices: false, + RegisteredBOTJabberMRA: false, + RegisteredBOTJabberNonMRA: false, + RegisteredCSFJabberMRA: false, + RegisteredCSFJabberNonMRA: false, + RegisteredTABJabberMRA: false, + RegisteredTABJabberNonMRA: false, + RegisteredTCTJabberMRA: false, + RegisteredTCTJabberNonMRA: false, SIPLineServerAuthorizationChallenges: false, SIPLineServerAuthorizationFailures: false, SIPTrunkApplicationAuthorizationFailures: false, @@ -541,6 +558,30 @@ func (m *MetricsEnabled) enablePrometheusCounter(name string) bool { if name == RegisteredOtherStationDevices { return m.RegisteredOtherStationDevices } + if name == RegisteredBOTJabberMRA { + return m.RegisteredBOTJabberMRA + } + if name == RegisteredBOTJabberNonMRA { + return m.RegisteredBOTJabberNonMRA + } + if name == RegisteredCSFJabberMRA { + return m.RegisteredCSFJabberMRA + } + if name == RegisteredCSFJabberNonMRA { + return m.RegisteredCSFJabberNonMRA + } + if name == RegisteredTABJabberMRA { + return m.RegisteredTABJabberMRA + } + if name == RegisteredTABJabberNonMRA { + return m.RegisteredTABJabberNonMRA + } + if name == RegisteredTCTJabberMRA { + return m.RegisteredTCTJabberMRA + } + if name == RegisteredTCTJabberNonMRA { + return m.RegisteredTCTJabberNonMRA + } return false }