mirror of
https://github.com/telekom-security/tpotce.git
synced 2025-07-01 20:42:11 +00:00
turn logging noiselevel down
This commit is contained in:
parent
77cd9df8f7
commit
0e64b48388
2 changed files with 39 additions and 0 deletions
|
@ -19,6 +19,7 @@ RUN apk -U --no-cache add \
|
||||||
mkdir -p /opt/go/ && \
|
mkdir -p /opt/go/ && \
|
||||||
go get -d github.com/mushorg/glutton && \
|
go get -d github.com/mushorg/glutton && \
|
||||||
go get -u github.com/golang/dep/cmd/dep && \
|
go get -u github.com/golang/dep/cmd/dep && \
|
||||||
|
mv /root/dist/system.go /opt/go/src/github.com/mushorg/glutton/ && \
|
||||||
cd /opt/go/src/github.com/mushorg/glutton/ && \
|
cd /opt/go/src/github.com/mushorg/glutton/ && \
|
||||||
/opt/go/bin/dep ensure && \
|
/opt/go/bin/dep ensure && \
|
||||||
make build && \
|
make build && \
|
||||||
|
|
38
docker/glutton/dist/system.go
vendored
Normal file
38
docker/glutton/dist/system.go
vendored
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
package glutton
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
"os/exec"
|
||||||
|
"runtime"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
func countOpenFiles() int {
|
||||||
|
out, err := exec.Command("/bin/sh", "-c", fmt.Sprintf("lsof -p %v", os.Getpid())).Output()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
lines := strings.Split(string(out), "\n")
|
||||||
|
return len(lines) - 1
|
||||||
|
}
|
||||||
|
|
||||||
|
func countRunningRoutines() int {
|
||||||
|
return runtime.NumGoroutine()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *Glutton) startMonitor(quit chan struct{}) {
|
||||||
|
ticker := time.NewTicker(10 * time.Second)
|
||||||
|
go func() {
|
||||||
|
for {
|
||||||
|
select {
|
||||||
|
case <-quit:
|
||||||
|
g.logger.Info("[system ] Monitoring stopped..")
|
||||||
|
ticker.Stop()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
}
|
Loading…
Reference in a new issue