Show alert count in lotus-miner info
This commit is contained in:
parent
e2ba650a8c
commit
d6e309aa01
@ -32,6 +32,7 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
lcli "github.com/filecoin-project/lotus/cli"
|
lcli "github.com/filecoin-project/lotus/cli"
|
||||||
|
"github.com/filecoin-project/lotus/journal/alerting"
|
||||||
)
|
)
|
||||||
|
|
||||||
var infoCmd = &cli.Command{
|
var infoCmd = &cli.Command{
|
||||||
@ -116,6 +117,21 @@ func infoCmdAct(cctx *cli.Context) error {
|
|||||||
|
|
||||||
fmt.Println()
|
fmt.Println()
|
||||||
|
|
||||||
|
alerts, err := minerApi.LogAlerts(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return xerrors.Errorf("getting alerts: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
activeAlerts := make([]alerting.Alert, 0)
|
||||||
|
for _, alert := range alerts {
|
||||||
|
if alert.Active {
|
||||||
|
activeAlerts = append(activeAlerts, alert)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if len(activeAlerts) > 0 {
|
||||||
|
fmt.Printf("%s (check %s)\n", color.RedString("⚠ %d Active alerts", len(activeAlerts)), color.YellowString("lotus-miner log alerts"))
|
||||||
|
}
|
||||||
|
|
||||||
err = handleMiningInfo(ctx, cctx, fullapi, minerApi)
|
err = handleMiningInfo(ctx, cctx, fullapi, minerApi)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user