Skip to content
Snippets Groups Projects
Select Git revision
  • e558cb36d0c9663d4e67dc60069cd2cdedba4a37
  • noblogs default
  • noblogs-5.7.1
  • upstream
  • noblogs-5.7
  • noblogs-5.6new
  • upstream5.5.1
  • noblogs28dic
  • upstream28dic
  • noblogs-5.5.1
  • noblogs-5.4.2
  • noblogs-5.4_seconda
  • noblogs-5.4
  • noblogs-7c
  • wp5.2.3p3
  • mergedbconf
  • noblogs-5.7.1
  • noblogs.5.7.0p1
  • noblogs-5.7.0
  • noblogs-5.6p3
  • noblogs5.6p2
  • noblogs-5.6p1
  • noblogs-5.6
  • noblogs-5.4.2p1
  • noblogs-5.4.2
  • noblogs-5.4.1
  • noblogs-5.4
  • noblogs-p5.4
  • noblogs-5.3.2p2
  • noblogs-5.3.2p1
  • noblogs-5.3.2
  • noblogs-5.3
  • noblogs-5.2.3p4
  • noblogs-5.2.3p3
  • noblogs-5.2.3p2
  • noblogs-5.2.3p1
36 results

customize-loader.js

Blame
  • main.go 958 B
    package main
    
    import (
    	"flag"
    	"net/http"
    	"os"
    	"os/signal"
    
    	"github.com/prometheus/client_golang/prometheus"
    )
    
    var (
    	listenAddress = flag.String("web.listen-address", ":9104", "Address to listen on for web interface and telemetry.")
    	metricPath    = flag.String("web.telemetry-path", "/metrics", "Path under which to expose metrics.")
    )
    
    func main() {
    	flag.Parse()
    	exporter := newRsyslogExporter()
    
    	go func() {
    		c := make(chan os.Signal, 1)
    		signal.Notify(c, os.Interrupt)
    		<-c
    		os.Exit(0)
    	}()
    
    	go func() {
    		exporter.run()
    	}()
    
    	prometheus.MustRegister(exporter)
    	http.Handle(*metricPath, prometheus.Handler())
    	http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
    		w.Write([]byte(`<html>
    <head><title>Rsyslog exporter</title></head>
    <body>
    <h1>Rsyslog exporter</h1>
    <p><a href='` + *metricPath + `'>Metrics</a></p>
    </body>
    </html>
    `))
    	})
    
    	err := http.ListenAndServe(*listenAddress, nil)
    	if err != nil {
    		panic(err)
    	}
    }