mirror of
https://github.com/crowdsecurity/crowdsec.git
synced 2025-05-11 12:25:53 +02:00
fix prometheus URL used by cscli (#520)
This commit is contained in:
parent
674630f7b1
commit
0ed92b20a0
6 changed files with 34 additions and 9 deletions
|
@ -257,10 +257,18 @@ func InspectItem(name string, objecitemType string) {
|
|||
log.Fatalf("unable to marshal item : %s", err)
|
||||
}
|
||||
fmt.Printf("%s", string(buff))
|
||||
|
||||
fmt.Printf("\nCurrent metrics : \n\n")
|
||||
ShowMetrics(hubItem)
|
||||
|
||||
if csConfig.Prometheus.Enabled {
|
||||
if csConfig.Prometheus.ListenAddr == "" || csConfig.Prometheus.ListenPort == 0 {
|
||||
log.Warningf("No prometheus address or port specified in '%s', can't show metrics", *csConfig.Self)
|
||||
return
|
||||
}
|
||||
if prometheusURL == "" {
|
||||
log.Debugf("No prometheus URL provided using: %s:%d", csConfig.Prometheus.ListenAddr, csConfig.Prometheus.ListenPort)
|
||||
prometheusURL = fmt.Sprintf("http://%s:%d/metrics", csConfig.Prometheus.ListenAddr, csConfig.Prometheus.ListenPort)
|
||||
}
|
||||
fmt.Printf("\nCurrent metrics : \n\n")
|
||||
ShowMetrics(hubItem)
|
||||
}
|
||||
}
|
||||
|
||||
func ShowMetrics(hubItem *cwhub.Item) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue