Aims to resolve #16. Dependent upon #15 being merged first.
CPU Monitor and idle switch offs
Adds mechanisms for checking the CPU utilisation of running instances, for both Azure and AWS projects. A cron job is included to perform this check every 20 minutes
This calculates the average of the maximum CPU utilisation values over the past 20 minutes. If less than 20 mins of data, it is treated as 100%, so recently switched on instances aren't switched off
If this value is less than the set value of the project's utilisation_threshold, then the instance will be automatically switched off. An associated action log is created and a slack message sent with the details
This process can be disabled by setting the project's monitor_active to false, or temporarily by setting override_monitor_until (with a valid date and time)
Whenever this check is made, the results are recorded in dedicated logs, in log/monitor/project_name. A maximum of 71 logs for each project are retained (at which point the earliest log will be deleted before the new one is created)
Override monitor in change requests & Config Logs
For change requests that are selected to take place in the future (not 'now'), the user now has the option to set monitor_override_hours for the request
If set, when the request is carried out, the project's override_monitor_until will be updated to the specified number of hours in the future
The details of this change are also recorded in a new ConfigLog for auditing purposes. In the future this will be extended to record other changes, as part of a dedicated policies page
Override hours are now also shown in the manage events tables
Implementation Detail
Monitor functionality is added in two new services, AwsMonitor and AzureMonitor. Both make use of MonitorLogging
This is a divergence from visualiser, which used a single, semi-external script
This should allow for more straightforward addition of similar functionality for other platforms in the future
Aims to resolve #16. Dependent upon #15 being merged first.
CPU Monitor and idle switch offs
utilisation_threshold
, then the instance will be automatically switched off. An associated action log is created and a slack message sent with the detailsmonitor_active
to false, or temporarily by settingoverride_monitor_until
(with a valid date and time)log/monitor/project_name
. A maximum of 71 logs for each project are retained (at which point the earliest log will be deleted before the new one is created)Override monitor in change requests & Config Logs
monitor_override_hours
for the requestoverride_monitor_until
will be updated to the specified number of hours in the futureConfigLog
for auditing purposes. In the future this will be extended to record other changes, as part of a dedicated policies pageImplementation Detail
AwsMonitor
andAzureMonitor
. Both make use ofMonitorLogging