Skip to content

Commit

Permalink
Merge pull request #2 from stanislav-zaprudskiy/allow_supplying_custo…
Browse files Browse the repository at this point in the history
…m_regexp

Read regexp to parse kmsg from cmd args
  • Loading branch information
jknipper authored Feb 24, 2022
2 parents e635c21 + a5485f6 commit a73d21f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ import (
)

var (
kmesgRE = regexp.MustCompile(`/pod(\w+-\w+-\w+-\w+-\w+)/([a-f0-9]+) killed as a result of limit of /kubepods`)
kmesgREStr = `/pod(\w+-\w+-\w+-\w+-\w+)/([a-f0-9]+) killed as a result of limit of /kubepods`
kmesgRE *regexp.Regexp
)

var (
Expand All @@ -35,6 +36,7 @@ var (
func init() {
var err error
flag.StringVar(&metricsAddr, "listen-address", ":9102", "The address to listen on for HTTP requests.")
flag.StringVar(&kmesgREStr, "regexp-pattern", kmesgREStr, "The regexp pattern matching and extracting Pod UID and Container ID.")
dockerClient, err = docker_client.NewEnvClient()
if err != nil {
glog.Fatal(err)
Expand All @@ -44,6 +46,7 @@ func init() {

func main() {
flag.Parse()
kmesgRE = regexp.MustCompile(kmesgREStr)

var labels []string
for _, label := range prometheusContainerLabels {
Expand Down

0 comments on commit a73d21f

Please sign in to comment.