Skip to content

Commit

Permalink
+ faults-only option for only monitoring faults
Browse files Browse the repository at this point in the history
  • Loading branch information
brightpuddle committed Feb 16, 2021
1 parent 77e1121 commit 9992ff2
Showing 1 changed file with 30 additions and 19 deletions.
49 changes: 30 additions & 19 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -739,17 +739,19 @@ func getFabric() fabricObject {
log.Error(err)
continue
}
if devices, err = getDevices(); err != nil {
log.Error(err)
continue
}
if pods, err = getPods(); err != nil {
log.Error(err)
continue
}
if isisRoutes, err = getISISRoutes(pods); err != nil {
log.Error(err)
continue
if !client.cfg.FaultsOnly {
if devices, err = getDevices(); err != nil {
log.Error(err)
continue
}
if pods, err = getPods(); err != nil {
log.Error(err)
continue
}
if isisRoutes, err = getISISRoutes(pods); err != nil {
log.Error(err)
continue
}
}
ok = true
}
Expand Down Expand Up @@ -822,6 +824,7 @@ type Config struct {
Password string `arg:"-p" help:"password"`
Snapshot string `arg:"-s" help:"Snapshot file"`
Verbose bool `arg:"-v"`
FaultsOnly bool `arg:"--faults-only" help:"Only monitor faults"`
RequestTimeout int `arg:"--request-timeout" help:"HTTP request timeout"`
LoginRetryInterval int `arg:"--login-retry-interval" help:"Login retry interval"`
}
Expand Down Expand Up @@ -865,22 +868,30 @@ func requestLoop(fabric fabricObject) error {
return err
}
}
statuses, err := getUpgradeStatuses(fabric.devices)
if err != nil {
return err
}
if verifyUpgradeState(statuses) == stable {
if client.cfg.FaultsOnly {
currentFaults, err := getFaults()
if err != nil {
return err
}
verifyFaults(fabric.faults, currentFaults)
if len(fabric.pods) > 1 {
isisRoutes, err := getISISRoutes(fabric.pods)
} else {
statuses, err := getUpgradeStatuses(fabric.devices)
if err != nil {
return err
}
if verifyUpgradeState(statuses) == stable {
currentFaults, err := getFaults()
if err != nil {
return err
}
verifyInterpodRoutes(fabric, isisRoutes)
verifyFaults(fabric.faults, currentFaults)
if len(fabric.pods) > 1 {
isisRoutes, err := getISISRoutes(fabric.pods)
if err != nil {
return err
}
verifyInterpodRoutes(fabric, isisRoutes)
}
}
}
log.Info("Sleeping for 10 seconds...")
Expand Down

0 comments on commit 9992ff2

Please sign in to comment.