mirror of
https://github.com/jhillyerd/inbucket.git
synced 2025-12-18 01:57:02 +00:00
Add expvar JSON @ /debug/vars
Counters include: - Uptime - SMTP connections - SMTP connections (current) - SMTP messages delivered
This commit is contained in:
10
inbucket.go
10
inbucket.go
@@ -4,6 +4,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"expvar"
|
||||
"flag"
|
||||
"fmt"
|
||||
"github.com/jhillyerd/inbucket/config"
|
||||
@@ -11,10 +12,13 @@ import (
|
||||
"github.com/jhillyerd/inbucket/smtpd"
|
||||
"github.com/jhillyerd/inbucket/web"
|
||||
"os"
|
||||
"time"
|
||||
)
|
||||
|
||||
var help = flag.Bool("help", false, "Displays this help")
|
||||
|
||||
var startTime = time.Now()
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
if *help {
|
||||
@@ -49,4 +53,10 @@ func init() {
|
||||
fmt.Fprintln(os.Stderr, "Usage of inbucket [options] <conf file>:")
|
||||
flag.PrintDefaults()
|
||||
}
|
||||
|
||||
expvar.Publish("uptime", expvar.Func(uptime))
|
||||
}
|
||||
|
||||
func uptime() interface{} {
|
||||
return time.Since(startTime) / time.Second
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user