-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #205 from bbc/arista-power-fix
arista-switch: add check for power supply
- Loading branch information
Showing
4 changed files
with
40 additions
and
4 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
src/modules/arista-switch/container/services/status-checkpower.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
"use strict"; | ||
|
||
const StatusItem = require("@core/StatusItem"); | ||
const mongoSingle = require("@core/mongo-single"); | ||
|
||
module.exports = async () => { | ||
const power = await mongoSingle.get("power"); | ||
const statusItems = []; | ||
|
||
for (const [key, value] of Object.entries(power)) { | ||
if (value.state === "powerLoss") { | ||
statusItems.push( | ||
new StatusItem({ | ||
key: `power${key}`, | ||
message: [`Power supply ${key} has failed`], | ||
type: "warning", | ||
}) | ||
); | ||
} | ||
} | ||
|
||
return statusItems; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters