#include "data_types.hpp" #include "functor.hpp" #include "monitor.hpp" #include "conditions.hpp" #include "actions.hpp" namespace phosphor { namespace dbus { namespace monitoring { // Example vector of sensors constructing a group static Group fan_zone_group = { std::make_tuple( "/xyz/openbmc_project/sensors/fan_tach/fan0", static_cast(0) ), std::make_tuple( "/xyz/openbmc_project/sensors/fan_tach/fan1", static_cast(0) ), std::make_tuple( "/xyz/openbmc_project/sensors/fan_tach/fan2", static_cast(0) ), std::make_tuple( "/xyz/openbmc_project/sensors/fan_tach/fan3", static_cast(0) ) }; const std::vector>, std::vector>> Monitor::events { // Example vector of Events with START trigger {std::make_tuple(std::vector>( { // Example vector of StartEvent std::make_shared( std::vector( { // Example vector of StartEvent conditions make_condition(propertyStart( "/xyz/openbmc_project/sensors/fan_tach/fan0", "xyz.openbmc_project.Sensor.Value", "Value", condition::countAtOrAbove( fan_zone_group, "/xyz/openbmc_project/sensors/fan_tach/fan0", static_cast(3), static_cast(8000ll) ) )), make_condition(propertyStart( "/xyz/openbmc_project/sensors/fan_tach/fan1", "xyz.openbmc_project.Sensor.Value", "Value", condition::countAtOrAbove( fan_zone_group, "/xyz/openbmc_project/sensors/fan_tach/fan1", static_cast(3), static_cast(8000ll) ) )), make_condition(propertyStart( "/xyz/openbmc_project/sensors/fan_tach/fan2", "xyz.openbmc_project.Sensor.Value", "Value", condition::countAtOrAbove( fan_zone_group, "/xyz/openbmc_project/sensors/fan_tach/fan2", static_cast(3), static_cast(8000ll) ) )), make_condition(propertyStart( "/xyz/openbmc_project/sensors/fan_tach/fan3", "xyz.openbmc_project.Sensor.Value", "Value", condition::countAtOrAbove( fan_zone_group, "/xyz/openbmc_project/sensors/fan_tach/fan3", static_cast(3), static_cast(8000ll) ) )), } ) ), std::make_shared( "interface='org.freedesktop.DBus.Properties'," "member='PropertiesChanged'," "type='signal'," "path='/xyz/openbmc_project/sensors/fan_tach/fan0'", std::vector( { // Example vector of SignalEvent conditions make_condition(propertySignal( "xyz.openbmc_project.Sensor.Value", "Value", condition::countAtOrAbove( fan_zone_group, "/xyz/openbmc_project/sensors/fan_tach/fan0", static_cast(3), static_cast(8000ll) ) )) } ) ), std::make_shared( "interface='org.freedesktop.DBus.Properties'," "member='PropertiesChanged'," "type='signal'," "path='/xyz/openbmc_project/sensors/fan_tach/fan1'", std::vector( { // Example vector of SignalEvent conditions make_condition(propertySignal( "xyz.openbmc_project.Sensor.Value", "Value", condition::countAtOrAbove( fan_zone_group, "/xyz/openbmc_project/sensors/fan_tach/fan1", static_cast(3), static_cast(8000ll) ) )) } ) ), std::make_shared( "interface='org.freedesktop.DBus.Properties'," "member='PropertiesChanged'," "type='signal'," "path='/xyz/openbmc_project/sensors/fan_tach/fan2'", std::vector( { // Example vector of SignalEvent conditions make_condition(propertySignal( "xyz.openbmc_project.Sensor.Value", "Value", condition::countAtOrAbove( fan_zone_group, "/xyz/openbmc_project/sensors/fan_tach/fan2", static_cast(3), static_cast(8000ll) ) )) } ) ), std::make_shared( "interface='org.freedesktop.DBus.Properties'," "member='PropertiesChanged'," "type='signal'," "path='/xyz/openbmc_project/sensors/fan_tach/fan3'", std::vector( { // Example vector of SignalEvent conditions make_condition(propertySignal( "xyz.openbmc_project.Sensor.Value", "Value", condition::countAtOrAbove( fan_zone_group, "/xyz/openbmc_project/sensors/fan_tach/fan3", static_cast(3), static_cast(8000ll) ) )) } ) ) }), std::vector( { make_action( action::log_error( "ERROR: Number of fans at or above 8000rpms reached" ) ) }) )} }; } // namespace monitoring } // namespace dbus } // namespace phosphor