Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var RootCmd = &cobra.Command{ Use: "overseerr-exporter", Short: "Export request metrics from Overseerr", Long: `Export request metrics from an Overseerr instance to a prometheus database`, PersistentPreRun: func(cmd *cobra.Command, args []string) { setupLogger() logrus.WithFields(logrus.Fields{ "command": cmd.Name(), "args": args, }).Debugln("running command") }, PreRun: func(cmd *cobra.Command, args []string) { setOverseer() }, Run: func(cmd *cobra.Command, args []string) { prometheus.MustRegister(prometheus.NewBuildInfoCollector()) prometheus.MustRegister(collector.NewRequestCollector(overseerr, scrapeGenres, scrapeCompanies)) prometheus.MustRegister(collector.NewUserCollector(overseerr)) handler := promhttp.Handler() http.Handle(metricsPath, handler) http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { w.Write([]byte(`<html> <head><title>Overseerr Exporter</title></head> <body> <h1>Overseerr Exporter</h1> <p><a href="` + metricsPath + `">Metrics</a></p> </body> </html>`)) }) if err := http.ListenAndServe(listenAddress, nil); err != nil { logrus.WithField("err msg", err.Error()).Fatalln("🆘 http server failed: exiting") } }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.