zhangqian
2023-11-02 7c1dd2e19119edd1ab147a699dfdcd11447fca14
service/problem/check.go
@@ -3,9 +3,12 @@
import (
   "apsClient/conf"
   "apsClient/constvar"
   "apsClient/model"
   "apsClient/pkg/sqlitex"
   "apsClient/service"
   "apsClient/service/plc_address"
   "fmt"
   "net"
   "sync"
)
@@ -103,7 +106,19 @@
type Network struct{}
func (slf *Network) Check() bool {
   return false
   ifaces, err := net.Interfaces()
   if err != nil {
      fmt.Println("Error:", err)
      return false
   }
   var netAllFailed bool
   for _, iFace := range ifaces {
      if iFace.Flags == net.FlagUp {
         netAllFailed = false
         fmt.Printf("Interface %s is DOWN, indicating a network issue.\n", iFace.Name)
      }
   }
   return !netAllFailed
}
type DB struct{}
@@ -125,7 +140,11 @@
type Nsq struct{}
func (slf *Nsq) Check() bool {
   return false
   old, err := model.NewSystemStatusSearch().SetKey(constvar.SystemStatusKeyNsq).First()
   if err != nil {
      return false
   }
   return old.Value == constvar.SystemStatusValueNormal
}
type Device struct{}