Skip to content
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
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.6.3-dev
1.6.3
3 changes: 3 additions & 0 deletions controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (

"github.com/omec-project/metricfunc/config"
"github.com/omec-project/metricfunc/internal/metricdata"
"github.com/omec-project/metricfunc/internal/promclient"
"github.com/omec-project/metricfunc/logger"
"golang.org/x/net/http2"
)
Expand Down Expand Up @@ -370,9 +371,11 @@ func RogueIPHandler(rogueIPChannel chan RogueIPs) {
targets := rocClient.GetTargets()

if len(targets) == 0 {
promclient.PushViolSubData(subscriberInfo.Imsi, ipaddr, "Active")
logger.ControllerLog.Errorln("get targets returns nil")
} else {
// get siteinfo from ROC
promclient.PushViolSubData(subscriberInfo.Imsi, ipaddr, "Resolved")
rocClient.DisableSimcard(targets, subscriberInfo.Imsi)
}
}
Expand Down
19 changes: 19 additions & 0 deletions internal/promclient/promclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (

type PromStats struct {
coreSub *prometheus.CounterVec
violSub *prometheus.CounterVec
smfSvcStat *prometheus.CounterVec
amfSvcStat *prometheus.CounterVec
smfSessions *prometheus.GaugeVec
Expand Down Expand Up @@ -48,6 +49,11 @@ func initPromStats() *PromStats {
Help: "core subscriber info",
}, []string{"imsi", "ip_addr", "state", "smf_ip", "dnn", "slice", "upf"}),

violSub: prometheus.NewCounterVec(prometheus.CounterOpts{
Name: "viol_subscriber",
Help: "violated subscriber info",
}, []string{"imsi", "ip_addr", "state"}),

smfSessions: prometheus.NewGaugeVec(prometheus.GaugeOpts{
Name: "smf_pdu_sessions",
Help: "Number of SMF PDU sessions currently in the core",
Expand Down Expand Up @@ -76,6 +82,11 @@ func (ps *PromStats) register() error {
return err
}

if err := prometheus.Register(ps.violSub); err != nil {
logger.PromLog.Errorf("register viol subscriber detail stats failed: %v", err.Error())
return err
}

if err := prometheus.Register(ps.smfSessions); err != nil {
logger.PromLog.Errorf("register core subscriber count stats failed: %v", err.Error())
return err
Expand Down Expand Up @@ -115,6 +126,14 @@ func DeleteCoreSubData(imsi, ip_addr, state, smf_ip, dnn, slice, upf string) {
promStats.coreSub.DeleteLabelValues(imsi, ip_addr, state, smf_ip, dnn, slice, upf)
}

func PushViolSubData(imsi, ip_addr, state string) {
logger.PromLog.Debugf(
"adding viol subscriber data [%v, %v, %v]",
imsi, ip_addr, state,
)
promStats.violSub.WithLabelValues(imsi, ip_addr, state).Inc()
}

// SetSessStats maintains Session level stats
func SetSmfSessStats(smfIp, slice, dnn, upf string, count uint64) {
logger.PromLog.Debugf(
Expand Down