-
Notifications
You must be signed in to change notification settings - Fork 44
Expand file tree
/
Copy pathcheck_redfish.py
More file actions
executable file
·78 lines (60 loc) · 3.02 KB
/
check_redfish.py
File metadata and controls
executable file
·78 lines (60 loc) · 3.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2020 - 2026 Ricardo Bartels. All rights reserved.
#
# check_redfish.py
#
# This work is licensed under the terms of the MIT license.
# For a copy, see file LICENSE.txt included in this
# repository or visit: <https://opensource.org/licenses/MIT>.
description = """
This is a monitoring/inventory plugin to check components and
health status of systems which support Redfish.
It will also create a inventory of all components of a system.
"""
__version__ = "2.1.2"
__version_date__ = "2026-03-16"
__author__ = "Ricardo Bartels <ricardo@bitchbrothers.com>"
__description__ = "Check Redfish Plugin"
__license__ = "MIT"
import logging
from cr_module.classes.plugin import PluginData
from cr_module.system_chassis import get_system_info, get_chassis_data, get_system_data
from cr_module.nic import get_network_interfaces
from cr_module.storage import get_storage
from cr_module.bmc import get_bmc_info
from cr_module.firmware import get_firmware_info
from cr_module.event import get_event_log
from cr_module.args import parse_command_line
from cr_module.classes.inventory import Fan, PowerSupply, Temperature, Memory, Processor
class CheckRedfish:
def __init__(self):
self.args = parse_command_line(description, __version__, __version_date__)
def main(self):
if self.args.verbose:
# initialize logger
logging.basicConfig(level="DEBUG", format='%(asctime)s - %(levelname)s: %(message)s')
# initialize plugin object
plugin = PluginData(self.args, plugin_version=__version__)
# try to get systems, managers and chassis IDs
plugin.rf.discover_system_properties()
# get basic information
plugin.rf.determine_vendor()
if any(x in self.args.requested_query for x in ['power', 'all']): get_chassis_data(PowerSupply)
if any(x in self.args.requested_query for x in ['temp', 'all']): get_chassis_data(Temperature)
if any(x in self.args.requested_query for x in ['fan', 'all']): get_chassis_data(Fan)
if any(x in self.args.requested_query for x in ['proc', 'all']): get_system_data(Processor)
if any(x in self.args.requested_query for x in ['memory', 'all']): get_system_data(Memory)
if any(x in self.args.requested_query for x in ['nic', 'all']): get_network_interfaces()
if any(x in self.args.requested_query for x in ['storage', 'all']): get_storage()
if any(x in self.args.requested_query for x in ['bmc', 'all']): get_bmc_info()
if any(x in self.args.requested_query for x in ['info', 'all']): get_system_info()
if any(x in self.args.requested_query for x in ['firmware', 'all']): get_firmware_info()
if any(x in self.args.requested_query for x in ['mel', 'all']): get_event_log("Manager")
if any(x in self.args.requested_query for x in ['sel', 'all']): get_event_log("System")
plugin.do_exit()
def main():
CheckRedfish().main()
if __name__ == "__main__":
main()
# EOF