From 37905e13e6eb2bcb666f569cd71be86122e34d38 Mon Sep 17 00:00:00 2001 From: Peter Fowler Date: Mon, 18 Sep 2023 13:37:31 -0400 Subject: [PATCH] add maximum and current ingress, egress and endpoint metrics --- semp/getVpnSpoolSemp1.go | 15 ++++++++++++++- semp/metricDesc.go | 6 ++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/semp/getVpnSpoolSemp1.go b/semp/getVpnSpoolSemp1.go index 4ce898c..6940606 100644 --- a/semp/getVpnSpoolSemp1.go +++ b/semp/getVpnSpoolSemp1.go @@ -19,6 +19,12 @@ func (e *Semp) GetVpnSpoolSemp1(ch chan<- prometheus.Metric, vpnFilter string) ( SpooledMsgCount float64 `xml:"current-messages-spooled"` SpoolUsageCurrentMb float64 `xml:"current-spool-usage-mb"` SpoolUsageMaxMb float64 `xml:"maximum-spool-usage-mb"` + CurrentEndpoints float64 `xml:"current-queues-and-topic-endpoints"` + MaximumEndpoints float64 `xml:"maximum-queues-and-topic-endpoints"` + CurrentEgressFlows float64 `xml:"current-egress-flows"` + MaximumEgressFlows float64 `xml:"maximum-egress-flows"` + CurrentIngressFlows float64 `xml:"current-ingress-flows"` + MaximumIngressFlows float64 `xml:"maximum-ingress-flows"` } `xml:"vpn"` } `xml:"message-vpn"` } `xml:"message-spool"` @@ -29,7 +35,7 @@ func (e *Semp) GetVpnSpoolSemp1(ch chan<- prometheus.Metric, vpnFilter string) ( } `xml:"execute-result"` } - command := "" + vpnFilter + "" + command := "" + vpnFilter + "" body, err := e.postHTTP(e.brokerURI+"/SEMP", "application/xml", command) if err != nil { _ = level.Error(e.logger).Log("msg", "Can't scrape VpnSemp1", "err", err, "broker", e.brokerURI) @@ -48,10 +54,17 @@ func (e *Semp) GetVpnSpoolSemp1(ch chan<- prometheus.Metric, vpnFilter string) ( return 0, errors.New("unexpected result: see log") } + for _, vpn := range target.RPC.Show.MessageSpool.MessageVpn.Vpn { ch <- prometheus.MustNewConstMetric(MetricDesc["VpnSpool"]["vpn_spool_quota_bytes"], prometheus.GaugeValue, vpn.SpoolUsageMaxMb*1024*1024, vpn.Name) ch <- prometheus.MustNewConstMetric(MetricDesc["VpnSpool"]["vpn_spool_usage_bytes"], prometheus.GaugeValue, vpn.SpoolUsageCurrentMb*1024*1024, vpn.Name) ch <- prometheus.MustNewConstMetric(MetricDesc["VpnSpool"]["vpn_spool_usage_msgs"], prometheus.GaugeValue, vpn.SpooledMsgCount, vpn.Name) + ch <- prometheus.MustNewConstMetric(MetricDesc["VpnSpool"]["vpn_spool_current_endpoints"], prometheus.GaugeValue, vpn.CurrentEndpoints, vpn.Name) + ch <- prometheus.MustNewConstMetric(MetricDesc["VpnSpool"]["vpn_spool_maximum_endpoints"], prometheus.GaugeValue, vpn.MaximumEndpoints, vpn.Name) + ch <- prometheus.MustNewConstMetric(MetricDesc["VpnSpool"]["vpn_spool_current_egress_flows"], prometheus.GaugeValue, vpn.CurrentEgressFlows, vpn.Name) + ch <- prometheus.MustNewConstMetric(MetricDesc["VpnSpool"]["vpn_spool_maximum_egress_flows"], prometheus.GaugeValue, vpn.MaximumEgressFlows, vpn.Name) + ch <- prometheus.MustNewConstMetric(MetricDesc["VpnSpool"]["vpn_spool_current_ingress_flows"], prometheus.GaugeValue, vpn.CurrentIngressFlows, vpn.Name) + ch <- prometheus.MustNewConstMetric(MetricDesc["VpnSpool"]["vpn_spool_maximum_ingress_flows"], prometheus.GaugeValue, vpn.MaximumIngressFlows, vpn.Name) } return 1, nil diff --git a/semp/metricDesc.go b/semp/metricDesc.go index 8f993f6..96611f3 100644 --- a/semp/metricDesc.go +++ b/semp/metricDesc.go @@ -190,6 +190,12 @@ var MetricDesc = map[string]Metrics{ "vpn_spool_quota_bytes": prometheus.NewDesc(namespace+"_"+"vpn_spool_quota_bytes", "Spool configured max disk usage.", variableLabelsVpn, nil), "vpn_spool_usage_bytes": prometheus.NewDesc(namespace+"_"+"vpn_spool_usage_bytes", "Spool total persisted usage.", variableLabelsVpn, nil), "vpn_spool_usage_msgs": prometheus.NewDesc(namespace+"_"+"vpn_spool_usage_msgs", "Spool total number of persisted messages.", variableLabelsVpn, nil), + "vpn_spool_current_endpoints": prometheus.NewDesc(namespace+"_"+"vpn_spool_current_endpoints", "Spool current number of endpoints.", variableLabelsVpn, nil), + "vpn_spool_maximum_endpoints": prometheus.NewDesc(namespace+"_"+"vpn_spool_maximum_endpoints", "Spool maximum number of endpoints.", variableLabelsVpn, nil), + "vpn_spool_current_egress_flows": prometheus.NewDesc(namespace+"_"+"vpn_spool_current_egress_flows", "Spool current number of egress flows.", variableLabelsVpn, nil), + "vpn_spool_maximum_egress_flows": prometheus.NewDesc(namespace+"_"+"vpn_spool_maximum_egress_flows", "Spool maximum number of egress flows.", variableLabelsVpn, nil), + "vpn_spool_current_ingress_flows": prometheus.NewDesc(namespace+"_"+"vpn_spool_current_ingress_flows", "Spool current number of ingress flows.", variableLabelsVpn, nil), + "vpn_spool_maximum_ingress_flows": prometheus.NewDesc(namespace+"_"+"vpn_spool_maximum_ingress_flows", "Spool maximum number of ingress flows.", variableLabelsVpn, nil), }, //SEMPv1: show client message-vpn connected "Client": {