diff --git a/VERSION b/VERSION index 40488c2..266146b 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.6.3-dev +1.6.3 diff --git a/controller/controller.go b/controller/controller.go index 60f7527..e9252f9 100644 --- a/controller/controller.go +++ b/controller/controller.go @@ -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" ) @@ -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) } } diff --git a/internal/promclient/promclient.go b/internal/promclient/promclient.go index c421e43..4e4ea56 100644 --- a/internal/promclient/promclient.go +++ b/internal/promclient/promclient.go @@ -16,6 +16,7 @@ import ( type PromStats struct { coreSub *prometheus.CounterVec + violSub *prometheus.CounterVec smfSvcStat *prometheus.CounterVec amfSvcStat *prometheus.CounterVec smfSessions *prometheus.GaugeVec @@ -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", @@ -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 @@ -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(