Fix stats inputs
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Adam Štrauch 2022-02-07 17:18:44 +01:00
parent 69e46f577a
commit 1d1a225be6
Signed by: cx
GPG Key ID: 018304FFA8988F8D
3 changed files with 21 additions and 0 deletions

View File

@ -69,6 +69,9 @@ func (p *Processor) waitForApp() error {
statsProcessor := StatsProcessor{
DB: p.DB,
DockerSock: p.DockerSock,
BindIPHTTP: p.BindIPHTTP,
BindIPSSH: p.BindIPSSH,
AppsPath: p.AppsPath,
}
for i := 0; i < loops; i++ {
@ -104,6 +107,9 @@ func (p *Processor) List() (apps.Apps, error) {
statsProcessor := StatsProcessor{
DB: p.DB,
DockerSock: p.DockerSock,
BindIPHTTP: p.BindIPHTTP,
BindIPSSH: p.BindIPSSH,
AppsPath: p.AppsPath,
}
err := statsProcessor.GatherStates()
@ -128,6 +134,9 @@ func (p *Processor) Get() (apps.App, error) {
statsProcessor := StatsProcessor{
DB: p.DB,
DockerSock: p.DockerSock,
BindIPHTTP: p.BindIPHTTP,
BindIPSSH: p.BindIPSSH,
AppsPath: p.AppsPath,
}
err := statsProcessor.UpdateState(p.AppName)

View File

@ -13,6 +13,9 @@ import (
type StatsProcessor struct {
DB *gorm.DB
DockerSock string
BindIPHTTP string
BindIPSSH string
AppsPath string
}
// returns instance of getAppProcessor
@ -36,6 +39,9 @@ func (s *StatsProcessor) UpdateUsage(name string) error {
container := docker.Container{
App: &app,
DockerSock: s.DockerSock,
BindIPHTTP: s.BindIPHTTP,
BindIPSSH: s.BindIPSSH,
AppsPath: s.AppsPath,
}
state, err := container.GetState()
@ -67,6 +73,9 @@ func (s *StatsProcessor) UpdateState(name string) error {
container := docker.Container{
App: &app,
DockerSock: s.DockerSock,
BindIPHTTP: s.BindIPHTTP,
BindIPSSH: s.BindIPSSH,
AppsPath: s.AppsPath,
}
state, err := container.Status()
if err != nil {

View File

@ -76,6 +76,9 @@ func main() {
statsProcessor := glue.StatsProcessor{
DB: common.GetDBConnection(),
DockerSock: config.DockerSocket,
BindIPHTTP: config.AppsBindIPHTTP,
BindIPSSH: config.AppsBindIPSSH,
AppsPath: config.AppsPath,
}
for {