Commit 46e0ed27 authored by Joanne Hugé's avatar Joanne Hugé

WIP

parent 02d9e65b
...@@ -24,23 +24,23 @@ md5sum = 6e0a052bd0ca08cc0c7b4880d3deffcc ...@@ -24,23 +24,23 @@ md5sum = 6e0a052bd0ca08cc0c7b4880d3deffcc
[template-lte-enb-epc] [template-lte-enb-epc]
_update_hash_filename_ = instance-enb-epc.jinja2.cfg _update_hash_filename_ = instance-enb-epc.jinja2.cfg
md5sum = f15c81f0f4c2aa59bc794d855e7d01c0 md5sum = 3b13bbf633e196dfa8d379221845be67
[template-lte-enb] [template-lte-enb]
_update_hash_filename_ = instance-enb.jinja2.cfg _update_hash_filename_ = instance-enb.jinja2.cfg
md5sum = 68362f58fccc534757b6bb566d285fa6 md5sum = 42717e9676f567c8fa4920df086bd913
[template-lte-gnb-epc] [template-lte-gnb-epc]
_update_hash_filename_ = instance-gnb-epc.jinja2.cfg _update_hash_filename_ = instance-gnb-epc.jinja2.cfg
md5sum = dd98a2d0cb4fadc869638166bde6d9c8 md5sum = f55c2e859cfeacc41878ccbb0f8254e9
[template-lte-epc] [template-lte-epc]
_update_hash_filename_ = instance-epc.jinja2.cfg _update_hash_filename_ = instance-epc.jinja2.cfg
md5sum = 48755eb0b2eb87f80130d42026ea8f7b md5sum = f32c0c82ddb0a99137b41c376b7863c5
[template-lte-gnb] [template-lte-gnb]
_update_hash_filename_ = instance-gnb.jinja2.cfg _update_hash_filename_ = instance-gnb.jinja2.cfg
md5sum = 45ff1f5f4e98867449dcff7caae678f8 md5sum = 56ae82ebe6708737ea353ee859322507
[template-lte-mme] [template-lte-mme]
_update_hash_filename_ = instance-mme.jinja2.cfg _update_hash_filename_ = instance-mme.jinja2.cfg
...@@ -48,11 +48,11 @@ md5sum = 728f4d3ae248710c23e4b73eea4d628e ...@@ -48,11 +48,11 @@ md5sum = 728f4d3ae248710c23e4b73eea4d628e
[template-lte-ue-lte] [template-lte-ue-lte]
_update_hash_filename_ = instance-ue-lte.jinja2.cfg _update_hash_filename_ = instance-ue-lte.jinja2.cfg
md5sum = 38ef57bc93f53338187bd9c39fe4f0c5 md5sum = 5990aeeb7bdbfdcb871c59054e2f6c8a
[template-lte-ue-nr] [template-lte-ue-nr]
_update_hash_filename_ = instance-ue-nr.jinja2.cfg _update_hash_filename_ = instance-ue-nr.jinja2.cfg
md5sum = eaaf8fb3806a941f188eecdb90d38bda md5sum = 22b7130f342f9b8890dc3c6011db8a46
[ue_db.jinja2.cfg] [ue_db.jinja2.cfg]
filename = config/ue_db.jinja2.cfg filename = config/ue_db.jinja2.cfg
...@@ -108,7 +108,7 @@ md5sum = 5bf57a9074ea5b054d999789cbbe2c87 ...@@ -108,7 +108,7 @@ md5sum = 5bf57a9074ea5b054d999789cbbe2c87
[cpu-temperature-promise] [cpu-temperature-promise]
_update_hash_filename_ = promise/check_cpu_temperature.py _update_hash_filename_ = promise/check_cpu_temperature.py
md5sum = 8e8f836554d81e2979e39dfb50e05b88 md5sum = 3400f7c6928234631b08f0dd040d0a2a
[interface-up-promise] [interface-up-promise]
_update_hash_filename_ = promise/check_interface_up.py _update_hash_filename_ = promise/check_interface_up.py
......
...@@ -93,7 +93,10 @@ eggs = slapos.core ...@@ -93,7 +93,10 @@ eggs = slapos.core
file = {{ cpu_temperature_promise }} file = {{ cpu_temperature_promise }}
output = ${directory:plugins}/check-cpu-temperature.py output = ${directory:plugins}/check-cpu-temperature.py
config-testing = {{ slapparameter_dict.get("testing", False) }} config-testing = {{ slapparameter_dict.get("testing", False) }}
config-max-temp = {{ slapparameter_dict.get("promise_cpu_temperature_threshold", 80) }} config-max-spot-temp = {{ slapparameter_dict.get("promise_cpu_max_spot_temp", 90) }}
config-max-avg-temp = {{ slapparameter_dict.get("promise_cpu_max_avg_temp", 80) }}
config-avg-temp-duration = {{ slapparameter_dict.get("promise_cpu_avg_temp_duration", 15) }}
config-last-avg-computation-file = ${directory:var}/promise_cpu_last_avg_computation_file
[publish-connection-information] [publish-connection-information]
recipe = slapos.cookbook:publish.serialised recipe = slapos.cookbook:publish.serialised
......
...@@ -132,11 +132,23 @@ ...@@ -132,11 +132,23 @@
"type": "number", "type": "number",
"default": 0 "default": 0
}, },
"promise_cpu_temperature_threshold": { "promise_cpu_max_spot_temp": {
"title": "CPU temperature promise threshold", "title": "Maximum CPU spot temperature (Celcius)",
"description": "Temperature threshold above which CPU temperature promise will fail", "description": "Temperature threshold above which CPU temperature promise will fail",
"type": "number", "type": "number",
"default": 90
},
"promise_cpu_max_avg_temp": {
"title": "Maximum CPU average temperature (Celcius)",
"description": "If average temperature over specified duration reaches this threshold, promise will fail",
"type": "number",
"default": 80 "default": 80
},
"promise_cpu_avg_temp_duration": {
"title": "CPU average temperature duration (minutes)",
"description": "Duration during which average temperature should not exceed specified threshold",
"type": "number",
"default": 15
} }
} }
} }
...@@ -208,4 +208,6 @@ eggs = slapos.core ...@@ -208,4 +208,6 @@ eggs = slapos.core
file = {{ cpu_temperature_promise }} file = {{ cpu_temperature_promise }}
output = ${directory:plugins}/check-cpu-temperature.py output = ${directory:plugins}/check-cpu-temperature.py
config-testing = {{ slapparameter_dict.get("testing", False) }} config-testing = {{ slapparameter_dict.get("testing", False) }}
config-maxtemp = {{ slapparameter_dict.get("promise_cpu_temperature_threshold", 80) }} config-max-spot-temp = {{ slapparameter_dict.get("promise_cpu_max_spot_temp", 90) }}
config-max-avg-temp = {{ slapparameter_dict.get("promise_cpu_max_avg_temp", 80) }}
config-avg-temp-duration = {{ slapparameter_dict.get("promise_cpu_avg_temp_duration", 15) }}
...@@ -27,11 +27,23 @@ ...@@ -27,11 +27,23 @@
"description": "Set to true to use IPv4 for AMF / MME addresses", "description": "Set to true to use IPv4 for AMF / MME addresses",
"type": "boolean" "type": "boolean"
}, },
"promise_cpu_temperature_threshold": { "promise_cpu_max_spot_temp": {
"title": "CPU temperature promise threshold", "title": "Maximum CPU spot temperature (Celcius)",
"description": "Temperature threshold above which CPU temperature promise will fail", "description": "Temperature threshold above which CPU temperature promise will fail",
"type": "number", "type": "number",
"default": 80 "default": 80
},
"promise_cpu_max_avg_temp": {
"title": "Maximum CPU average temperature (Celcius)",
"description": "If average temperature over specified duration reaches this threshold, promise will fail",
"type": "number",
"default": 80
},
"promise_cpu_avg_temp_duration": {
"title": "CPU average temperature duration (minutes)",
"description": "Duration during which average temperature should not exceed specified threshold",
"type": "number",
"default": 15
} }
} }
} }
...@@ -82,7 +82,9 @@ eggs = slapos.core ...@@ -82,7 +82,9 @@ eggs = slapos.core
file = {{ cpu_temperature_promise }} file = {{ cpu_temperature_promise }}
output = ${directory:plugins}/check-cpu-temperature.py output = ${directory:plugins}/check-cpu-temperature.py
config-testing = {{ slapparameter_dict.get("testing", False) }} config-testing = {{ slapparameter_dict.get("testing", False) }}
config-max-temp = {{ slapparameter_dict.get("promise_cpu_temperature_threshold", 80) }} config-max-spot-temp = {{ slapparameter_dict.get("promise_cpu_max_spot_temp", 90) }}
config-max-avg-temp = {{ slapparameter_dict.get("promise_cpu_max_avg_temp", 80) }}
config-avg-temp-duration = {{ slapparameter_dict.get("promise_cpu_avg_temp_duration", 15) }}
[publish-connection-information] [publish-connection-information]
recipe = slapos.cookbook:publish.serialised recipe = slapos.cookbook:publish.serialised
......
...@@ -93,7 +93,9 @@ eggs = slapos.core ...@@ -93,7 +93,9 @@ eggs = slapos.core
file = {{ cpu_temperature_promise }} file = {{ cpu_temperature_promise }}
output = ${directory:plugins}/check-cpu-temperature.py output = ${directory:plugins}/check-cpu-temperature.py
config-testing = {{ slapparameter_dict.get("testing", False) }} config-testing = {{ slapparameter_dict.get("testing", False) }}
config-max-temp = {{ slapparameter_dict.get("promise_cpu_temperature_threshold", 80) }} config-max-spot-temp = {{ slapparameter_dict.get("promise_cpu_max_spot_temp", 90) }}
config-max-avg-temp = {{ slapparameter_dict.get("promise_cpu_max_avg_temp", 80) }}
config-avg-temp-duration = {{ slapparameter_dict.get("promise_cpu_avg_temp_duration", 15) }}
[publish-connection-information] [publish-connection-information]
recipe = slapos.cookbook:publish.serialised recipe = slapos.cookbook:publish.serialised
......
...@@ -184,11 +184,23 @@ ...@@ -184,11 +184,23 @@
"type": "number", "type": "number",
"default": 0 "default": 0
}, },
"promise_cpu_temperature_threshold": { "promise_cpu_max_spot_temp": {
"title": "CPU temperature promise threshold", "title": "Maximum CPU spot temperature (Celcius)",
"description": "Temperature threshold above which CPU temperature promise will fail", "description": "Temperature threshold above which CPU temperature promise will fail",
"type": "number", "type": "number",
"default": 80 "default": 80
},
"promise_cpu_max_avg_temp": {
"title": "Maximum CPU average temperature (Celcius)",
"description": "If average temperature over specified duration reaches this threshold, promise will fail",
"type": "number",
"default": 80
},
"promise_cpu_avg_temp_duration": {
"title": "CPU average temperature duration (minutes)",
"description": "Duration during which average temperature should not exceed specified threshold",
"type": "number",
"default": 15
} }
} }
} }
...@@ -208,4 +208,6 @@ eggs = slapos.core ...@@ -208,4 +208,6 @@ eggs = slapos.core
file = {{ cpu_temperature_promise }} file = {{ cpu_temperature_promise }}
output = ${directory:plugins}/check-cpu-temperature.py output = ${directory:plugins}/check-cpu-temperature.py
config-testing = {{ slapparameter_dict.get("testing", False) }} config-testing = {{ slapparameter_dict.get("testing", False) }}
config-max-temp = {{ slapparameter_dict.get("promise_cpu_temperature_threshold", 80) }} config-max-spot-temp = {{ slapparameter_dict.get("promise_cpu_max_spot_temp", 90) }}
config-max-avg-temp = {{ slapparameter_dict.get("promise_cpu_max_avg_temp", 80) }}
config-avg-temp-duration = {{ slapparameter_dict.get("promise_cpu_avg_temp_duration", 15) }}
...@@ -130,11 +130,23 @@ ...@@ -130,11 +130,23 @@
"type": "number", "type": "number",
"default": 0 "default": 0
}, },
"promise_cpu_temperature_threshold": { "promise_cpu_max_spot_temp": {
"title": "CPU temperature promise threshold", "title": "Maximum CPU spot temperature (Celcius)",
"description": "Temperature threshold above which CPU temperature promise will fail", "description": "Temperature threshold above which CPU temperature promise will fail",
"type": "number", "type": "number",
"default": 90
},
"promise_cpu_max_avg_temp": {
"title": "Maximum CPU average temperature (Celcius)",
"description": "If average temperature over specified duration reaches this threshold, promise will fail",
"type": "number",
"default": 80 "default": 80
},
"promise_cpu_avg_temp_duration": {
"title": "CPU average temperature duration (minutes)",
"description": "Duration during which average temperature should not exceed specified threshold",
"type": "number",
"default": 15
} }
} }
} }
...@@ -112,11 +112,23 @@ ...@@ -112,11 +112,23 @@
"type": "number", "type": "number",
"default": 0 "default": 0
}, },
"promise_cpu_temperature_threshold": { "promise_cpu_max_spot_temp": {
"title": "CPU temperature promise threshold", "title": "Maximum CPU spot temperature (Celcius)",
"description": "Temperature threshold above which CPU temperature promise will fail", "description": "Temperature threshold above which CPU temperature promise will fail",
"type": "number", "type": "number",
"default": 90
},
"promise_cpu_max_avg_temp": {
"title": "Maximum CPU average temperature (Celcius)",
"description": "If average temperature over specified duration reaches this threshold, promise will fail",
"type": "number",
"default": 80 "default": 80
},
"promise_cpu_avg_temp_duration": {
"title": "CPU average temperature duration (minutes)",
"description": "Duration during which average temperature should not exceed specified threshold",
"type": "number",
"default": 15
} }
} }
} }
...@@ -182,11 +182,23 @@ ...@@ -182,11 +182,23 @@
"type": "number", "type": "number",
"default": 0 "default": 0
}, },
"promise_cpu_temperature_threshold": { "promise_cpu_max_spot_temp": {
"title": "CPU temperature promise threshold", "title": "Maximum CPU spot temperature (Celcius)",
"description": "Temperature threshold above which CPU temperature promise will fail", "description": "Temperature threshold above which CPU temperature promise will fail",
"type": "number", "type": "number",
"default": 80 "default": 80
},
"promise_cpu_max_avg_temp": {
"title": "Maximum CPU average temperature (Celcius)",
"description": "If average temperature over specified duration reaches this threshold, promise will fail",
"type": "number",
"default": 80
},
"promise_cpu_avg_temp_duration": {
"title": "CPU average temperature duration (minutes)",
"description": "Duration during which average temperature should not exceed specified threshold",
"type": "number",
"default": 15
} }
} }
} }
...@@ -164,11 +164,23 @@ ...@@ -164,11 +164,23 @@
"type": "number", "type": "number",
"default": 0 "default": 0
}, },
"promise_cpu_temperature_threshold": { "promise_cpu_max_spot_temp": {
"title": "CPU temperature promise threshold", "title": "Maximum CPU spot temperature (Celcius)",
"description": "Temperature threshold above which CPU temperature promise will fail", "description": "Temperature threshold above which CPU temperature promise will fail",
"type": "number", "type": "number",
"default": 80 "default": 80
},
"promise_cpu_max_avg_temp": {
"title": "Maximum CPU average temperature (Celcius)",
"description": "If average temperature over specified duration reaches this threshold, promise will fail",
"type": "number",
"default": 80
},
"promise_cpu_avg_temp_duration": {
"title": "CPU average temperature duration (minutes)",
"description": "Duration during which average temperature should not exceed specified threshold",
"type": "number",
"default": 15
} }
} }
} }
...@@ -92,6 +92,24 @@ ...@@ -92,6 +92,24 @@
"description": "String. Defines user IMPI. Must be fully filled with hostname if necessary.", "description": "String. Defines user IMPI. Must be fully filled with hostname if necessary.",
"type": "string", "type": "string",
"default": "" "default": ""
},
"promise_cpu_max_spot_temp": {
"title": "Maximum CPU spot temperature (Celcius)",
"description": "Temperature threshold above which CPU temperature promise will fail",
"type": "number",
"default": 80
},
"promise_cpu_max_avg_temp": {
"title": "Maximum CPU average temperature (Celcius)",
"description": "If average temperature over specified duration reaches this threshold, promise will fail",
"type": "number",
"default": 80
},
"promise_cpu_avg_temp_duration": {
"title": "CPU average temperature duration (minutes)",
"description": "Duration during which average temperature should not exceed specified threshold",
"type": "number",
"default": 15
} }
} }
} }
...@@ -104,6 +104,24 @@ ...@@ -104,6 +104,24 @@
"description": "String. Defines user IMPI. Must be fully filled with hostname if necessary.", "description": "String. Defines user IMPI. Must be fully filled with hostname if necessary.",
"type": "string", "type": "string",
"default": "" "default": ""
},
"promise_cpu_max_spot_temp": {
"title": "Maximum CPU spot temperature (Celcius)",
"description": "Temperature threshold above which CPU temperature promise will fail",
"type": "number",
"default": 80
},
"promise_cpu_max_avg_temp": {
"title": "Maximum CPU average temperature (Celcius)",
"description": "If average temperature over specified duration reaches this threshold, promise will fail",
"type": "number",
"default": 80
},
"promise_cpu_avg_temp_duration": {
"title": "CPU average temperature duration (minutes)",
"description": "Duration during which average temperature should not exceed specified threshold",
"type": "number",
"default": 15
} }
} }
} }
...@@ -130,11 +130,23 @@ ...@@ -130,11 +130,23 @@
"type": "number", "type": "number",
"default": 0 "default": 0
}, },
"promise_cpu_temperature_threshold": { "promise_cpu_max_spot_temp": {
"title": "CPU temperature promise threshold", "title": "Maximum CPU spot temperature (Celcius)",
"description": "Temperature threshold above which CPU temperature promise will fail", "description": "Temperature threshold above which CPU temperature promise will fail",
"type": "number", "type": "number",
"default": 90
},
"promise_cpu_max_avg_temp": {
"title": "Maximum CPU average temperature (Celcius)",
"description": "If average temperature over specified duration reaches this threshold, promise will fail",
"type": "number",
"default": 80 "default": 80
},
"promise_cpu_avg_temp_duration": {
"title": "CPU average temperature duration (minutes)",
"description": "Duration during which average temperature should not exceed specified threshold",
"type": "number",
"default": 15
} }
} }
} }
...@@ -112,11 +112,23 @@ ...@@ -112,11 +112,23 @@
"type": "number", "type": "number",
"default": 0 "default": 0
}, },
"promise_cpu_temperature_threshold": { "promise_cpu_max_spot_temp": {
"title": "CPU temperature promise threshold", "title": "Maximum CPU spot temperature (Celcius)",
"description": "Temperature threshold above which CPU temperature promise will fail", "description": "Temperature threshold above which CPU temperature promise will fail",
"type": "number", "type": "number",
"default": 90
},
"promise_cpu_max_avg_temp": {
"title": "Maximum CPU average temperature (Celcius)",
"description": "If average temperature over specified duration reaches this threshold, promise will fail",
"type": "number",
"default": 80 "default": 80
},
"promise_cpu_avg_temp_duration": {
"title": "CPU average temperature duration (minutes)",
"description": "Duration during which average temperature should not exceed specified threshold",
"type": "number",
"default": 15
} }
} }
} }
...@@ -182,11 +182,23 @@ ...@@ -182,11 +182,23 @@
"type": "number", "type": "number",
"default": 0 "default": 0
}, },
"promise_cpu_temperature_threshold": { "promise_cpu_max_spot_temp": {
"title": "CPU temperature promise threshold", "title": "Maximum CPU spot temperature (Celcius)",
"description": "Temperature threshold above which CPU temperature promise will fail", "description": "Temperature threshold above which CPU temperature promise will fail",
"type": "number", "type": "number",
"default": 80 "default": 80
},
"promise_cpu_max_avg_temp": {
"title": "Maximum CPU average temperature (Celcius)",
"description": "If average temperature over specified duration reaches this threshold, promise will fail",
"type": "number",
"default": 80
},
"promise_cpu_avg_temp_duration": {
"title": "CPU average temperature duration (minutes)",
"description": "Duration during which average temperature should not exceed specified threshold",
"type": "number",
"default": 15
} }
} }
} }
...@@ -164,11 +164,23 @@ ...@@ -164,11 +164,23 @@
"type": "number", "type": "number",
"default": 0 "default": 0
}, },
"promise_cpu_temperature_threshold": { "promise_cpu_max_spot_temp": {
"title": "CPU temperature promise threshold", "title": "Maximum CPU spot temperature (Celcius)",
"description": "Temperature threshold above which CPU temperature promise will fail", "description": "Temperature threshold above which CPU temperature promise will fail",
"type": "number", "type": "number",
"default": 80 "default": 80
},
"promise_cpu_max_avg_temp": {
"title": "Maximum CPU average temperature (Celcius)",
"description": "If average temperature over specified duration reaches this threshold, promise will fail",
"type": "number",
"default": 80
},
"promise_cpu_avg_temp_duration": {
"title": "CPU average temperature duration (minutes)",
"description": "Duration during which average temperature should not exceed specified threshold",
"type": "number",
"default": 15
} }
} }
} }
...@@ -92,6 +92,24 @@ ...@@ -92,6 +92,24 @@
"description": "String. Defines user IMPI. Must be fully filled with hostname if necessary.", "description": "String. Defines user IMPI. Must be fully filled with hostname if necessary.",
"type": "string", "type": "string",
"default": "" "default": ""
},
"promise_cpu_max_spot_temp": {
"title": "Maximum CPU spot temperature (Celcius)",
"description": "Temperature threshold above which CPU temperature promise will fail",
"type": "number",
"default": 80
},
"promise_cpu_max_avg_temp": {
"title": "Maximum CPU average temperature (Celcius)",
"description": "If average temperature over specified duration reaches this threshold, promise will fail",
"type": "number",
"default": 80
},
"promise_cpu_avg_temp_duration": {
"title": "CPU average temperature duration (minutes)",
"description": "Duration during which average temperature should not exceed specified threshold",
"type": "number",
"default": 15
} }
} }
} }
...@@ -104,6 +104,24 @@ ...@@ -104,6 +104,24 @@
"description": "String. Defines user IMPI. Must be fully filled with hostname if necessary.", "description": "String. Defines user IMPI. Must be fully filled with hostname if necessary.",
"type": "string", "type": "string",
"default": "" "default": ""
},
"promise_cpu_max_spot_temp": {
"title": "Maximum CPU spot temperature (Celcius)",
"description": "Temperature threshold above which CPU temperature promise will fail",
"type": "number",
"default": 80
},
"promise_cpu_max_avg_temp": {
"title": "Maximum CPU average temperature (Celcius)",
"description": "If average temperature over specified duration reaches this threshold, promise will fail",
"type": "number",
"default": 80
},
"promise_cpu_avg_temp_duration": {
"title": "CPU average temperature duration (minutes)",
"description": "Duration during which average temperature should not exceed specified threshold",
"type": "number",
"default": 15
} }
} }
} }
...@@ -130,11 +130,23 @@ ...@@ -130,11 +130,23 @@
"type": "number", "type": "number",
"default": 0 "default": 0
}, },
"promise_cpu_temperature_threshold": { "promise_cpu_max_spot_temp": {
"title": "CPU temperature promise threshold", "title": "Maximum CPU spot temperature (Celcius)",
"description": "Temperature threshold above which CPU temperature promise will fail", "description": "Temperature threshold above which CPU temperature promise will fail",
"type": "number", "type": "number",
"default": 90
},
"promise_cpu_max_avg_temp": {
"title": "Maximum CPU average temperature (Celcius)",
"description": "If average temperature over specified duration reaches this threshold, promise will fail",
"type": "number",
"default": 80 "default": 80
},
"promise_cpu_avg_temp_duration": {
"title": "CPU average temperature duration (minutes)",
"description": "Duration during which average temperature should not exceed specified threshold",
"type": "number",
"default": 15
} }
} }
} }
...@@ -112,11 +112,23 @@ ...@@ -112,11 +112,23 @@
"type": "number", "type": "number",
"default": 0 "default": 0
}, },
"promise_cpu_temperature_threshold": { "promise_cpu_max_spot_temp": {
"title": "CPU temperature promise threshold", "title": "Maximum CPU spot temperature (Celcius)",
"description": "Temperature threshold above which CPU temperature promise will fail", "description": "Temperature threshold above which CPU temperature promise will fail",
"type": "number", "type": "number",
"default": 90
},
"promise_cpu_max_avg_temp": {
"title": "Maximum CPU average temperature (Celcius)",
"description": "If average temperature over specified duration reaches this threshold, promise will fail",
"type": "number",
"default": 80 "default": 80
},
"promise_cpu_avg_temp_duration": {
"title": "CPU average temperature duration (minutes)",
"description": "Duration during which average temperature should not exceed specified threshold",
"type": "number",
"default": 15
} }
} }
} }
...@@ -182,11 +182,23 @@ ...@@ -182,11 +182,23 @@
"type": "number", "type": "number",
"default": 0 "default": 0
}, },
"promise_cpu_temperature_threshold": { "promise_cpu_max_spot_temp": {
"title": "CPU temperature promise threshold", "title": "Maximum CPU spot temperature (Celcius)",
"description": "Temperature threshold above which CPU temperature promise will fail", "description": "Temperature threshold above which CPU temperature promise will fail",
"type": "number", "type": "number",
"default": 80 "default": 80
},
"promise_cpu_max_avg_temp": {
"title": "Maximum CPU average temperature (Celcius)",
"description": "If average temperature over specified duration reaches this threshold, promise will fail",
"type": "number",
"default": 80
},
"promise_cpu_avg_temp_duration": {
"title": "CPU average temperature duration (minutes)",
"description": "Duration during which average temperature should not exceed specified threshold",
"type": "number",
"default": 15
} }
} }
} }
...@@ -164,11 +164,23 @@ ...@@ -164,11 +164,23 @@
"type": "number", "type": "number",
"default": 0 "default": 0
}, },
"promise_cpu_temperature_threshold": { "promise_cpu_max_spot_temp": {
"title": "CPU temperature promise threshold", "title": "Maximum CPU spot temperature (Celcius)",
"description": "Temperature threshold above which CPU temperature promise will fail", "description": "Temperature threshold above which CPU temperature promise will fail",
"type": "number", "type": "number",
"default": 80 "default": 80
},
"promise_cpu_max_avg_temp": {
"title": "Maximum CPU average temperature (Celcius)",
"description": "If average temperature over specified duration reaches this threshold, promise will fail",
"type": "number",
"default": 80
},
"promise_cpu_avg_temp_duration": {
"title": "CPU average temperature duration (minutes)",
"description": "Duration during which average temperature should not exceed specified threshold",
"type": "number",
"default": 15
} }
} }
} }
...@@ -92,6 +92,24 @@ ...@@ -92,6 +92,24 @@
"description": "String. Defines user IMPI. Must be fully filled with hostname if necessary.", "description": "String. Defines user IMPI. Must be fully filled with hostname if necessary.",
"type": "string", "type": "string",
"default": "" "default": ""
},
"promise_cpu_max_spot_temp": {
"title": "Maximum CPU spot temperature (Celcius)",
"description": "Temperature threshold above which CPU temperature promise will fail",
"type": "number",
"default": 80
},
"promise_cpu_max_avg_temp": {
"title": "Maximum CPU average temperature (Celcius)",
"description": "If average temperature over specified duration reaches this threshold, promise will fail",
"type": "number",
"default": 80
},
"promise_cpu_avg_temp_duration": {
"title": "CPU average temperature duration (minutes)",
"description": "Duration during which average temperature should not exceed specified threshold",
"type": "number",
"default": 15
} }
} }
} }
...@@ -104,6 +104,24 @@ ...@@ -104,6 +104,24 @@
"description": "String. Defines user IMPI. Must be fully filled with hostname if necessary.", "description": "String. Defines user IMPI. Must be fully filled with hostname if necessary.",
"type": "string", "type": "string",
"default": "" "default": ""
},
"promise_cpu_max_spot_temp": {
"title": "Maximum CPU spot temperature (Celcius)",
"description": "Temperature threshold above which CPU temperature promise will fail",
"type": "number",
"default": 80
},
"promise_cpu_max_avg_temp": {
"title": "Maximum CPU average temperature (Celcius)",
"description": "If average temperature over specified duration reaches this threshold, promise will fail",
"type": "number",
"default": 80
},
"promise_cpu_avg_temp_duration": {
"title": "CPU average temperature duration (minutes)",
"description": "Duration during which average temperature should not exceed specified threshold",
"type": "number",
"default": 15
} }
} }
} }
...@@ -130,11 +130,23 @@ ...@@ -130,11 +130,23 @@
"type": "number", "type": "number",
"default": 0 "default": 0
}, },
"promise_cpu_temperature_threshold": { "promise_cpu_max_spot_temp": {
"title": "CPU temperature promise threshold", "title": "Maximum CPU spot temperature (Celcius)",
"description": "Temperature threshold above which CPU temperature promise will fail", "description": "Temperature threshold above which CPU temperature promise will fail",
"type": "number", "type": "number",
"default": 90
},
"promise_cpu_max_avg_temp": {
"title": "Maximum CPU average temperature (Celcius)",
"description": "If average temperature over specified duration reaches this threshold, promise will fail",
"type": "number",
"default": 80 "default": 80
},
"promise_cpu_avg_temp_duration": {
"title": "CPU average temperature duration (minutes)",
"description": "Duration during which average temperature should not exceed specified threshold",
"type": "number",
"default": 15
} }
} }
} }
...@@ -112,11 +112,23 @@ ...@@ -112,11 +112,23 @@
"type": "number", "type": "number",
"default": 0 "default": 0
}, },
"promise_cpu_temperature_threshold": { "promise_cpu_max_spot_temp": {
"title": "CPU temperature promise threshold", "title": "Maximum CPU spot temperature (Celcius)",
"description": "Temperature threshold above which CPU temperature promise will fail", "description": "Temperature threshold above which CPU temperature promise will fail",
"type": "number", "type": "number",
"default": 90
},
"promise_cpu_max_avg_temp": {
"title": "Maximum CPU average temperature (Celcius)",
"description": "If average temperature over specified duration reaches this threshold, promise will fail",
"type": "number",
"default": 80 "default": 80
},
"promise_cpu_avg_temp_duration": {
"title": "CPU average temperature duration (minutes)",
"description": "Duration during which average temperature should not exceed specified threshold",
"type": "number",
"default": 15
} }
} }
} }
...@@ -182,11 +182,23 @@ ...@@ -182,11 +182,23 @@
"type": "number", "type": "number",
"default": 0 "default": 0
}, },
"promise_cpu_temperature_threshold": { "promise_cpu_max_spot_temp": {
"title": "CPU temperature promise threshold", "title": "Maximum CPU spot temperature (Celcius)",
"description": "Temperature threshold above which CPU temperature promise will fail", "description": "Temperature threshold above which CPU temperature promise will fail",
"type": "number", "type": "number",
"default": 80 "default": 80
},
"promise_cpu_max_avg_temp": {
"title": "Maximum CPU average temperature (Celcius)",
"description": "If average temperature over specified duration reaches this threshold, promise will fail",
"type": "number",
"default": 80
},
"promise_cpu_avg_temp_duration": {
"title": "CPU average temperature duration (minutes)",
"description": "Duration during which average temperature should not exceed specified threshold",
"type": "number",
"default": 15
} }
} }
} }
...@@ -164,11 +164,23 @@ ...@@ -164,11 +164,23 @@
"type": "number", "type": "number",
"default": 0 "default": 0
}, },
"promise_cpu_temperature_threshold": { "promise_cpu_max_spot_temp": {
"title": "CPU temperature promise threshold", "title": "Maximum CPU spot temperature (Celcius)",
"description": "Temperature threshold above which CPU temperature promise will fail", "description": "Temperature threshold above which CPU temperature promise will fail",
"type": "number", "type": "number",
"default": 80 "default": 80
},
"promise_cpu_max_avg_temp": {
"title": "Maximum CPU average temperature (Celcius)",
"description": "If average temperature over specified duration reaches this threshold, promise will fail",
"type": "number",
"default": 80
},
"promise_cpu_avg_temp_duration": {
"title": "CPU average temperature duration (minutes)",
"description": "Duration during which average temperature should not exceed specified threshold",
"type": "number",
"default": 15
} }
} }
} }
...@@ -92,6 +92,24 @@ ...@@ -92,6 +92,24 @@
"description": "String. Defines user IMPI. Must be fully filled with hostname if necessary.", "description": "String. Defines user IMPI. Must be fully filled with hostname if necessary.",
"type": "string", "type": "string",
"default": "" "default": ""
},
"promise_cpu_max_spot_temp": {
"title": "Maximum CPU spot temperature (Celcius)",
"description": "Temperature threshold above which CPU temperature promise will fail",
"type": "number",
"default": 80
},
"promise_cpu_max_avg_temp": {
"title": "Maximum CPU average temperature (Celcius)",
"description": "If average temperature over specified duration reaches this threshold, promise will fail",
"type": "number",
"default": 80
},
"promise_cpu_avg_temp_duration": {
"title": "CPU average temperature duration (minutes)",
"description": "Duration during which average temperature should not exceed specified threshold",
"type": "number",
"default": 15
} }
} }
} }
...@@ -104,6 +104,24 @@ ...@@ -104,6 +104,24 @@
"description": "String. Defines user IMPI. Must be fully filled with hostname if necessary.", "description": "String. Defines user IMPI. Must be fully filled with hostname if necessary.",
"type": "string", "type": "string",
"default": "" "default": ""
},
"promise_cpu_max_spot_temp": {
"title": "Maximum CPU spot temperature (Celcius)",
"description": "Temperature threshold above which CPU temperature promise will fail",
"type": "number",
"default": 80
},
"promise_cpu_max_avg_temp": {
"title": "Maximum CPU average temperature (Celcius)",
"description": "If average temperature over specified duration reaches this threshold, promise will fail",
"type": "number",
"default": 80
},
"promise_cpu_avg_temp_duration": {
"title": "CPU average temperature duration (minutes)",
"description": "Duration during which average temperature should not exceed specified threshold",
"type": "number",
"default": 15
} }
} }
} }
...@@ -92,6 +92,24 @@ ...@@ -92,6 +92,24 @@
"description": "String. Defines user IMPI. Must be fully filled with hostname if necessary.", "description": "String. Defines user IMPI. Must be fully filled with hostname if necessary.",
"type": "string", "type": "string",
"default": "" "default": ""
},
"promise_cpu_max_spot_temp": {
"title": "Maximum CPU spot temperature (Celcius)",
"description": "Temperature threshold above which CPU temperature promise will fail",
"type": "number",
"default": 80
},
"promise_cpu_max_avg_temp": {
"title": "Maximum CPU average temperature (Celcius)",
"description": "If average temperature over specified duration reaches this threshold, promise will fail",
"type": "number",
"default": 80
},
"promise_cpu_avg_temp_duration": {
"title": "CPU average temperature duration (minutes)",
"description": "Duration during which average temperature should not exceed specified threshold",
"type": "number",
"default": 15
} }
} }
} }
...@@ -136,4 +136,6 @@ eggs = slapos.core ...@@ -136,4 +136,6 @@ eggs = slapos.core
file = {{ cpu_temperature_promise }} file = {{ cpu_temperature_promise }}
output = ${directory:plugins}/check-cpu-temperature.py output = ${directory:plugins}/check-cpu-temperature.py
config-testing = {{ slapparameter_dict.get("testing", False) }} config-testing = {{ slapparameter_dict.get("testing", False) }}
config-maxtemp = {{ slapparameter_dict.get("promise_cpu_temperature_threshold", 80) }} config-max-spot-temp = {{ slapparameter_dict.get("promise_cpu_max_spot_temp", 90) }}
config-max-avg-temp = {{ slapparameter_dict.get("promise_cpu_max_avg_temp", 80) }}
config-avg-temp-duration = {{ slapparameter_dict.get("promise_cpu_avg_temp_duration", 15) }}
...@@ -104,6 +104,24 @@ ...@@ -104,6 +104,24 @@
"description": "String. Defines user IMPI. Must be fully filled with hostname if necessary.", "description": "String. Defines user IMPI. Must be fully filled with hostname if necessary.",
"type": "string", "type": "string",
"default": "" "default": ""
},
"promise_cpu_max_spot_temp": {
"title": "Maximum CPU spot temperature (Celcius)",
"description": "Temperature threshold above which CPU temperature promise will fail",
"type": "number",
"default": 80
},
"promise_cpu_max_avg_temp": {
"title": "Maximum CPU average temperature (Celcius)",
"description": "If average temperature over specified duration reaches this threshold, promise will fail",
"type": "number",
"default": 80
},
"promise_cpu_avg_temp_duration": {
"title": "CPU average temperature duration (minutes)",
"description": "Duration during which average temperature should not exceed specified threshold",
"type": "number",
"default": 15
} }
} }
} }
...@@ -139,4 +139,6 @@ eggs = slapos.core ...@@ -139,4 +139,6 @@ eggs = slapos.core
file = {{ cpu_temperature_promise }} file = {{ cpu_temperature_promise }}
output = ${directory:plugins}/check-cpu-temperature.py output = ${directory:plugins}/check-cpu-temperature.py
config-testing = {{ slapparameter_dict.get("testing", False) }} config-testing = {{ slapparameter_dict.get("testing", False) }}
config-maxtemp = {{ slapparameter_dict.get("promise_cpu_temperature_threshold", 80) }} config-max-spot-temp = {{ slapparameter_dict.get("promise_cpu_max_spot_temp", 90) }}
config-max-avg-temp = {{ slapparameter_dict.get("promise_cpu_max_avg_temp", 80) }}
config-avg-temp-duration = {{ slapparameter_dict.get("promise_cpu_avg_temp_duration", 15) }}
import socket
import errno import errno
import logging
import json import json
import logging
import os import os
import psutil import psutil
import socket
import time
from dateutil import parser
from zope.interface import implementer from zope.interface import implementer
from slapos.grid.promise import interface from slapos.grid.promise import interface
from slapos.grid.promise.generic import GenericPromise from slapos.grid.promise.generic import GenericPromise
# Get all data in the last "interval" seconds from JSON log
def get_data_interval(log, interval):
log_number = 0
latest_timestamp = 0
data_list = []
while True:
try:
f = open("{}.{}".format(log, log_number) if log_number else log, "rb")
except OSError:
return data_list
try:
f.seek(0, os.SEEK_END)
while True:
try:
while f.seek(-2, os.SEEK_CUR) and f.read(1) != b'\n':
pass
except OSError:
break
pos = f.tell()
l = json.loads(f.readline().decode().replace("'", '"'))
timestamp = parser.parse(l['time'])
data_list.append(l['data'])
if not latest_timestamp:
latest_timestamp = timestamp
if (latest_timestamp - timestamp).total_seconds() > interval:
return data_list
f.seek(pos, os.SEEK_SET)
finally:
f.close()
log_number += 1
@implementer(interface.IPromise) @implementer(interface.IPromise)
class RunPromise(GenericPromise): class RunPromise(GenericPromise):
...@@ -16,6 +52,8 @@ class RunPromise(GenericPromise): ...@@ -16,6 +52,8 @@ class RunPromise(GenericPromise):
self.__name = config.get('name', None) self.__name = config.get('name', None)
self.__log_folder = config.get('log-folder', None) self.__log_folder = config.get('log-folder', None)
self.last_avg_computation_file = self.getConfig(
'last-avg-computation-file', '')
super(RunPromise, self).__init__(config) super(RunPromise, self).__init__(config)
self.setPeriodicity(minute=2) self.setPeriodicity(minute=2)
...@@ -26,29 +64,58 @@ class RunPromise(GenericPromise): ...@@ -26,29 +64,58 @@ class RunPromise(GenericPromise):
self.json_logger = logging.getLogger('json_logger') self.json_logger = logging.getLogger('json_logger')
self.json_logger.setLevel(logging.INFO) self.json_logger.setLevel(logging.INFO)
handler = logging.FileHandler(self.__log_file) handler = logging.FileHandler(self.__log_file)
formatter = logging.Formatter('{"time": "%(asctime)s", "log_level": "%(levelname)s", "message": "%(message)s", "data": %(data)s}') formatter = logging.Formatter('{"time": "%(asctime)s", "log_level": '\
'"%(levelname)s", "message": "%(message)s", "data": %(data)s}')
handler.setFormatter(formatter) handler.setFormatter(formatter)
self.json_logger.addHandler(handler) self.json_logger.addHandler(handler)
def sense(self): def sense(self):
max_temp = int(self.getConfig('max-temp', 80)) promise_success = True
max_spot_temp = float(self.getConfig('max-spot-temp', 90))
max_avg_temp = float(self.getConfig('max-avg-temp', 80))
avg_temp_duration = 60 * int(self.getConfig('avg-temp-duration', 5))
testing = self.getConfig('testing') == "True" testing = self.getConfig('testing') == "True"
# Get current temperature
if testing: if testing:
from random import randint from random import randint
cpu_temp = randint(40, 75) cpu_temp = randint(40, 75)
else: else:
data = psutil.sensors_temperatures() data = psutil.sensors_temperatures()
cpu_temp = data['coretemp'][0][1] cpu_temp = data['coretemp'][0][1]
if cpu_temp > max_spot_temp:
self.logger.error("Temperature reached critical threshold: %s degrees "\
"celsius (threshold is %s degrees celsius)" % (cpu_temp, max_spot_temp))
promise_success = False
# Log temperature
data = json.dumps({'cpu_temperature': cpu_temp}) data = json.dumps({'cpu_temperature': cpu_temp})
if cpu_temp > max_temp: self.json_logger.info("Temperature data", extra={'data': data})
self.logger.error("Temperature too high (%s > %s)" % (cpu_temp, max_temp))
self.json_logger.info("Temperature too high (%s > %s)" % (cpu_temp, max_temp), extra={'data': data}) # Computer average temperature
avg_computation_period = avg_temp_duration / 4
try:
t = os.path.getmtime(self.last_avg_computation_file)
except OSError:
t = 0
if (time.time() - t) > avg_computation_period:
open(self.last_avg_computation_file).close()
temp_list = get_data_interval(self.__log_file, avg_temp_duration)
if temp_list:
avg_temp = sum(map(lambda x: x['cpu_temperature'], temp_list)) / len(temp_list)
if avg_temp > max_avg_temp:
self.logger.error("Average temperature over the last %s seconds "\
"reached threshold: %s degrees celsius (threshold is %s degrees "\
"celsius)" % (avg_temp_duration, avg_temp, max_avg_temp))
promise_success = False
else: else:
self.logger.error("Couldn't read temperature from log")
promise_success = False
if promise_success:
self.logger.info("Temperature OK") self.logger.info("Temperature OK")
self.json_logger.info("Temperature OK", extra={'data': data})
def test(self): def test(self):
""" """
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment