diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | configure.ac | 22 | ||||
-rw-r--r-- | monitor/Makefile.am | 8 | ||||
-rw-r--r-- | monitor/example/monitor.yaml | 35 | ||||
-rw-r--r-- | monitor/generated.cpp | 54 |
5 files changed, 65 insertions, 55 deletions
@@ -23,3 +23,4 @@ phosphor-fan-control fan_zone_defs.cpp
phosphor-fan-monitor
phosphor-cooling-type
+fan_monitor_defs.cpp
diff --git a/configure.ac b/configure.ac index eb6e086..93c1523 100644 --- a/configure.ac +++ b/configure.ac @@ -57,6 +57,8 @@ AC_ARG_ENABLE([control], AS_HELP_STRING([--disable-control], [Disable fan control package.])) AC_ARG_ENABLE([cooling-type], AS_HELP_STRING([--disable-cooling-type], [Disable cooling-type package.])) +AC_ARG_ENABLE([monitor-type], + AS_HELP_STRING([--disable-monitor-type], [Disable monitor-type package.])) AM_CONDITIONAL([WANT_PRESENCE], [test "x$enable_presence" != "xno"]) AM_CONDITIONAL([WANT_CONTROL], [test "x$enable_control" != "xno"]) @@ -115,6 +117,26 @@ AS_IF([test "x$enable_cooling-type" != "xno"], [ AC_CONFIG_FILES([chassis-cooling-type/Makefile]) ]) AS_IF([test "x$enable_monitor" != "xno"], [ + + AC_ARG_VAR(FAN_MONITOR_YAML_FILE, + [The fan monitor definition file to use]) + AS_IF([test "x$FAN_MONITOR_YAML_FILE" == "x"], + [FAN_MONITOR_YAML_FILE="${srcdir}/monitor/example/monitor.yaml"]) + AC_DEFINE_UNQUOTED([FAN_MONITOR_YAML_FILE], ["$FAN_MONITOR_YAML_FILE"], + [The fan monitor definition file to use]) + + AC_ARG_VAR(FAN_MONITOR_OUTPUT_DIR, + [The output directory for the generated fan monitor data file]) + AS_IF([test "x$FAN_MONITOR_OUTPUT_DIR" == "x"], + [FAN_MONITOR_OUTPUT_DIR="${srcdir}/monitor/"]) + AC_DEFINE_UNQUOTED([FAN_MONITOR_OUTPUT_DIR], ["$FAN_MONITOR_OUTPUT_DIR"], + [The output directory for the generated fan monitor data file]) + + AC_SUBST([GEN_FAN_MONITOR_DEFS], + [$PYTHON ${srcdir}/monitor/gen-fan-monitor-defs.py \ + -m $FAN_MONITOR_YAML_FILE \ + -o $FAN_MONITOR_OUTPUT_DIR]) + AC_CONFIG_FILES([monitor/Makefile]) ]) diff --git a/monitor/Makefile.am b/monitor/Makefile.am index 6c6f4b3..f54248e 100644 --- a/monitor/Makefile.am +++ b/monitor/Makefile.am @@ -6,10 +6,14 @@ sbin_PROGRAMS = \ phosphor_fan_monitor_SOURCES = \ fan.cpp \ - generated.cpp \ main.cpp \ tach_sensor.cpp +nodist_phosphor_fan_monitor_SOURCES = \ + fan_monitor_defs.cpp + +BUILT_SOURCES = fan_monitor_defs.cpp + phosphor_fan_monitor_LDADD = \ $(top_builddir)/libfan.la \ $(SDBUSPLUS_LIBS) \ @@ -19,3 +23,5 @@ phosphor_fan_monitor_CXXFLAGS = \ $(SDBUSPLUS_CFLAGS) \ $(PHOSPHOR_LOGGING_CFLAGS) +fan_monitor_defs.cpp: ${srcdir}/gen-fan-monitor-defs.py + $(AM_V_GEN)$(GEN_FAN_MONITOR_DEFS) diff --git a/monitor/example/monitor.yaml b/monitor/example/monitor.yaml new file mode 100644 index 0000000..b3dd306 --- /dev/null +++ b/monitor/example/monitor.yaml @@ -0,0 +1,35 @@ +#Example fan monitor definitions for phosphor-fan-monitor + +#List the fans that need to be monitored, along with some +#properties that define how much slack is allowed in the actual +#tach value as compared to the target tach value. + +#- inventory: +# [The system inventory location for the fan] +# allowed_out_of_range_time: +# [Time (in secs) actual speed can be outside of deviation of +# target speed] +# deviation: +# [Percentage that actual speed must be within target speed] +# num_sensors_nonfunc_for_fan_nonfunc: +# [How many sensors on the fan must be faulted before fan +# will be considered faulted] +# sensors: [array of speed sensors for the fan] +# - name [The name of the fan sensor] +# has_target [true|false If this sensor has a Target property for +# setting a fan speed (otherwise just for reads)] + +#The code uses these parameters as follows: +# After a speed reading of a sensor is outside of the allowed deviation of +# the target speed for the allowed out of range time, if at least +# num_sensors_nonfunc_for_fan_nonfunc sensors meet this condition, +# the fan will be set to nonfunctional in the inventory. + +#Example entries for 1 fan system: +# - inventory: /system/chassis/motherboard/fan0 +# allowed_out_of_range_time: 15 +# deviation: 15 +# num_sensors_nonfunc_for_fan_nonfunc: 1 +# sensors: +# - name: fan0 +# has_target: true diff --git a/monitor/generated.cpp b/monitor/generated.cpp deleted file mode 100644 index 7578b92..0000000 --- a/monitor/generated.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/** - * Copyright © 2017 IBM Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "fan_defs.hpp" -#include "types.hpp" - -//This file will be replaced by a generated version in a later commit - -using namespace phosphor::fan::monitor; - -const std::vector<FanDefinition> fanDefinitions -{ - - FanDefinition{"/system/chassis/motherboard/fan0", - 15, - 15, - 1, - std::vector<SensorDefinition>{ - SensorDefinition{"fan0", true} - }}, - FanDefinition{"/system/chassis/motherboard/fan1", - 15, - 15, - 1, - std::vector<SensorDefinition>{ - SensorDefinition{"fan1", true} - }}, - FanDefinition{"/system/chassis/motherboard/fan2", - 15, - 15, - 1, - std::vector<SensorDefinition>{ - SensorDefinition{"fan2", true} - }}, - FanDefinition{"/system/chassis/motherboard/fan3", - 15, - 15, - 1, - std::vector<SensorDefinition>{ - SensorDefinition{"fan3", true} - }} -}; |