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 jabber metrics #29

Merged
merged 1 commit into from
Sep 21, 2024
Merged
Show file tree
Hide file tree
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
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 18 additions & 0 deletions counters.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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},
Expand Down
5 changes: 3 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
47 changes: 44 additions & 3 deletions parameters.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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"`
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
}
Expand Down
Loading