52 lines
1.1 KiB
Go
52 lines
1.1 KiB
Go
package exploit
|
|
|
|
import (
|
|
"github.com/prometheus/client_golang/prometheus"
|
|
"github.com/prometheus/client_golang/prometheus/promauto"
|
|
)
|
|
|
|
type Metrics struct {
|
|
FlagsSubmitted *prometheus.CounterVec
|
|
Teams prometheus.Gauge
|
|
Queue *prometheus.GaugeVec
|
|
}
|
|
|
|
func NewMetrics(namespace string) *Metrics {
|
|
const subsystem = "exploit_runner"
|
|
|
|
return &Metrics{
|
|
FlagsSubmitted: promauto.NewCounterVec(
|
|
prometheus.CounterOpts{
|
|
Namespace: namespace,
|
|
Subsystem: subsystem,
|
|
Name: "flags_submitted_total",
|
|
Help: "Number of exploits finished",
|
|
},
|
|
[]string{
|
|
"target_id",
|
|
"target_ip",
|
|
"exploit_id",
|
|
"exploit_version",
|
|
"exploit_type",
|
|
},
|
|
),
|
|
|
|
Teams: promauto.NewGauge(prometheus.GaugeOpts{
|
|
Namespace: namespace,
|
|
Subsystem: subsystem,
|
|
Name: "teams",
|
|
Help: "Number of teams scheduled for the current runner",
|
|
}),
|
|
|
|
Queue: promauto.NewGaugeVec(
|
|
prometheus.GaugeOpts{
|
|
Namespace: namespace,
|
|
Subsystem: subsystem,
|
|
Name: "queue",
|
|
Help: "Number of exploits in the queue",
|
|
},
|
|
[]string{"type"},
|
|
),
|
|
}
|
|
}
|