-
Notifications
You must be signed in to change notification settings - Fork 0
Conversation
http.Handle("/metrics", promhttp.Handler()) | ||
|
||
go func() { | ||
if err := http.ListenAndServe(":8686", nil); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably the port could be passed as a parameter?
func gatherMetrics() { | ||
pipe, err := os.Open("/var/log/ulogd.pcap") | ||
if err != nil { | ||
log.Fatal(err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For a debug purpose, I'd add some context to logging messages, e.g. log.Fatal("cannot open /var/log/ulogd.pcap: %s", err)
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turns out it's already contextualised:
2016-10-19 12:29:12.213983 I | open /var/log/ulogd.pcap: no such file or directory
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I meant all occurrences of thelog.Fatal
statement.
7b89ee4
to
4ad1ea2
Compare
Include the ulogd Alpine package in the container image, along with a configuration file that receives NFLOG messages from group 86 and logs them in PCAP dump format to a named pipe in a well known location.
Exec the ulogd daemon on weave-npc startup, copying any log output to our own logs. Exit if the ulogd process terminates for any reason.
4ad1ea2
to
7d2b417
Compare
I have added |
@@ -158,3 +172,16 @@ func main() { | |||
signal.Notify(signals, syscall.SIGINT, syscall.SIGTERM) | |||
log.Fatalf("Exiting: %v", <-signals) | |||
} | |||
|
|||
var RootCmd = &cobra.Command{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpicking: s/RootCmd/rootCmd ?
LGTM, just one nitpick. |
Read and parse packets from the ulogd named pipe, and serve statistics via the Prometheus client.
7d2b417
to
57b6621
Compare
Nit picked! |
Fixes #7; depends on weaveworks/weave#2549. See commit messages for implementation details.