added code for rpx handling

This commit is contained in:
2025-08-19 20:20:18 +09:00
parent 31a4223aab
commit 10c139e837
19 changed files with 1518 additions and 427 deletions

View File

@ -12,6 +12,7 @@ type ServerCollector struct {
ServerPeers *prometheus.Desc
SshProxySessions *prometheus.Desc
PtySessions *prometheus.Desc
RptySessions *prometheus.Desc
}
// NewServerCollector returns a new ServerCollector with all prometheus.Desc initialized
@ -58,6 +59,11 @@ func NewServerCollector(server *Server) ServerCollector {
"Number of pty session",
nil, nil,
),
RptySessions: prometheus.NewDesc(
prefix + "rpty_sessions",
"Number of rpty session",
nil, nil,
),
}
}
@ -68,6 +74,7 @@ func (c ServerCollector) Describe(ch chan<- *prometheus.Desc) {
ch <- c.ServerPeers
ch <- c.SshProxySessions
ch <- c.PtySessions
ch <- c.RptySessions
}
func (c ServerCollector) Collect(ch chan<- prometheus.Metric) {
@ -110,4 +117,10 @@ func (c ServerCollector) Collect(ch chan<- prometheus.Metric) {
prometheus.GaugeValue,
float64(c.server.stats.pty_sessions.Load()),
)
ch <- prometheus.MustNewConstMetric(
c.RptySessions,
prometheus.GaugeValue,
float64(c.server.stats.rpty_sessions.Load()),
)
}